Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 63 | #define yylex llvmAsmlex |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 64 | #define yyerror llvmAsmerror |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
| 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, |
| 165 | EQ = 346, |
| 166 | NE = 347, |
| 167 | SLT = 348, |
| 168 | SGT = 349, |
| 169 | SLE = 350, |
| 170 | SGE = 351, |
| 171 | ULT = 352, |
| 172 | UGT = 353, |
| 173 | ULE = 354, |
| 174 | UGE = 355, |
| 175 | OEQ = 356, |
| 176 | ONE = 357, |
| 177 | OLT = 358, |
| 178 | OGT = 359, |
| 179 | OLE = 360, |
| 180 | OGE = 361, |
| 181 | ORD = 362, |
| 182 | UNO = 363, |
| 183 | UEQ = 364, |
| 184 | UNE = 365, |
| 185 | MALLOC = 366, |
| 186 | ALLOCA = 367, |
| 187 | FREE = 368, |
| 188 | LOAD = 369, |
| 189 | STORE = 370, |
| 190 | GETELEMENTPTR = 371, |
| 191 | TRUNC = 372, |
| 192 | ZEXT = 373, |
| 193 | SEXT = 374, |
| 194 | FPTRUNC = 375, |
| 195 | FPEXT = 376, |
| 196 | BITCAST = 377, |
| 197 | UITOFP = 378, |
| 198 | SITOFP = 379, |
| 199 | FPTOUI = 380, |
| 200 | FPTOSI = 381, |
| 201 | INTTOPTR = 382, |
| 202 | PTRTOINT = 383, |
| 203 | PHI_TOK = 384, |
| 204 | SELECT = 385, |
| 205 | VAARG = 386, |
| 206 | EXTRACTELEMENT = 387, |
| 207 | INSERTELEMENT = 388, |
| 208 | SHUFFLEVECTOR = 389, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 209 | GETRESULT = 390, |
| 210 | SIGNEXT = 391, |
| 211 | ZEROEXT = 392, |
| 212 | NORETURN = 393, |
| 213 | INREG = 394, |
| 214 | SRET = 395, |
| 215 | NOUNWIND = 396, |
| 216 | NOALIAS = 397, |
| 217 | BYVAL = 398, |
| 218 | NEST = 399, |
| 219 | READNONE = 400, |
| 220 | READONLY = 401, |
| 221 | GC = 402, |
| 222 | DEFAULT = 403, |
| 223 | HIDDEN = 404, |
| 224 | PROTECTED = 405 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 225 | }; |
| 226 | #endif |
| 227 | /* Tokens. */ |
| 228 | #define ESINT64VAL 258 |
| 229 | #define EUINT64VAL 259 |
| 230 | #define ESAPINTVAL 260 |
| 231 | #define EUAPINTVAL 261 |
| 232 | #define LOCALVAL_ID 262 |
| 233 | #define GLOBALVAL_ID 263 |
| 234 | #define FPVAL 264 |
| 235 | #define VOID 265 |
| 236 | #define INTTYPE 266 |
| 237 | #define FLOAT 267 |
| 238 | #define DOUBLE 268 |
| 239 | #define X86_FP80 269 |
| 240 | #define FP128 270 |
| 241 | #define PPC_FP128 271 |
| 242 | #define LABEL 272 |
| 243 | #define TYPE 273 |
| 244 | #define LOCALVAR 274 |
| 245 | #define GLOBALVAR 275 |
| 246 | #define LABELSTR 276 |
| 247 | #define STRINGCONSTANT 277 |
| 248 | #define ATSTRINGCONSTANT 278 |
| 249 | #define PCTSTRINGCONSTANT 279 |
| 250 | #define ZEROINITIALIZER 280 |
| 251 | #define TRUETOK 281 |
| 252 | #define FALSETOK 282 |
| 253 | #define BEGINTOK 283 |
| 254 | #define ENDTOK 284 |
| 255 | #define DECLARE 285 |
| 256 | #define DEFINE 286 |
| 257 | #define GLOBAL 287 |
| 258 | #define CONSTANT 288 |
| 259 | #define SECTION 289 |
| 260 | #define ALIAS 290 |
| 261 | #define VOLATILE 291 |
| 262 | #define THREAD_LOCAL 292 |
| 263 | #define TO 293 |
| 264 | #define DOTDOTDOT 294 |
| 265 | #define NULL_TOK 295 |
| 266 | #define UNDEF 296 |
| 267 | #define INTERNAL 297 |
| 268 | #define LINKONCE 298 |
| 269 | #define WEAK 299 |
| 270 | #define APPENDING 300 |
| 271 | #define DLLIMPORT 301 |
| 272 | #define DLLEXPORT 302 |
| 273 | #define EXTERN_WEAK 303 |
| 274 | #define OPAQUE 304 |
| 275 | #define EXTERNAL 305 |
| 276 | #define TARGET 306 |
| 277 | #define TRIPLE 307 |
| 278 | #define ALIGN 308 |
| 279 | #define ADDRSPACE 309 |
| 280 | #define DEPLIBS 310 |
| 281 | #define CALL 311 |
| 282 | #define TAIL 312 |
| 283 | #define ASM_TOK 313 |
| 284 | #define MODULE 314 |
| 285 | #define SIDEEFFECT 315 |
| 286 | #define CC_TOK 316 |
| 287 | #define CCC_TOK 317 |
| 288 | #define FASTCC_TOK 318 |
| 289 | #define COLDCC_TOK 319 |
| 290 | #define X86_STDCALLCC_TOK 320 |
| 291 | #define X86_FASTCALLCC_TOK 321 |
| 292 | #define DATALAYOUT 322 |
| 293 | #define RET 323 |
| 294 | #define BR 324 |
| 295 | #define SWITCH 325 |
| 296 | #define INVOKE 326 |
| 297 | #define UNWIND 327 |
| 298 | #define UNREACHABLE 328 |
| 299 | #define ADD 329 |
| 300 | #define SUB 330 |
| 301 | #define MUL 331 |
| 302 | #define UDIV 332 |
| 303 | #define SDIV 333 |
| 304 | #define FDIV 334 |
| 305 | #define UREM 335 |
| 306 | #define SREM 336 |
| 307 | #define FREM 337 |
| 308 | #define AND 338 |
| 309 | #define OR 339 |
| 310 | #define XOR 340 |
| 311 | #define SHL 341 |
| 312 | #define LSHR 342 |
| 313 | #define ASHR 343 |
| 314 | #define ICMP 344 |
| 315 | #define FCMP 345 |
| 316 | #define EQ 346 |
| 317 | #define NE 347 |
| 318 | #define SLT 348 |
| 319 | #define SGT 349 |
| 320 | #define SLE 350 |
| 321 | #define SGE 351 |
| 322 | #define ULT 352 |
| 323 | #define UGT 353 |
| 324 | #define ULE 354 |
| 325 | #define UGE 355 |
| 326 | #define OEQ 356 |
| 327 | #define ONE 357 |
| 328 | #define OLT 358 |
| 329 | #define OGT 359 |
| 330 | #define OLE 360 |
| 331 | #define OGE 361 |
| 332 | #define ORD 362 |
| 333 | #define UNO 363 |
| 334 | #define UEQ 364 |
| 335 | #define UNE 365 |
| 336 | #define MALLOC 366 |
| 337 | #define ALLOCA 367 |
| 338 | #define FREE 368 |
| 339 | #define LOAD 369 |
| 340 | #define STORE 370 |
| 341 | #define GETELEMENTPTR 371 |
| 342 | #define TRUNC 372 |
| 343 | #define ZEXT 373 |
| 344 | #define SEXT 374 |
| 345 | #define FPTRUNC 375 |
| 346 | #define FPEXT 376 |
| 347 | #define BITCAST 377 |
| 348 | #define UITOFP 378 |
| 349 | #define SITOFP 379 |
| 350 | #define FPTOUI 380 |
| 351 | #define FPTOSI 381 |
| 352 | #define INTTOPTR 382 |
| 353 | #define PTRTOINT 383 |
| 354 | #define PHI_TOK 384 |
| 355 | #define SELECT 385 |
| 356 | #define VAARG 386 |
| 357 | #define EXTRACTELEMENT 387 |
| 358 | #define INSERTELEMENT 388 |
| 359 | #define SHUFFLEVECTOR 389 |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 360 | #define GETRESULT 390 |
| 361 | #define SIGNEXT 391 |
| 362 | #define ZEROEXT 392 |
| 363 | #define NORETURN 393 |
| 364 | #define INREG 394 |
| 365 | #define SRET 395 |
| 366 | #define NOUNWIND 396 |
| 367 | #define NOALIAS 397 |
| 368 | #define BYVAL 398 |
| 369 | #define NEST 399 |
| 370 | #define READNONE 400 |
| 371 | #define READONLY 401 |
| 372 | #define GC 402 |
| 373 | #define DEFAULT 403 |
| 374 | #define HIDDEN 404 |
| 375 | #define PROTECTED 405 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | /* Copy the first part of user declarations. */ |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 381 | #line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 382 | |
| 383 | #include "ParserInternals.h" |
| 384 | #include "llvm/CallingConv.h" |
| 385 | #include "llvm/InlineAsm.h" |
| 386 | #include "llvm/Instructions.h" |
| 387 | #include "llvm/Module.h" |
| 388 | #include "llvm/ValueSymbolTable.h" |
Chandler Carruth | 563d4a4 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 389 | #include "llvm/AutoUpgrade.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 390 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
| 391 | #include "llvm/Support/CommandLine.h" |
| 392 | #include "llvm/ADT/SmallVector.h" |
| 393 | #include "llvm/ADT/STLExtras.h" |
| 394 | #include "llvm/Support/MathExtras.h" |
| 395 | #include "llvm/Support/Streams.h" |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 396 | #include "llvm/ParamAttrsList.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 397 | #include <algorithm> |
| 398 | #include <list> |
| 399 | #include <map> |
| 400 | #include <utility> |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 401 | |
| 402 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 403 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 404 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 405 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 406 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 407 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 408 | // GenerateError are made from inside productions and they must simulate the |
| 409 | // previous exception behavior by exiting the production immediately. We have |
| 410 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 411 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 412 | // recursive descent parser. |
| 413 | static bool TriggerError = false; |
| 414 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
| 415 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 416 | |
| 417 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 418 | int yylex(); // declaration" of xxx warnings. |
| 419 | int yyparse(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 420 | using namespace llvm; |
| 421 | |
| 422 | static Module *ParserResult; |
| 423 | |
| 424 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 425 | // relating to upreferences in the input stream. |
| 426 | // |
| 427 | //#define DEBUG_UPREFS 1 |
| 428 | #ifdef DEBUG_UPREFS |
| 429 | #define UR_OUT(X) cerr << X |
| 430 | #else |
| 431 | #define UR_OUT(X) |
| 432 | #endif |
| 433 | |
| 434 | #define YYERROR_VERBOSE 1 |
| 435 | |
| 436 | static GlobalVariable *CurGV; |
| 437 | |
| 438 | |
| 439 | // This contains info used when building the body of a function. It is |
| 440 | // destroyed when the function is completed. |
| 441 | // |
| 442 | typedef std::vector<Value *> ValueList; // Numbered defs |
| 443 | |
| 444 | static void |
| 445 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
| 446 | |
| 447 | static struct PerModuleInfo { |
| 448 | Module *CurrentModule; |
| 449 | ValueList Values; // Module level numbered definitions |
| 450 | ValueList LateResolveValues; |
| 451 | std::vector<PATypeHolder> Types; |
| 452 | std::map<ValID, PATypeHolder> LateResolveTypes; |
| 453 | |
| 454 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
| 455 | /// how they were referenced and on which line of the input they came from so |
| 456 | /// that we can resolve them later and print error messages as appropriate. |
| 457 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 458 | |
| 459 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 460 | // references to global values. Global values may be referenced before they |
| 461 | // are defined, and if so, the temporary object that they represent is held |
| 462 | // here. This is used for forward references of GlobalValues. |
| 463 | // |
| 464 | typedef std::map<std::pair<const PointerType *, |
| 465 | ValID>, GlobalValue*> GlobalRefsType; |
| 466 | GlobalRefsType GlobalRefs; |
| 467 | |
| 468 | void ModuleDone() { |
| 469 | // If we could not resolve some functions at function compilation time |
| 470 | // (calls to functions before they are defined), resolve them now... Types |
| 471 | // are resolved when the constant pool has been completely parsed. |
| 472 | // |
| 473 | ResolveDefinitions(LateResolveValues); |
| 474 | if (TriggerError) |
| 475 | return; |
| 476 | |
| 477 | // Check to make sure that all global value forward references have been |
| 478 | // resolved! |
| 479 | // |
| 480 | if (!GlobalRefs.empty()) { |
| 481 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 482 | |
| 483 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 484 | I != E; ++I) { |
| 485 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 486 | I->first.second.getName() + "\n"; |
| 487 | } |
| 488 | GenerateError(UndefinedReferences); |
| 489 | return; |
| 490 | } |
| 491 | |
Chandler Carruth | 563d4a4 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 492 | // Look for intrinsic functions and CallInst that need to be upgraded |
| 493 | for (Module::iterator FI = CurrentModule->begin(), |
| 494 | FE = CurrentModule->end(); FI != FE; ) |
| 495 | UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove |
| 496 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 497 | Values.clear(); // Clear out function local definitions |
| 498 | Types.clear(); |
| 499 | CurrentModule = 0; |
| 500 | } |
| 501 | |
| 502 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 503 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 504 | // If not, just return null. |
| 505 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 506 | // Check to see if there is a forward reference to this global variable... |
| 507 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 508 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 509 | GlobalValue *Ret = 0; |
| 510 | if (I != GlobalRefs.end()) { |
| 511 | Ret = I->second; |
| 512 | GlobalRefs.erase(I); |
| 513 | } |
| 514 | return Ret; |
| 515 | } |
| 516 | |
| 517 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 518 | // If it isn't abstract, its resolved |
| 519 | const Type* Ty = PATy->get(); |
| 520 | if (!Ty->isAbstract()) |
| 521 | return false; |
| 522 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 523 | // we don't need to traverse that leg of the type. |
| 524 | std::vector<const Type*> WorkList, SeenList; |
| 525 | WorkList.push_back(Ty); |
| 526 | while (!WorkList.empty()) { |
| 527 | const Type* Ty = WorkList.back(); |
| 528 | SeenList.push_back(Ty); |
| 529 | WorkList.pop_back(); |
| 530 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 531 | // Check to see if this is an unresolved type |
| 532 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 533 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 534 | for ( ; I != E; ++I) { |
| 535 | if (I->second.get() == OpTy) |
| 536 | return true; |
| 537 | } |
| 538 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 539 | const Type* TheTy = SeqTy->getElementType(); |
| 540 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 541 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 542 | E = SeenList.end(); |
| 543 | for ( ; I != E; ++I) |
| 544 | if (*I == TheTy) |
| 545 | break; |
| 546 | if (I == E) |
| 547 | WorkList.push_back(TheTy); |
| 548 | } |
| 549 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 550 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 551 | const Type* TheTy = StrTy->getElementType(i); |
| 552 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 553 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 554 | E = SeenList.end(); |
| 555 | for ( ; I != E; ++I) |
| 556 | if (*I == TheTy) |
| 557 | break; |
| 558 | if (I == E) |
| 559 | WorkList.push_back(TheTy); |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | } |
| 564 | return false; |
| 565 | } |
| 566 | } CurModule; |
| 567 | |
| 568 | static struct PerFunctionInfo { |
| 569 | Function *CurrentFunction; // Pointer to current function being created |
| 570 | |
| 571 | ValueList Values; // Keep track of #'d definitions |
| 572 | unsigned NextValNum; |
| 573 | ValueList LateResolveValues; |
| 574 | bool isDeclare; // Is this function a forward declararation? |
| 575 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
| 576 | GlobalValue::VisibilityTypes Visibility; |
| 577 | |
| 578 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 579 | /// track of them here. |
| 580 | std::map<ValID, BasicBlock*> BBForwardRefs; |
| 581 | |
| 582 | inline PerFunctionInfo() { |
| 583 | CurrentFunction = 0; |
| 584 | isDeclare = false; |
| 585 | Linkage = GlobalValue::ExternalLinkage; |
| 586 | Visibility = GlobalValue::DefaultVisibility; |
| 587 | } |
| 588 | |
| 589 | inline void FunctionStart(Function *M) { |
| 590 | CurrentFunction = M; |
| 591 | NextValNum = 0; |
| 592 | } |
| 593 | |
| 594 | void FunctionDone() { |
| 595 | // Any forward referenced blocks left? |
| 596 | if (!BBForwardRefs.empty()) { |
| 597 | GenerateError("Undefined reference to label " + |
| 598 | BBForwardRefs.begin()->second->getName()); |
| 599 | return; |
| 600 | } |
| 601 | |
| 602 | // Resolve all forward references now. |
| 603 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 604 | |
| 605 | Values.clear(); // Clear out function local definitions |
| 606 | BBForwardRefs.clear(); |
| 607 | CurrentFunction = 0; |
| 608 | isDeclare = false; |
| 609 | Linkage = GlobalValue::ExternalLinkage; |
| 610 | Visibility = GlobalValue::DefaultVisibility; |
| 611 | } |
| 612 | } CurFun; // Info for the current function... |
| 613 | |
| 614 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 615 | |
| 616 | |
| 617 | //===----------------------------------------------------------------------===// |
| 618 | // Code to handle definitions of all the types |
| 619 | //===----------------------------------------------------------------------===// |
| 620 | |
| 621 | static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
| 622 | // Things that have names or are void typed don't get slot numbers |
| 623 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
| 624 | return; |
| 625 | |
| 626 | // In the case of function values, we have to allow for the forward reference |
| 627 | // of basic blocks, which are included in the numbering. Consequently, we keep |
| 628 | // track of the next insertion location with NextValNum. When a BB gets |
| 629 | // inserted, it could change the size of the CurFun.Values vector. |
| 630 | if (&ValueTab == &CurFun.Values) { |
| 631 | if (ValueTab.size() <= CurFun.NextValNum) |
| 632 | ValueTab.resize(CurFun.NextValNum+1); |
| 633 | ValueTab[CurFun.NextValNum++] = V; |
| 634 | return; |
| 635 | } |
| 636 | // For all other lists, its okay to just tack it on the back of the vector. |
| 637 | ValueTab.push_back(V); |
| 638 | } |
| 639 | |
| 640 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 641 | switch (D.Type) { |
| 642 | case ValID::LocalID: // Is it a numbered definition? |
| 643 | // Module constants occupy the lowest numbered slots... |
| 644 | if (D.Num < CurModule.Types.size()) |
| 645 | return CurModule.Types[D.Num]; |
| 646 | break; |
| 647 | case ValID::LocalName: // Is it a named definition? |
| 648 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
| 649 | D.destroy(); // Free old strdup'd memory... |
| 650 | return N; |
| 651 | } |
| 652 | break; |
| 653 | default: |
| 654 | GenerateError("Internal parser error: Invalid symbol type reference"); |
| 655 | return 0; |
| 656 | } |
| 657 | |
| 658 | // If we reached here, we referenced either a symbol that we don't know about |
| 659 | // or an id number that hasn't been read yet. We may be referencing something |
| 660 | // forward, so just create an entry to be resolved later and get to it... |
| 661 | // |
| 662 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 663 | |
| 664 | |
| 665 | if (inFunctionScope()) { |
| 666 | if (D.Type == ValID::LocalName) { |
| 667 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
| 668 | return 0; |
| 669 | } else { |
| 670 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
| 671 | return 0; |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
| 676 | if (I != CurModule.LateResolveTypes.end()) |
| 677 | return I->second; |
| 678 | |
| 679 | Type *Typ = OpaqueType::get(); |
| 680 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 681 | return Typ; |
| 682 | } |
| 683 | |
| 684 | // getExistingVal - Look up the value specified by the provided type and |
| 685 | // the provided ValID. If the value exists and has already been defined, return |
| 686 | // it. Otherwise return null. |
| 687 | // |
| 688 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
| 689 | if (isa<FunctionType>(Ty)) { |
| 690 | GenerateError("Functions are not values and " |
| 691 | "must be referenced as pointers"); |
| 692 | return 0; |
| 693 | } |
| 694 | |
| 695 | switch (D.Type) { |
| 696 | case ValID::LocalID: { // Is it a numbered definition? |
| 697 | // Check that the number is within bounds. |
| 698 | if (D.Num >= CurFun.Values.size()) |
| 699 | return 0; |
| 700 | Value *Result = CurFun.Values[D.Num]; |
| 701 | if (Ty != Result->getType()) { |
| 702 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
| 703 | Result->getType()->getDescription() + "' does not match " |
| 704 | "expected type, '" + Ty->getDescription() + "'"); |
| 705 | return 0; |
| 706 | } |
| 707 | return Result; |
| 708 | } |
| 709 | case ValID::GlobalID: { // Is it a numbered definition? |
| 710 | if (D.Num >= CurModule.Values.size()) |
| 711 | return 0; |
| 712 | Value *Result = CurModule.Values[D.Num]; |
| 713 | if (Ty != Result->getType()) { |
| 714 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
| 715 | Result->getType()->getDescription() + "' does not match " |
| 716 | "expected type, '" + Ty->getDescription() + "'"); |
| 717 | return 0; |
| 718 | } |
| 719 | return Result; |
| 720 | } |
| 721 | |
| 722 | case ValID::LocalName: { // Is it a named definition? |
| 723 | if (!inFunctionScope()) |
| 724 | return 0; |
| 725 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
| 726 | Value *N = SymTab.lookup(D.getName()); |
| 727 | if (N == 0) |
| 728 | return 0; |
| 729 | if (N->getType() != Ty) |
| 730 | return 0; |
| 731 | |
| 732 | D.destroy(); // Free old strdup'd memory... |
| 733 | return N; |
| 734 | } |
| 735 | case ValID::GlobalName: { // Is it a named definition? |
| 736 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
| 737 | Value *N = SymTab.lookup(D.getName()); |
| 738 | if (N == 0) |
| 739 | return 0; |
| 740 | if (N->getType() != Ty) |
| 741 | return 0; |
| 742 | |
| 743 | D.destroy(); // Free old strdup'd memory... |
| 744 | return N; |
| 745 | } |
| 746 | |
| 747 | // Check to make sure that "Ty" is an integral type, and that our |
| 748 | // value will fit into the specified type... |
| 749 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 750 | if (!isa<IntegerType>(Ty) || |
| 751 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 752 | GenerateError("Signed integral constant '" + |
| 753 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 754 | Ty->getDescription() + "'"); |
| 755 | return 0; |
| 756 | } |
| 757 | return ConstantInt::get(Ty, D.ConstPool64, true); |
| 758 | |
| 759 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 760 | if (isa<IntegerType>(Ty) && |
| 761 | ConstantInt::isValueValidForType(Ty, D.UConstPool64)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 762 | return ConstantInt::get(Ty, D.UConstPool64); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 763 | |
| 764 | if (!isa<IntegerType>(Ty) || |
| 765 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
| 766 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
| 767 | "' is invalid or out of range for type '" + |
| 768 | Ty->getDescription() + "'"); |
| 769 | return 0; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 770 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 771 | // This is really a signed reference. Transmogrify. |
| 772 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 773 | |
| 774 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 775 | if (!Ty->isFloatingPoint() || |
| 776 | !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 777 | GenerateError("FP constant invalid for type"); |
| 778 | return 0; |
| 779 | } |
Dale Johannesen | 255b8fe | 2007-09-11 18:33:39 +0000 | [diff] [blame] | 780 | // Lexer has no type info, so builds all float and double FP constants |
| 781 | // as double. Fix this here. Long double does not need this. |
| 782 | if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && |
| 783 | Ty==Type::FloatTy) |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 784 | D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
| 785 | return ConstantFP::get(Ty, *D.ConstPoolFP); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 786 | |
| 787 | case ValID::ConstNullVal: // Is it a null value? |
| 788 | if (!isa<PointerType>(Ty)) { |
| 789 | GenerateError("Cannot create a a non pointer null"); |
| 790 | return 0; |
| 791 | } |
| 792 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 793 | |
| 794 | case ValID::ConstUndefVal: // Is it an undef value? |
| 795 | return UndefValue::get(Ty); |
| 796 | |
| 797 | case ValID::ConstZeroVal: // Is it a zero value? |
| 798 | return Constant::getNullValue(Ty); |
| 799 | |
| 800 | case ValID::ConstantVal: // Fully resolved constant? |
| 801 | if (D.ConstantValue->getType() != Ty) { |
| 802 | GenerateError("Constant expression type different from required type"); |
| 803 | return 0; |
| 804 | } |
| 805 | return D.ConstantValue; |
| 806 | |
| 807 | case ValID::InlineAsmVal: { // Inline asm expression |
| 808 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 809 | const FunctionType *FTy = |
| 810 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
| 811 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
| 812 | GenerateError("Invalid type for asm constraint string"); |
| 813 | return 0; |
| 814 | } |
| 815 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 816 | D.IAD->HasSideEffects); |
| 817 | D.destroy(); // Free InlineAsmDescriptor. |
| 818 | return IA; |
| 819 | } |
| 820 | default: |
| 821 | assert(0 && "Unhandled case!"); |
| 822 | return 0; |
| 823 | } // End of switch |
| 824 | |
| 825 | assert(0 && "Unhandled case!"); |
| 826 | return 0; |
| 827 | } |
| 828 | |
| 829 | // getVal - This function is identical to getExistingVal, except that if a |
| 830 | // value is not already defined, it "improvises" by creating a placeholder var |
| 831 | // that looks and acts just like the requested variable. When the value is |
| 832 | // defined later, all uses of the placeholder variable are replaced with the |
| 833 | // real thing. |
| 834 | // |
| 835 | static Value *getVal(const Type *Ty, const ValID &ID) { |
| 836 | if (Ty == Type::LabelTy) { |
| 837 | GenerateError("Cannot use a basic block here"); |
| 838 | return 0; |
| 839 | } |
| 840 | |
| 841 | // See if the value has already been defined. |
| 842 | Value *V = getExistingVal(Ty, ID); |
| 843 | if (V) return V; |
| 844 | if (TriggerError) return 0; |
| 845 | |
| 846 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
| 847 | GenerateError("Invalid use of a composite type"); |
| 848 | return 0; |
| 849 | } |
| 850 | |
| 851 | // If we reached here, we referenced either a symbol that we don't know about |
| 852 | // or an id number that hasn't been read yet. We may be referencing something |
| 853 | // forward, so just create an entry to be resolved later and get to it... |
| 854 | // |
| 855 | switch (ID.Type) { |
| 856 | case ValID::GlobalName: |
| 857 | case ValID::GlobalID: { |
| 858 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 859 | if (!PTy) { |
| 860 | GenerateError("Invalid type for reference to global" ); |
| 861 | return 0; |
| 862 | } |
| 863 | const Type* ElTy = PTy->getElementType(); |
| 864 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
| 865 | V = new Function(FTy, GlobalValue::ExternalLinkage); |
| 866 | else |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 867 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", |
| 868 | (Module*)0, false, PTy->getAddressSpace()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 869 | break; |
| 870 | } |
| 871 | default: |
| 872 | V = new Argument(Ty); |
| 873 | } |
| 874 | |
| 875 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 876 | // to recycle these things?? |
| 877 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 878 | LLLgetLineNo()))); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 879 | |
| 880 | if (inFunctionScope()) |
| 881 | InsertValue(V, CurFun.LateResolveValues); |
| 882 | else |
| 883 | InsertValue(V, CurModule.LateResolveValues); |
| 884 | return V; |
| 885 | } |
| 886 | |
| 887 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 888 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
| 889 | static BasicBlock *defineBBVal(const ValID &ID) { |
| 890 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 891 | |
| 892 | BasicBlock *BB = 0; |
| 893 | |
| 894 | // First, see if this was forward referenced |
| 895 | |
| 896 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 897 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 898 | BB = BBI->second; |
| 899 | // The forward declaration could have been inserted anywhere in the |
| 900 | // function: insert it into the correct place now. |
| 901 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 902 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 903 | |
| 904 | // We're about to erase the entry, save the key so we can clean it up. |
| 905 | ValID Tmp = BBI->first; |
| 906 | |
| 907 | // Erase the forward ref from the map as its no longer "forward" |
| 908 | CurFun.BBForwardRefs.erase(ID); |
| 909 | |
| 910 | // The key has been removed from the map but so we don't want to leave |
| 911 | // strdup'd memory around so destroy it too. |
| 912 | Tmp.destroy(); |
| 913 | |
| 914 | // If its a numbered definition, bump the number and set the BB value. |
| 915 | if (ID.Type == ValID::LocalID) { |
| 916 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 917 | InsertValue(BB); |
| 918 | } |
| 919 | |
| 920 | ID.destroy(); |
| 921 | return BB; |
| 922 | } |
| 923 | |
| 924 | // We haven't seen this BB before and its first mention is a definition. |
| 925 | // Just create it and return it. |
| 926 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
| 927 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 928 | if (ID.Type == ValID::LocalID) { |
| 929 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 930 | InsertValue(BB); |
| 931 | } |
| 932 | |
| 933 | ID.destroy(); // Free strdup'd memory |
| 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(); |
| 981 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 1341 | #line 953 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1387 | } |
Devang Patel | eb29334 | 2008-02-20 19:13:10 +0000 | [diff] [blame] | 1388 | /* Line 193 of yacc.c. */ |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 1389 | #line 1390 "llvmAsmParser.tab.c" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1401 | /* Line 216 of yacc.c. */ |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 1402 | #line 1403 "llvmAsmParser.tab.c" |
Reid Spencer | aa8ae28 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1403 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1404 | #ifdef short |
| 1405 | # undef short |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1406 | #endif |
| 1407 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1411 | typedef unsigned char yytype_uint8; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1412 | #endif |
| 1413 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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_ |
Devang Patel | eb29334 | 2008-02-20 19:13:10 +0000 | [diff] [blame] | 1452 | # if defined YYENABLE_NLS && YYENABLE_NLS |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 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. */ |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1617 | #define YYLAST 1978 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1618 | |
| 1619 | /* YYNTOKENS -- Number of terminals. */ |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1620 | #define YYNTOKENS 165 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1621 | /* YYNNTS -- Number of nonterminals. */ |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1622 | #define YYNNTS 85 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1623 | /* YYNRULES -- Number of rules. */ |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1624 | #define YYNRULES 322 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1625 | /* YYNRULES -- Number of states. */ |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1626 | #define YYNSTATES 629 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1627 | |
| 1628 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1629 | #define YYUNDEFTOK 2 |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1630 | #define YYMAXUTOK 405 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1642 | 151, 152, 155, 2, 154, 2, 2, 2, 2, 2, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1643 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1644 | 160, 153, 161, 2, 2, 2, 2, 2, 2, 2, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1647 | 2, 157, 156, 159, 2, 2, 2, 2, 2, 164, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1650 | 158, 2, 2, 162, 2, 163, 2, 2, 2, 2, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1678 | 145, 146, 147, 148, 149, 150 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 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, |
| 1705 | 456, 462, 471, 478, 485, 493, 501, 508, 517, 526, |
| 1706 | 530, 532, 534, 536, 538, 539, 542, 549, 551, 552, |
| 1707 | 554, 557, 558, 562, 563, 567, 571, 575, 579, 580, |
| 1708 | 589, 590, 600, 601, 611, 617, 620, 624, 626, 630, |
| 1709 | 634, 638, 642, 644, 645, 651, 655, 657, 661, 663, |
| 1710 | 664, 675, 677, 679, 684, 686, 688, 691, 695, 696, |
| 1711 | 698, 700, 702, 704, 706, 708, 710, 712, 714, 718, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1712 | 720, 726, 728, 730, 732, 734, 736, 738, 741, 743, |
| 1713 | 747, 750, 753, 757, 760, 761, 763, 766, 769, 773, |
| 1714 | 783, 793, 802, 817, 819, 821, 828, 834, 837, 844, |
| 1715 | 852, 857, 862, 869, 876, 877, 878, 882, 885, 887, |
| 1716 | 893, 899, 906, 913, 918, 925, 930, 935, 942, 949, |
| 1717 | 952, 961, 963, 965, 966, 970, 977, 981, 988, 991, |
| 1718 | 997, 1005, 1011 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1719 | }; |
| 1720 | |
| 1721 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1722 | static const yytype_int16 yyrhs[] = |
| 1723 | { |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1724 | 211, 0, -1, 74, -1, 75, -1, 76, -1, 77, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
| 1727 | -1, 85, -1, 117, -1, 118, -1, 119, -1, 120, |
| 1728 | -1, 121, -1, 122, -1, 123, -1, 124, -1, 125, |
| 1729 | -1, 126, -1, 127, -1, 128, -1, 91, -1, 92, |
| 1730 | -1, 93, -1, 94, -1, 95, -1, 96, -1, 97, |
| 1731 | -1, 98, -1, 99, -1, 100, -1, 101, -1, 102, |
| 1732 | -1, 103, -1, 104, -1, 105, -1, 106, -1, 107, |
| 1733 | -1, 108, -1, 109, -1, 110, -1, 97, -1, 98, |
| 1734 | -1, 99, -1, 100, -1, 26, -1, 27, -1, 11, |
| 1735 | -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1736 | -1, 19, -1, 22, -1, 24, -1, 173, -1, -1, |
| 1737 | 54, 151, 4, 152, -1, -1, 173, 153, -1, -1, |
| 1738 | 20, -1, 23, -1, 179, -1, -1, 177, 153, -1, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1739 | 42, -1, 44, -1, 43, -1, 45, -1, 47, -1, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1740 | 46, -1, 48, -1, 50, -1, -1, 148, -1, 149, |
| 1741 | -1, 150, -1, -1, 46, -1, 48, -1, -1, 42, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1744 | -1, 66, -1, 61, 4, -1, 137, -1, 118, -1, |
| 1745 | 136, -1, 119, -1, 139, -1, 140, -1, 142, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 1746 | 143, -1, 144, -1, 53, 4, -1, -1, 188, 187, |
| 1747 | -1, 138, -1, 141, -1, 137, -1, 136, -1, 145, |
| 1748 | -1, 146, -1, -1, 190, 189, -1, -1, 147, 22, |
| 1749 | -1, -1, 53, 4, -1, -1, 154, 53, 4, -1, |
| 1750 | 34, 22, -1, -1, 194, -1, -1, 154, 197, 196, |
| 1751 | -1, 194, -1, 53, 4, -1, 11, -1, 12, -1, |
| 1752 | 13, -1, 16, -1, 15, -1, 14, -1, 17, -1, |
| 1753 | 49, -1, 198, -1, 199, 175, 155, -1, 233, -1, |
| 1754 | 156, 4, -1, 199, 151, 203, 152, 190, -1, 10, |
| 1755 | 151, 203, 152, 190, -1, 157, 4, 158, 199, 159, |
| 1756 | -1, 160, 4, 158, 199, 161, -1, 162, 204, 163, |
| 1757 | -1, 162, 163, -1, 160, 162, 204, 163, 161, -1, |
| 1758 | 160, 162, 163, 161, -1, 199, 188, -1, 199, -1, |
| 1759 | 10, -1, 200, -1, 202, 154, 200, -1, 202, -1, |
| 1760 | 202, 154, 39, -1, 39, -1, -1, 199, -1, 204, |
| 1761 | 154, 199, -1, 199, 157, 207, 159, -1, 199, 157, |
| 1762 | 159, -1, 199, 164, 22, -1, 199, 160, 207, 161, |
| 1763 | -1, 199, 162, 207, 163, -1, 199, 162, 163, -1, |
| 1764 | 199, 160, 162, 207, 163, 161, -1, 199, 160, 162, |
| 1765 | 163, 161, -1, 199, 40, -1, 199, 41, -1, 199, |
| 1766 | 233, -1, 199, 206, -1, 199, 25, -1, 171, 3, |
| 1767 | -1, 171, 5, -1, 171, 4, -1, 171, 6, -1, |
| 1768 | 11, 26, -1, 11, 27, -1, 172, 9, -1, 168, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1769 | 151, 205, 38, 199, 152, -1, 116, 151, 205, 245, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 1770 | 152, -1, 130, 151, 205, 154, 205, 154, 205, 152, |
| 1771 | -1, 166, 151, 205, 154, 205, 152, -1, 167, 151, |
| 1772 | 205, 154, 205, 152, -1, 89, 169, 151, 205, 154, |
| 1773 | 205, 152, -1, 90, 170, 151, 205, 154, 205, 152, |
| 1774 | -1, 132, 151, 205, 154, 205, 152, -1, 133, 151, |
| 1775 | 205, 154, 205, 154, 205, 152, -1, 134, 151, 205, |
| 1776 | 154, 205, 154, 205, 152, -1, 207, 154, 205, -1, |
| 1777 | 205, -1, 32, -1, 33, -1, 37, -1, -1, 201, |
| 1778 | 233, -1, 122, 151, 210, 38, 199, 152, -1, 212, |
| 1779 | -1, -1, 213, -1, 212, 213, -1, -1, 31, 214, |
| 1780 | 229, -1, -1, 30, 215, 230, -1, 59, 58, 219, |
| 1781 | -1, 176, 18, 199, -1, 176, 18, 10, -1, -1, |
| 1782 | 178, 182, 209, 208, 205, 175, 216, 196, -1, -1, |
| 1783 | 178, 180, 182, 209, 208, 205, 175, 217, 196, -1, |
| 1784 | -1, 178, 181, 182, 209, 208, 199, 175, 218, 196, |
| 1785 | -1, 178, 182, 35, 185, 210, -1, 51, 220, -1, |
| 1786 | 55, 153, 221, -1, 22, -1, 52, 153, 22, -1, |
| 1787 | 67, 153, 22, -1, 157, 222, 159, -1, 222, 154, |
| 1788 | 22, -1, 22, -1, -1, 223, 154, 199, 188, 174, |
| 1789 | -1, 199, 188, 174, -1, 223, -1, 223, 154, 39, |
| 1790 | -1, 39, -1, -1, 186, 201, 177, 151, 224, 152, |
| 1791 | 190, 195, 192, 191, -1, 28, -1, 162, -1, 184, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1792 | 182, 225, 226, -1, 29, -1, 163, -1, 237, 228, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 1793 | -1, 183, 182, 225, -1, -1, 60, -1, 3, -1, |
| 1794 | 4, -1, 9, -1, 26, -1, 27, -1, 40, -1, |
| 1795 | 41, -1, 25, -1, 160, 207, 161, -1, 206, -1, |
| 1796 | 58, 231, 22, 154, 22, -1, 7, -1, 8, -1, |
| 1797 | 173, -1, 177, -1, 233, -1, 232, -1, 199, 234, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1798 | -1, 235, -1, 236, 154, 205, -1, 237, 238, -1, |
| 1799 | 227, 238, -1, 239, 176, 240, -1, 239, 242, -1, |
| 1800 | -1, 21, -1, 68, 236, -1, 68, 10, -1, 69, |
| 1801 | 17, 234, -1, 69, 11, 234, 154, 17, 234, 154, |
| 1802 | 17, 234, -1, 70, 171, 234, 154, 17, 234, 157, |
| 1803 | 241, 159, -1, 70, 171, 234, 154, 17, 234, 157, |
| 1804 | 159, -1, 71, 186, 201, 234, 151, 244, 152, 190, |
| 1805 | 38, 17, 234, 72, 17, 234, -1, 72, -1, 73, |
| 1806 | -1, 241, 171, 232, 154, 17, 234, -1, 171, 232, |
| 1807 | 154, 17, 234, -1, 176, 247, -1, 199, 157, 234, |
| 1808 | 154, 234, 159, -1, 243, 154, 157, 234, 154, 234, |
| 1809 | 159, -1, 199, 188, 234, 188, -1, 17, 188, 234, |
| 1810 | 188, -1, 244, 154, 199, 188, 234, 188, -1, 244, |
| 1811 | 154, 17, 188, 234, 188, -1, -1, -1, 245, 154, |
| 1812 | 235, -1, 57, 56, -1, 56, -1, 166, 199, 234, |
| 1813 | 154, 234, -1, 167, 199, 234, 154, 234, -1, 89, |
| 1814 | 169, 199, 234, 154, 234, -1, 90, 170, 199, 234, |
| 1815 | 154, 234, -1, 168, 235, 38, 199, -1, 130, 235, |
| 1816 | 154, 235, 154, 235, -1, 131, 235, 154, 199, -1, |
| 1817 | 132, 235, 154, 235, -1, 133, 235, 154, 235, 154, |
| 1818 | 235, -1, 134, 235, 154, 235, 154, 235, -1, 129, |
| 1819 | 243, -1, 246, 186, 201, 234, 151, 244, 152, 190, |
| 1820 | -1, 249, -1, 36, -1, -1, 111, 199, 193, -1, |
| 1821 | 111, 199, 154, 11, 234, 193, -1, 112, 199, 193, |
| 1822 | -1, 112, 199, 154, 11, 234, 193, -1, 113, 235, |
| 1823 | -1, 248, 114, 199, 234, 193, -1, 248, 115, 235, |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 1824 | 154, 199, 234, 193, -1, 135, 199, 233, 154, 4, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1825 | -1, 116, 199, 234, 245, -1 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1826 | }; |
| 1827 | |
| 1828 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1829 | static const yytype_uint16 yyrline[] = |
| 1830 | { |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 1831 | 0, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, |
| 1832 | 1115, 1116, 1116, 1116, 1116, 1116, 1116, 1117, 1117, 1117, |
| 1833 | 1117, 1117, 1117, 1118, 1118, 1118, 1118, 1118, 1118, 1121, |
| 1834 | 1121, 1122, 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1129, |
| 1835 | 1129, 1130, 1130, 1131, 1131, 1132, 1132, 1133, 1133, 1134, |
| 1836 | 1134, 1135, 1135, 1136, 1137, 1142, 1143, 1143, 1143, 1143, |
| 1837 | 1143, 1145, 1145, 1145, 1146, 1146, 1148, 1149, 1153, 1157, |
| 1838 | 1162, 1162, 1164, 1165, 1170, 1176, 1177, 1178, 1179, 1180, |
| 1839 | 1184, 1185, 1186, 1190, 1191, 1192, 1193, 1197, 1198, 1199, |
| 1840 | 1203, 1204, 1205, 1206, 1207, 1211, 1212, 1213, 1216, 1217, |
| 1841 | 1218, 1219, 1220, 1221, 1222, 1229, 1230, 1231, 1232, 1233, |
| 1842 | 1234, 1235, 1236, 1237, 1238, 1242, 1243, 1248, 1249, 1250, |
| 1843 | 1251, 1252, 1253, 1256, 1257, 1262, 1263, 1270, 1271, 1277, |
| 1844 | 1278, 1287, 1295, 1296, 1301, 1302, 1303, 1308, 1321, 1321, |
| 1845 | 1321, 1321, 1321, 1321, 1321, 1324, 1328, 1332, 1339, 1344, |
| 1846 | 1352, 1382, 1407, 1412, 1422, 1432, 1436, 1446, 1453, 1462, |
| 1847 | 1469, 1474, 1479, 1486, 1487, 1494, 1501, 1509, 1515, 1527, |
| 1848 | 1555, 1571, 1598, 1626, 1652, 1672, 1698, 1718, 1730, 1737, |
| 1849 | 1803, 1813, 1823, 1829, 1839, 1845, 1855, 1860, 1865, 1878, |
| 1850 | 1890, 1912, 1920, 1926, 1937, 1942, 1947, 1953, 1959, 1968, |
| 1851 | 1972, 1980, 1980, 1983, 1983, 1986, 1998, 2019, 2024, 2032, |
| 1852 | 2033, 2037, 2037, 2041, 2041, 2044, 2047, 2071, 2083, 2082, |
| 1853 | 2094, 2093, 2103, 2102, 2113, 2153, 2156, 2162, 2172, 2176, |
| 1854 | 2181, 2183, 2188, 2193, 2202, 2212, 2223, 2227, 2236, 2245, |
| 1855 | 2250, 2384, 2384, 2386, 2395, 2395, 2397, 2402, 2414, 2418, |
| 1856 | 2423, 2427, 2431, 2435, 2439, 2443, 2447, 2451, 2455, 2480, |
| 1857 | 2484, 2494, 2498, 2502, 2507, 2514, 2514, 2520, 2529, 2534, |
| 1858 | 2539, 2543, 2552, 2561, 2570, 2574, 2582, 2608, 2612, 2617, |
| 1859 | 2627, 2646, 2655, 2746, 2750, 2757, 2768, 2781, 2791, 2802, |
| 1860 | 2812, 2823, 2831, 2841, 2848, 2851, 2852, 2859, 2863, 2868, |
| 1861 | 2884, 2901, 2915, 2929, 2941, 2949, 2956, 2962, 2968, 2974, |
| 1862 | 2989, 3087, 3092, 3096, 3103, 3110, 3118, 3125, 3133, 3141, |
| 1863 | 3155, 3172, 3179 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1864 | }; |
| 1865 | #endif |
| 1866 | |
| 1867 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1868 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1869 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1870 | static const char *const yytname[] = |
| 1871 | { |
| 1872 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1873 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1874 | "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE", |
| 1875 | "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT", |
| 1876 | "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK", |
| 1877 | "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", |
| 1878 | "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO", |
| 1879 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
| 1880 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1881 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", |
| 1882 | "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", |
| 1883 | "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", |
| 1884 | "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", |
| 1885 | "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", |
| 1886 | "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", |
| 1887 | "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", |
| 1888 | "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", |
| 1889 | "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", |
| 1890 | "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", |
| 1891 | "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1892 | "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT", |
| 1893 | "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", |
| 1894 | "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", |
| 1895 | "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", |
| 1896 | "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", |
| 1897 | "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType", |
| 1898 | "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign", |
| 1899 | "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1900 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1901 | "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr", |
| 1902 | "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", |
| 1903 | "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes", |
| 1904 | "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", |
| 1905 | "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", |
| 1906 | "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", |
| 1907 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1908 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1909 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1910 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1911 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal", |
| 1912 | "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", |
| 1913 | "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall", |
| 1914 | "InstVal", "OptVolatile", "MemoryInst", 0 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1915 | }; |
| 1916 | #endif |
| 1917 | |
| 1918 | # ifdef YYPRINT |
| 1919 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1920 | token YYLEX-NUM. */ |
| 1921 | static const yytype_uint16 yytoknum[] = |
| 1922 | { |
| 1923 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1924 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1925 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1926 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1927 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1928 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1929 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1930 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1931 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1932 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1933 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1934 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1935 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1936 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1937 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1938 | 405, 40, 41, 61, 44, 42, 92, 91, 120, 93, |
| 1939 | 60, 62, 123, 125, 99 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1940 | }; |
| 1941 | # endif |
| 1942 | |
| 1943 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1944 | static const yytype_uint8 yyr1[] = |
| 1945 | { |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1946 | 0, 165, 166, 166, 166, 166, 166, 166, 166, 166, |
| 1947 | 166, 167, 167, 167, 167, 167, 167, 168, 168, 168, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1948 | 168, 168, 168, 168, 168, 168, 168, 168, 168, 169, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1949 | 169, 169, 169, 169, 169, 169, 169, 169, 169, 170, |
| 1950 | 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, |
| 1951 | 170, 170, 170, 170, 170, 171, 172, 172, 172, 172, |
| 1952 | 172, 173, 173, 173, 174, 174, 175, 175, 176, 176, |
| 1953 | 177, 177, 178, 178, 179, 180, 180, 180, 180, 180, |
| 1954 | 181, 181, 181, 182, 182, 182, 182, 183, 183, 183, |
| 1955 | 184, 184, 184, 184, 184, 185, 185, 185, 186, 186, |
| 1956 | 186, 186, 186, 186, 186, 187, 187, 187, 187, 187, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 1957 | 187, 187, 187, 187, 187, 188, 188, 189, 189, 189, |
| 1958 | 189, 189, 189, 190, 190, 191, 191, 192, 192, 193, |
| 1959 | 193, 194, 195, 195, 196, 196, 197, 197, 198, 198, |
| 1960 | 198, 198, 198, 198, 198, 199, 199, 199, 199, 199, |
| 1961 | 199, 199, 199, 199, 199, 199, 199, 199, 200, 201, |
| 1962 | 201, 202, 202, 203, 203, 203, 203, 204, 204, 205, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1963 | 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 1964 | 205, 205, 205, 205, 205, 205, 205, 205, 205, 206, |
| 1965 | 206, 206, 206, 206, 206, 206, 206, 206, 206, 207, |
| 1966 | 207, 208, 208, 209, 209, 210, 210, 211, 211, 212, |
| 1967 | 212, 214, 213, 215, 213, 213, 213, 213, 216, 213, |
| 1968 | 217, 213, 218, 213, 213, 213, 213, 219, 220, 220, |
| 1969 | 221, 222, 222, 222, 223, 223, 224, 224, 224, 224, |
| 1970 | 225, 226, 226, 227, 228, 228, 229, 230, 231, 231, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 1971 | 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 1972 | 232, 233, 233, 233, 233, 234, 234, 235, 236, 236, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 1973 | 237, 237, 238, 239, 239, 239, 240, 240, 240, 240, |
| 1974 | 240, 240, 240, 240, 240, 241, 241, 242, 243, 243, |
| 1975 | 244, 244, 244, 244, 244, 245, 245, 246, 246, 247, |
| 1976 | 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, |
| 1977 | 247, 247, 248, 248, 249, 249, 249, 249, 249, 249, |
| 1978 | 249, 249, 249 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 1979 | }; |
| 1980 | |
| 1981 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1982 | static const yytype_uint8 yyr2[] = |
| 1983 | { |
| 1984 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1985 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1986 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1987 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1988 | 1, 1, 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, 0, 4, 0, 2, 0, |
| 1991 | 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, |
| 1992 | 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, |
| 1993 | 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, |
| 1994 | 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 1995 | 1, 1, 1, 1, 2, 0, 2, 1, 1, 1, |
| 1996 | 1, 1, 1, 0, 2, 0, 2, 0, 2, 0, |
| 1997 | 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, |
| 1998 | 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, |
| 1999 | 5, 5, 5, 5, 3, 2, 5, 4, 2, 1, |
| 2000 | 1, 1, 3, 1, 3, 1, 0, 1, 3, 4, |
| 2001 | 3, 3, 4, 4, 3, 6, 5, 2, 2, 2, |
| 2002 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, |
| 2003 | 5, 8, 6, 6, 7, 7, 6, 8, 8, 3, |
| 2004 | 1, 1, 1, 1, 0, 2, 6, 1, 0, 1, |
| 2005 | 2, 0, 3, 0, 3, 3, 3, 3, 0, 8, |
| 2006 | 0, 9, 0, 9, 5, 2, 3, 1, 3, 3, |
| 2007 | 3, 3, 1, 0, 5, 3, 1, 3, 1, 0, |
| 2008 | 10, 1, 1, 4, 1, 1, 2, 3, 0, 1, |
| 2009 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2010 | 5, 1, 1, 1, 1, 1, 1, 2, 1, 3, |
| 2011 | 2, 2, 3, 2, 0, 1, 2, 2, 3, 9, |
| 2012 | 9, 8, 14, 1, 1, 6, 5, 2, 6, 7, |
| 2013 | 4, 4, 6, 6, 0, 0, 3, 2, 1, 5, |
| 2014 | 5, 6, 6, 4, 6, 4, 4, 6, 6, 2, |
| 2015 | 8, 1, 1, 0, 3, 6, 3, 6, 2, 5, |
| 2016 | 7, 5, 4 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2017 | }; |
| 2018 | |
| 2019 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 2020 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 2021 | means the default is an error. */ |
| 2022 | static const yytype_uint16 yydefact[] = |
| 2023 | { |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2024 | 73, 61, 70, 62, 71, 63, 213, 211, 0, 0, |
| 2025 | 0, 0, 0, 0, 83, 72, 0, 73, 209, 87, |
| 2026 | 90, 0, 0, 225, 0, 0, 68, 0, 74, 75, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2027 | 77, 76, 78, 80, 79, 81, 82, 84, 85, 86, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2028 | 83, 83, 204, 1, 210, 88, 89, 83, 214, 91, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2029 | 92, 93, 94, 83, 274, 212, 274, 0, 0, 233, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2030 | 226, 227, 215, 261, 262, 217, 138, 139, 140, 143, |
| 2031 | 142, 141, 144, 145, 0, 0, 0, 0, 263, 264, |
| 2032 | 146, 216, 148, 204, 204, 95, 203, 0, 98, 98, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2033 | 275, 271, 69, 244, 245, 246, 270, 228, 229, 232, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2034 | 0, 166, 149, 0, 0, 0, 0, 155, 167, 0, |
| 2035 | 0, 166, 0, 0, 0, 97, 96, 0, 201, 202, |
| 2036 | 0, 0, 99, 100, 101, 102, 103, 0, 247, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2037 | 313, 273, 0, 230, 165, 115, 161, 163, 0, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2038 | 0, 0, 0, 0, 154, 0, 0, 147, 0, 0, |
| 2039 | 160, 0, 159, 0, 224, 138, 139, 140, 143, 142, |
| 2040 | 141, 0, 0, 67, 67, 104, 0, 241, 242, 243, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2041 | 312, 298, 0, 0, 0, 0, 98, 283, 284, 2, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2042 | 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, |
| 2043 | 16, 11, 12, 13, 0, 0, 0, 0, 0, 0, |
| 2044 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 2045 | 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2046 | 0, 0, 272, 98, 287, 0, 311, 231, 158, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2047 | 123, 67, 67, 157, 0, 168, 0, 123, 67, 67, |
| 2048 | 0, 205, 186, 187, 182, 184, 183, 185, 188, 181, |
| 2049 | 177, 178, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2050 | 0, 0, 0, 0, 0, 0, 180, 179, 218, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2051 | 297, 277, 67, 268, 276, 0, 0, 55, 0, 0, |
| 2052 | 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 2053 | 0, 53, 54, 49, 50, 51, 52, 39, 40, 41, |
| 2054 | 42, 43, 44, 45, 46, 47, 48, 0, 129, 129, |
| 2055 | 318, 67, 67, 309, 0, 0, 0, 0, 0, 67, |
| 2056 | 67, 67, 0, 0, 0, 0, 0, 106, 108, 107, |
| 2057 | 105, 109, 110, 111, 112, 113, 116, 164, 162, 151, |
| 2058 | 152, 153, 156, 66, 150, 220, 222, 0, 0, 0, |
| 2059 | 0, 0, 0, 0, 0, 170, 200, 0, 0, 0, |
| 2060 | 174, 0, 171, 0, 0, 0, 134, 239, 250, 251, |
| 2061 | 252, 257, 253, 254, 255, 256, 248, 0, 259, 266, |
| 2062 | 265, 267, 0, 0, 278, 0, 0, 67, 67, 0, |
| 2063 | 314, 0, 316, 295, 0, 0, 0, 0, 0, 0, |
| 2064 | 0, 0, 0, 0, 0, 0, 67, 0, 114, 120, |
| 2065 | 119, 117, 118, 121, 122, 124, 134, 134, 0, 0, |
| 2066 | 0, 295, 0, 0, 0, 0, 0, 169, 155, 167, |
| 2067 | 0, 172, 173, 0, 0, 0, 0, 219, 238, 115, |
| 2068 | 236, 0, 249, 0, 0, 269, 0, 0, 0, 0, |
| 2069 | 0, 0, 0, 0, 322, 0, 0, 0, 305, 306, |
| 2070 | 0, 0, 0, 0, 0, 303, 0, 129, 0, 221, |
| 2071 | 223, 67, 0, 0, 0, 0, 0, 0, 0, 199, |
| 2072 | 176, 0, 0, 0, 0, 0, 0, 136, 134, 65, |
| 2073 | 0, 123, 0, 258, 0, 0, 294, 0, 0, 129, |
| 2074 | 130, 129, 0, 0, 0, 0, 0, 0, 321, 299, |
| 2075 | 300, 294, 0, 319, 67, 206, 0, 0, 190, 0, |
| 2076 | 0, 0, 0, 175, 0, 0, 67, 131, 137, 135, |
| 2077 | 64, 235, 237, 115, 132, 0, 0, 0, 115, 115, |
| 2078 | 0, 301, 302, 315, 317, 296, 0, 0, 304, 307, |
| 2079 | 308, 0, 129, 0, 0, 0, 196, 0, 0, 192, |
| 2080 | 193, 189, 65, 133, 127, 260, 0, 0, 0, 0, |
| 2081 | 123, 0, 288, 0, 123, 320, 194, 195, 0, 0, |
| 2082 | 0, 234, 0, 125, 0, 281, 0, 0, 106, 108, |
| 2083 | 115, 115, 0, 115, 115, 289, 310, 191, 197, 198, |
| 2084 | 128, 0, 240, 279, 0, 280, 0, 291, 290, 0, |
| 2085 | 0, 0, 126, 0, 0, 0, 115, 115, 0, 0, |
| 2086 | 0, 293, 292, 286, 0, 0, 285, 0, 282 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2087 | }; |
| 2088 | |
| 2089 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 2090 | static const yytype_int16 yydefgoto[] = |
| 2091 | { |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2092 | -1, 263, 264, 265, 290, 307, 161, 162, 78, 531, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2093 | 112, 12, 79, 14, 15, 40, 41, 42, 47, 53, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2094 | 117, 127, 336, 228, 415, 339, 602, 583, 390, 487, |
| 2095 | 564, 437, 488, 80, 163, 136, 153, 137, 138, 109, |
| 2096 | 356, 378, 357, 120, 87, 154, 16, 17, 18, 20, |
| 2097 | 19, 366, 416, 417, 62, 23, 60, 100, 440, 441, |
| 2098 | 128, 169, 54, 95, 55, 48, 443, 379, 82, 381, |
| 2099 | 273, 274, 56, 91, 92, 222, 587, 131, 313, 540, |
| 2100 | 454, 223, 224, 225, 226 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2101 | }; |
| 2102 | |
| 2103 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2104 | STATE-NUM. */ |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 2105 | #define YYPACT_NINF -572 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2106 | static const yytype_int16 yypact[] = |
| 2107 | { |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 2108 | 284, -572, -572, -572, -572, -572, -572, -572, -13, -121, |
| 2109 | 12, -94, 78, -48, 19, -572, 127, 883, -572, 113, |
| 2110 | 162, -18, 13, -572, 23, 140, -572, 1464, -572, -572, |
| 2111 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2112 | 106, 106, 176, -572, -572, -572, -572, 106, -572, -572, |
| 2113 | -572, -572, -572, 106, 155, -572, -10, 199, 209, 212, |
| 2114 | -572, -572, -572, -572, -572, 90, -572, -572, -572, -572, |
| 2115 | -572, -572, -572, -572, 242, 246, 2, 126, -572, -572, |
| 2116 | -572, 1, -572, 228, 228, 205, -572, 9, 297, 297, |
| 2117 | -572, -572, 80, -572, -572, -572, -572, -572, -572, -572, |
| 2118 | -81, 1059, -572, 134, 138, 506, 90, -572, 1, -114, |
| 2119 | 149, 1059, 146, 9, 9, -572, -572, 1014, -572, -572, |
| 2120 | 1504, 301, -572, -572, -572, -572, -572, 1562, -572, -2, |
| 2121 | 1843, -572, 287, -572, -572, 1, -572, 159, 164, 1620, |
| 2122 | 1620, 156, -83, 1620, -572, 315, 168, -572, 1504, 1620, |
| 2123 | 90, 172, 1, 388, -572, 342, 316, 317, 322, 324, |
| 2124 | 328, 234, 329, 1115, 288, -572, 99, -572, -572, -572, |
| 2125 | -572, -572, 293, 1660, 83, 333, 297, -572, -572, -572, |
| 2126 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2127 | -572, -572, -572, -572, 511, 787, 1620, 1620, 1620, 1620, |
| 2128 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2129 | -572, -572, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, |
| 2130 | 1620, 1620, -572, 297, -572, 161, -572, -572, 434, 1345, |
| 2131 | -572, -31, -30, -572, 190, 1, 198, -572, 288, 3, |
| 2132 | 1014, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2133 | -572, -572, 511, 787, 201, 203, 204, 213, 214, 1385, |
| 2134 | 1678, 609, 334, 225, 230, 231, -572, -572, -572, 238, |
| 2135 | -572, 90, 702, -572, 239, 841, 841, -572, 841, 1562, |
| 2136 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2137 | 1620, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2138 | -572, -572, -572, -572, -572, -572, -572, 1620, 97, 123, |
| 2139 | -572, 702, -25, 244, 245, 249, 250, 251, 252, 14, |
| 2140 | 702, 702, 341, 1562, 1620, 1620, 405, -572, -572, -572, |
| 2141 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -93, |
| 2142 | -572, -572, -572, -572, -93, -572, 146, 375, 264, 265, |
| 2143 | 1504, 1504, 1504, 1504, 1504, -572, -572, -56, 788, -78, |
| 2144 | -572, -82, -572, 1504, 1504, 1504, 263, 1406, -572, -572, |
| 2145 | -572, -572, -572, -572, -572, -572, 360, 1504, -572, -572, |
| 2146 | -572, -572, 1504, 269, -572, 272, 841, 702, 702, 5, |
| 2147 | -572, 7, -572, -572, 841, 271, 1620, 1620, 1620, 1620, |
| 2148 | 1620, 275, 276, 277, 1620, 841, 702, 281, -572, -572, |
| 2149 | -572, -572, -572, -572, -572, -572, 263, 263, 1620, 1504, |
| 2150 | 1504, -572, 282, 283, 285, 289, 1504, -572, 280, 969, |
| 2151 | -68, -572, -572, 290, 291, 408, -3, -572, -572, 1, |
| 2152 | 294, 295, -572, 427, -64, -572, 433, 436, 303, 302, |
| 2153 | 305, 841, 451, 841, 306, 307, 841, 308, 1, -572, |
| 2154 | 313, 314, 453, 841, 841, 1, 318, 319, 1620, -572, |
| 2155 | -572, -45, 320, 321, 114, 1504, 1504, 1504, 1504, -572, |
| 2156 | -572, 311, 1504, 1504, 1620, 455, 474, -572, 263, 1746, |
| 2157 | 1446, -572, 330, -572, 841, 841, 1718, 841, 841, 319, |
| 2158 | -572, 319, 1620, 841, 332, 1620, 1620, 1620, -572, -572, |
| 2159 | -572, 1718, 429, -572, 702, -572, 1504, 1504, -572, 336, |
| 2160 | 331, 337, 340, -572, 343, 344, 64, -572, -572, -572, |
| 2161 | -572, -572, -572, 1, 81, 466, 346, 347, 28, 1, |
| 2162 | 115, -572, -572, -572, -572, -572, 339, 841, -572, -572, |
| 2163 | -572, 133, 319, 349, 351, 1504, -572, 1504, 1504, -572, |
| 2164 | -572, -572, 1746, -572, 452, -572, 489, -4, 560, 560, |
| 2165 | -572, 1736, -572, 348, -572, -572, -572, -572, 359, 363, |
| 2166 | 372, -572, 508, 380, 841, -572, 1255, -1, 381, 382, |
| 2167 | -572, -572, 87, 28, 1, -572, -93, -572, -572, -572, |
| 2168 | -572, 509, -572, -572, 383, -572, 1255, 434, 434, 519, |
| 2169 | 560, 560, -572, 521, 392, 841, -572, -572, 841, 530, |
| 2170 | 478, 434, 434, -572, 841, 537, -572, 841, -572 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2171 | }; |
| 2172 | |
| 2173 | /* YYPGOTO[NTERM-NUM]. */ |
| 2174 | static const yytype_int16 yypgoto[] = |
| 2175 | { |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 2176 | -572, 426, 428, 431, 323, 304, -173, -572, 0, 4, |
| 2177 | -150, 467, 8, -572, -572, -572, -572, 189, -572, -572, |
| 2178 | -572, -149, -572, -409, -572, -234, -572, -572, -289, 31, |
| 2179 | -572, -404, -572, -572, -26, 352, -122, -572, 461, 483, |
| 2180 | -92, -159, -214, 84, 196, 350, -572, -572, 572, -572, |
| 2181 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2182 | 502, -572, -572, -572, -572, -572, -572, -571, -76, 46, |
| 2183 | -105, -572, -572, 536, -572, -572, -572, -572, -572, 85, |
| 2184 | 173, -572, -572, -572, -572 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2185 | }; |
| 2186 | |
| 2187 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2188 | positive, shift that token. If negative, reduce the rule which |
| 2189 | number is the opposite. If zero, do what YYDEFACT says. |
| 2190 | If YYTABLE_NINF, syntax error. */ |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2191 | #define YYTABLE_NINF -209 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2192 | static const yytype_int16 yytable[] = |
| 2193 | { |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2194 | 11, 81, 278, 344, 266, 166, 104, 277, 13, 110, |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 2195 | 277, 90, 469, 470, 268, 604, 451, 11, 453, 93, |
| 2196 | 392, 63, 64, 110, 110, 13, 167, 279, 164, 110, |
| 2197 | 489, 485, 24, 1, 2, 614, 3, 4, 5, 21, |
| 2198 | 143, 118, 119, 409, 410, 411, 359, 361, 412, 144, |
| 2199 | 486, 108, 413, 414, 22, 110, 238, 110, 452, 26, |
| 2200 | 452, 29, 30, 31, 32, 33, 34, 35, 110, 36, |
| 2201 | 25, 143, 426, 132, 323, 135, 426, 241, 133, 108, |
| 2202 | 234, 432, -144, 431, 529, 135, 426, 267, 345, 346, |
| 2203 | 426, 152, 11, 310, 275, 481, 27, 493, 426, 1, |
| 2204 | 276, 152, 3, 427, 5, 28, 111, 515, 314, 315, |
| 2205 | 316, 317, 318, 231, 232, 485, 322, 235, 110, 2, |
| 2206 | 111, 111, 4, 239, 562, 609, 111, 43, 340, 568, |
| 2207 | 569, 341, 394, 63, 64, 57, 106, 66, 67, 68, |
| 2208 | 69, 70, 71, 72, 430, 1, 2, 272, 3, 4, |
| 2209 | 5, 110, 111, 94, 111, 585, -67, 386, 605, 45, |
| 2210 | 168, 46, 61, 444, 105, 111, 58, 37, 38, 39, |
| 2211 | 308, 309, 272, 311, 269, 73, 90, 110, 513, -144, |
| 2212 | 59, 607, 608, -144, 610, 611, 312, 272, 272, 272, |
| 2213 | 272, 272, 319, 320, 321, 272, 380, 148, 149, 380, |
| 2214 | 380, 405, 380, 135, 49, 50, 51, 621, 622, 52, |
| 2215 | 543, 85, 544, 86, 152, 111, 561, 409, 410, 411, |
| 2216 | 407, 97, 412, 409, 410, 411, 413, 414, 412, 83, |
| 2217 | 84, 98, 413, 414, 99, 380, 88, 244, 245, 246, |
| 2218 | 247, 101, 89, 401, 380, 380, 102, 115, 111, 116, |
| 2219 | 103, 389, -67, 152, 37, 38, 39, 534, 421, 422, |
| 2220 | 423, 424, 425, 575, 387, 86, 518, 570, 502, 571, |
| 2221 | 266, 433, 434, 435, 111, 324, 325, 391, -67, 113, |
| 2222 | 114, 388, 74, 75, -208, 574, 76, 571, 77, 107, |
| 2223 | 445, 457, 139, 459, 460, 461, 140, 152, 406, 272, |
| 2224 | 145, 147, -69, 1, 2, 165, 3, 4, 5, 227, |
| 2225 | 380, 380, 380, 229, 6, 7, 230, 233, 380, 236, |
| 2226 | 237, 383, 384, 240, 385, -56, -57, 472, 473, 380, |
| 2227 | 380, -60, 429, -59, 479, 8, 592, -58, 248, 9, |
| 2228 | 596, 439, 110, 10, 277, -55, -55, -55, -55, 270, |
| 2229 | 343, 342, 350, 267, 351, 352, 362, 393, 121, 122, |
| 2230 | 123, 124, 125, 126, 353, 354, 402, 403, 242, 243, |
| 2231 | 272, 458, 272, 272, 272, 380, 363, 380, 465, 404, |
| 2232 | 380, 364, 365, 519, 520, 521, 522, 380, 380, 367, |
| 2233 | 524, 525, 471, 382, 586, 63, 64, 545, 395, 396, |
| 2234 | 548, 549, 550, 397, 398, 399, 400, 1, 2, 408, |
| 2235 | 3, 4, 5, 418, 606, 419, 420, 436, 380, 380, |
| 2236 | 442, 380, 380, 446, 553, 554, 447, 380, 456, 462, |
| 2237 | 463, 464, 448, 449, 450, 468, 475, 476, 380, 477, |
| 2238 | 455, 480, 514, 478, 482, 483, 484, 491, 490, 492, |
| 2239 | 494, 466, 467, 495, 496, 500, 497, 508, 526, 498, |
| 2240 | 502, 503, 505, 578, 533, 579, 580, 506, 507, 511, |
| 2241 | 539, 380, 523, 512, 516, 517, 272, 527, 528, 272, |
| 2242 | 272, 272, 452, 556, 535, 539, 547, 326, 565, 530, |
| 2243 | 555, 557, 380, 380, 558, 559, 560, 499, 572, 501, |
| 2244 | 566, 576, 504, 577, 567, 582, 584, 595, 380, 509, |
| 2245 | 510, 597, 600, 63, 64, 598, 106, 66, 67, 68, |
| 2246 | 69, 70, 71, 72, 599, 1, 2, 601, 3, 4, |
| 2247 | 5, 612, -18, -19, 380, 380, 615, 613, 618, 380, |
| 2248 | 536, 537, 380, 541, 542, 594, 619, 624, 380, 546, |
| 2249 | 625, 380, 327, 328, 627, 73, 219, 349, 220, 130, |
| 2250 | 552, 221, 530, 368, 369, 563, 581, 63, 64, 370, |
| 2251 | 329, 330, 146, 331, 332, 348, 333, 334, 335, 1, |
| 2252 | 2, 338, 3, 4, 5, 371, 372, 373, 142, 44, |
| 2253 | 347, 129, 96, 573, 474, 0, 551, 0, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2254 | 374, 375, 280, 281, 282, 283, 284, 285, 286, 287, |
| 2255 | 288, 289, 0, 326, 590, 591, 63, 64, 376, 106, |
| 2256 | 155, 156, 157, 158, 159, 160, 72, 0, 1, 2, |
| 2257 | 603, 3, 4, 5, 179, 180, 181, 182, 183, 184, |
| 2258 | 185, 186, 187, 188, 189, 190, 191, 192, 193, 252, |
| 2259 | 253, 0, 0, 0, 0, 0, 616, 617, 73, 0, |
| 2260 | 0, 620, 74, 75, 623, 0, 76, 0, 77, 141, |
| 2261 | 626, 0, 0, 628, 0, 0, 254, 200, 588, 589, |
| 2262 | 203, 204, 205, 206, 207, 208, 209, 210, 211, 0, |
| 2263 | 255, 0, 256, 257, 258, 0, 329, 330, 0, 331, |
| 2264 | 332, 0, 333, 334, 335, 368, 369, 0, 0, 63, |
| 2265 | 64, 370, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2266 | 377, 1, 2, 0, 3, 4, 5, 371, 372, 373, |
| 2267 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2268 | 0, 0, 374, 375, 0, 0, 0, 0, 0, 0, |
| 2269 | 0, 0, 0, 0, 0, 0, 110, 0, 0, 0, |
| 2270 | 376, 0, 0, 0, 0, 74, 75, 0, 0, 76, |
| 2271 | 0, 77, 360, 0, 0, 0, 179, 180, 181, 182, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2272 | 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2273 | 193, 252, 253, 0, 0, 63, 64, 0, 106, 155, |
| 2274 | 156, 157, 158, 159, 160, 72, 0, 1, 2, 0, |
| 2275 | 3, 4, 5, 291, 292, 0, 0, 0, 254, 200, |
| 2276 | 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, |
| 2277 | 211, 0, 255, 0, 256, 257, 258, 73, 0, 0, |
| 2278 | 0, 0, 0, 0, 368, 369, 0, 0, 63, 64, |
| 2279 | 370, 0, 0, 111, 0, 0, 0, 0, 0, 0, |
| 2280 | 1, 2, 377, 3, 4, 5, 371, 372, 373, 0, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2281 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2282 | 0, 374, 375, -207, 293, 294, 295, 296, 297, 298, |
| 2283 | 299, 300, 301, 302, 303, 304, 305, 306, 0, 376, |
| 2284 | 0, -69, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2285 | 0, 0, 0, 6, 7, 179, 180, 181, 182, 183, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2286 | 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2287 | 252, 253, 0, 0, 8, 0, 0, 0, 9, 0, |
| 2288 | 0, 0, 10, 0, 74, 75, 0, 0, 76, 0, |
| 2289 | 77, 428, 0, 0, 0, 0, 0, 254, 200, 201, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2290 | 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2291 | 0, 255, 0, 256, 257, 258, 63, 64, 0, 0, |
| 2292 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, |
| 2293 | 0, 3, 4, 5, 249, 0, 0, 0, 0, 0, |
| 2294 | 0, 377, 0, 0, 0, 0, 0, 0, 0, 250, |
| 2295 | 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2296 | 0, 63, 64, 110, 150, 66, 67, 68, 69, 70, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2297 | 71, 72, 0, 1, 2, 0, 3, 4, 5, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2298 | 0, 0, 0, 179, 180, 181, 182, 183, 184, 185, |
| 2299 | 186, 187, 188, 189, 190, 191, 192, 193, 252, 253, |
| 2300 | 0, 0, 0, 73, 0, 0, 63, 64, 0, 106, |
| 2301 | 66, 67, 68, 69, 70, 71, 72, 0, 1, 2, |
| 2302 | 0, 3, 4, 5, 0, 254, 200, 201, 202, 203, |
| 2303 | 204, 205, 206, 207, 208, 209, 210, 211, 134, 255, |
| 2304 | 0, 256, 257, 258, 0, 0, 0, 0, 73, 0, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2305 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2306 | 111, 0, 63, 64, -67, 0, 259, 0, 0, 260, |
| 2307 | 0, 261, 0, 262, 1, 2, 151, 3, 4, 5, |
| 2308 | 249, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2309 | 0, 0, 0, 0, 0, 250, 251, 0, 0, 0, |
| 2310 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, |
| 2311 | 74, 75, 0, 0, 76, 0, 77, 0, 0, 0, |
| 2312 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, |
| 2313 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
| 2314 | 190, 191, 192, 193, 252, 253, 0, 0, 0, 0, |
| 2315 | 0, 0, 0, 0, 0, 74, 75, 0, 0, 76, |
| 2316 | 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2317 | 0, 254, 200, 201, 202, 203, 204, 205, 206, 207, |
| 2318 | 208, 209, 210, 211, 0, 255, 0, 256, 257, 258, |
| 2319 | 0, 0, 0, 0, 0, 0, 0, 0, 368, 369, |
| 2320 | 0, 0, 0, 0, 370, 0, 111, 0, 0, 0, |
| 2321 | 0, 0, 259, 0, 0, 260, 0, 261, 0, 262, |
| 2322 | 371, 372, 373, 0, 0, 0, 0, 0, 0, 0, |
| 2323 | 0, 0, 0, 0, 0, 374, 375, 0, 0, 0, |
| 2324 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2325 | 0, 0, 0, 376, 0, 0, 0, 0, 0, 0, |
| 2326 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, |
| 2327 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
| 2328 | 190, 191, 192, 193, 252, 253, 0, 0, 0, 0, |
| 2329 | 0, 0, 63, 64, 0, 106, 66, 67, 68, 69, |
| 2330 | 70, 71, 72, 0, 1, 2, 0, 3, 4, 5, |
| 2331 | 0, 254, 200, 201, 202, 203, 204, 205, 206, 207, |
| 2332 | 208, 209, 210, 211, 337, 255, 0, 256, 257, 258, |
| 2333 | 0, 0, 63, 64, 73, 106, 155, 156, 157, 158, |
| 2334 | 159, 160, 72, 0, 1, 2, 0, 3, 4, 5, |
| 2335 | 0, 0, 0, 63, 64, 377, 106, 66, 67, 68, |
| 2336 | 69, 70, 71, 72, 0, 1, 2, 0, 3, 4, |
| 2337 | 5, 0, 0, 0, 73, 0, 0, 0, 0, 0, |
| 2338 | 0, 0, 0, 0, 0, 438, 0, 0, 0, 0, |
| 2339 | 0, 0, 0, 63, 64, 73, 106, 66, 67, 68, |
| 2340 | 69, 70, 71, 72, 0, 1, 2, 0, 3, 4, |
| 2341 | 5, 63, 64, 0, 65, 66, 67, 68, 69, 70, |
| 2342 | 71, 72, 0, 1, 2, 532, 3, 4, 5, 0, |
| 2343 | 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, |
| 2344 | 0, 74, 75, 0, 0, 76, 0, 77, 0, 0, |
| 2345 | 0, 63, 64, 73, 106, 155, 156, 157, 158, 159, |
| 2346 | 160, 72, 0, 1, 2, 0, 3, 4, 5, 0, |
| 2347 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2348 | 0, 74, 75, 0, 355, 76, 0, 77, 0, 0, |
| 2349 | 0, 0, 0, 73, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2350 | 0, 0, 74, 75, 0, 0, 76, 0, 77, 63, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2351 | 64, 0, 150, 66, 67, 68, 69, 70, 71, 72, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2352 | 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, |
| 2353 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2354 | 0, 0, 74, 75, 0, 0, 76, 0, 77, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2355 | 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2356 | 74, 75, 0, 0, 76, 0, 77, 63, 64, 0, |
| 2357 | 106, 66, 67, 68, 69, 70, 71, 72, 0, 1, |
| 2358 | 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, |
| 2359 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2360 | 74, 75, 0, 0, 76, 0, 77, 63, 64, 73, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2361 | 271, 66, 67, 68, 69, 70, 71, 72, 0, 1, |
| 2362 | 2, 0, 3, 4, 5, 63, 64, 0, 106, 155, |
| 2363 | 156, 157, 158, 159, 160, 72, 0, 1, 2, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2364 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 73, |
| 2365 | 0, 0, 0, 0, 0, 0, 0, 0, 74, 75, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2366 | 0, 0, 76, 0, 77, 63, 64, 73, 106, 66, |
| 2367 | 67, 68, 69, 70, 71, 538, 0, 1, 2, 0, |
| 2368 | 3, 4, 5, 63, 64, 0, 106, 66, 67, 68, |
| 2369 | 69, 70, 71, 593, 0, 1, 2, 0, 3, 4, |
| 2370 | 5, 0, 0, 0, 0, 1, 0, 73, 3, 0, |
| 2371 | 5, 0, 0, 0, 0, 0, 74, 75, 0, 0, |
| 2372 | 76, 0, 77, 0, 0, 73, 0, 0, 0, 0, |
| 2373 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 326, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2374 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2375 | 0, 0, 0, 0, 0, 0, 74, 75, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2376 | 76, 0, 77, 0, 0, 0, 0, 0, 0, 0, |
| 2377 | 0, 0, 0, 0, 74, 75, 0, 0, 76, 0, |
| 2378 | 358, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2379 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2380 | 0, 0, 0, 0, 327, 328, 0, 0, 0, 0, |
| 2381 | 0, 0, 0, 0, 74, 75, 0, 0, 76, 170, |
| 2382 | 77, 0, 329, 330, 0, 331, 332, 0, 333, 334, |
| 2383 | 335, 0, 74, 75, 0, 0, 76, 0, 77, 171, |
| 2384 | 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2385 | 0, 173, 174, 175, 176, 177, 178, 179, 180, 181, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2386 | 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, |
| 2387 | 192, 193, 194, 195, 0, 0, 0, 0, 0, 0, |
| 2388 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2389 | 0, 0, 0, 0, 196, 197, 198, 0, 0, 199, |
| 2390 | 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, |
| 2391 | 210, 211, 212, 213, 214, 215, 216, 217, 218 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2392 | }; |
| 2393 | |
| 2394 | static const yytype_int16 yycheck[] = |
| 2395 | { |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2396 | 0, 27, 175, 237, 163, 127, 4, 11, 0, 54, |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 2397 | 11, 21, 416, 417, 164, 586, 11, 17, 11, 29, |
| 2398 | 309, 7, 8, 54, 54, 17, 28, 176, 120, 54, |
| 2399 | 439, 34, 153, 19, 20, 606, 22, 23, 24, 52, |
| 2400 | 154, 32, 33, 136, 137, 138, 260, 261, 141, 163, |
| 2401 | 53, 77, 145, 146, 67, 54, 148, 54, 53, 153, |
| 2402 | 53, 42, 43, 44, 45, 46, 47, 48, 54, 50, |
| 2403 | 58, 154, 154, 154, 223, 101, 154, 153, 159, 105, |
| 2404 | 163, 163, 54, 161, 488, 111, 154, 163, 238, 239, |
| 2405 | 154, 117, 92, 198, 11, 163, 18, 161, 154, 19, |
| 2406 | 17, 127, 22, 159, 24, 153, 151, 152, 213, 214, |
| 2407 | 215, 216, 217, 139, 140, 34, 221, 143, 54, 20, |
| 2408 | 151, 151, 23, 149, 533, 38, 151, 0, 159, 538, |
| 2409 | 539, 161, 157, 7, 8, 153, 10, 11, 12, 13, |
| 2410 | 14, 15, 16, 17, 358, 19, 20, 173, 22, 23, |
| 2411 | 24, 54, 151, 163, 151, 159, 155, 279, 159, 46, |
| 2412 | 162, 48, 22, 377, 162, 151, 153, 148, 149, 150, |
| 2413 | 196, 197, 198, 199, 166, 49, 21, 54, 467, 151, |
| 2414 | 157, 590, 591, 155, 593, 594, 212, 213, 214, 215, |
| 2415 | 216, 217, 218, 219, 220, 221, 272, 113, 114, 275, |
| 2416 | 276, 323, 278, 229, 42, 43, 44, 616, 617, 47, |
| 2417 | 499, 35, 501, 37, 240, 151, 152, 136, 137, 138, |
| 2418 | 325, 22, 141, 136, 137, 138, 145, 146, 141, 40, |
| 2419 | 41, 22, 145, 146, 22, 311, 47, 3, 4, 5, |
| 2420 | 6, 151, 53, 319, 320, 321, 4, 42, 151, 44, |
| 2421 | 4, 154, 155, 279, 148, 149, 150, 491, 350, 351, |
| 2422 | 352, 353, 354, 552, 290, 37, 152, 152, 154, 154, |
| 2423 | 429, 363, 364, 365, 151, 114, 115, 154, 155, 83, |
| 2424 | 84, 307, 156, 157, 0, 152, 160, 154, 162, 163, |
| 2425 | 382, 396, 158, 398, 399, 400, 158, 323, 324, 325, |
| 2426 | 151, 155, 18, 19, 20, 4, 22, 23, 24, 22, |
| 2427 | 386, 387, 388, 154, 30, 31, 152, 161, 394, 4, |
| 2428 | 152, 275, 276, 151, 278, 9, 9, 419, 420, 405, |
| 2429 | 406, 9, 358, 9, 426, 51, 570, 9, 9, 55, |
| 2430 | 574, 367, 54, 59, 11, 3, 4, 5, 6, 56, |
| 2431 | 152, 161, 151, 429, 151, 151, 22, 311, 61, 62, |
| 2432 | 63, 64, 65, 66, 151, 151, 320, 321, 26, 27, |
| 2433 | 396, 397, 398, 399, 400, 451, 151, 453, 404, 38, |
| 2434 | 456, 151, 151, 475, 476, 477, 478, 463, 464, 151, |
| 2435 | 482, 483, 418, 154, 567, 7, 8, 502, 154, 154, |
| 2436 | 505, 506, 507, 154, 154, 154, 154, 19, 20, 4, |
| 2437 | 22, 23, 24, 38, 587, 151, 151, 154, 494, 495, |
| 2438 | 60, 497, 498, 154, 516, 517, 154, 503, 157, 154, |
| 2439 | 154, 154, 386, 387, 388, 154, 154, 154, 514, 154, |
| 2440 | 394, 161, 468, 154, 154, 154, 38, 152, 154, 22, |
| 2441 | 17, 405, 406, 17, 151, 4, 154, 4, 484, 154, |
| 2442 | 154, 154, 154, 555, 490, 557, 558, 154, 154, 151, |
| 2443 | 496, 547, 161, 154, 154, 154, 502, 22, 4, 505, |
| 2444 | 506, 507, 53, 152, 154, 511, 154, 53, 22, 489, |
| 2445 | 154, 154, 568, 569, 154, 152, 152, 451, 159, 453, |
| 2446 | 154, 152, 456, 152, 157, 53, 17, 159, 584, 463, |
| 2447 | 464, 152, 4, 7, 8, 152, 10, 11, 12, 13, |
| 2448 | 14, 15, 16, 17, 152, 19, 20, 147, 22, 23, |
| 2449 | 24, 22, 151, 151, 610, 611, 17, 154, 17, 615, |
| 2450 | 494, 495, 618, 497, 498, 571, 154, 17, 624, 503, |
| 2451 | 72, 627, 118, 119, 17, 49, 130, 253, 130, 92, |
| 2452 | 514, 130, 562, 3, 4, 534, 562, 7, 8, 9, |
| 2453 | 136, 137, 111, 139, 140, 252, 142, 143, 144, 19, |
| 2454 | 20, 229, 22, 23, 24, 25, 26, 27, 105, 17, |
| 2455 | 240, 89, 56, 547, 421, -1, 511, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2456 | 40, 41, 91, 92, 93, 94, 95, 96, 97, 98, |
| 2457 | 99, 100, -1, 53, 568, 569, 7, 8, 58, 10, |
| 2458 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
| 2459 | 584, 22, 23, 24, 74, 75, 76, 77, 78, 79, |
| 2460 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2461 | 90, -1, -1, -1, -1, -1, 610, 611, 49, -1, |
| 2462 | -1, 615, 156, 157, 618, -1, 160, -1, 162, 163, |
| 2463 | 624, -1, -1, 627, -1, -1, 116, 117, 118, 119, |
| 2464 | 120, 121, 122, 123, 124, 125, 126, 127, 128, -1, |
| 2465 | 130, -1, 132, 133, 134, -1, 136, 137, -1, 139, |
| 2466 | 140, -1, 142, 143, 144, 3, 4, -1, -1, 7, |
| 2467 | 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2468 | 160, 19, 20, -1, 22, 23, 24, 25, 26, 27, |
| 2469 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2470 | -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, |
| 2471 | -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, |
| 2472 | 58, -1, -1, -1, -1, 156, 157, -1, -1, 160, |
| 2473 | -1, 162, 163, -1, -1, -1, 74, 75, 76, 77, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2474 | 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2475 | 88, 89, 90, -1, -1, 7, 8, -1, 10, 11, |
| 2476 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2477 | 22, 23, 24, 26, 27, -1, -1, -1, 116, 117, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2478 | 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2479 | 128, -1, 130, -1, 132, 133, 134, 49, -1, -1, |
| 2480 | -1, -1, -1, -1, 3, 4, -1, -1, 7, 8, |
| 2481 | 9, -1, -1, 151, -1, -1, -1, -1, -1, -1, |
| 2482 | 19, 20, 160, 22, 23, 24, 25, 26, 27, -1, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2483 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2484 | -1, 40, 41, 0, 97, 98, 99, 100, 101, 102, |
| 2485 | 103, 104, 105, 106, 107, 108, 109, 110, -1, 58, |
| 2486 | -1, 18, 19, 20, -1, 22, 23, 24, -1, -1, |
| 2487 | -1, -1, -1, 30, 31, 74, 75, 76, 77, 78, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2488 | 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2489 | 89, 90, -1, -1, 51, -1, -1, -1, 55, -1, |
| 2490 | -1, -1, 59, -1, 156, 157, -1, -1, 160, -1, |
| 2491 | 162, 163, -1, -1, -1, -1, -1, 116, 117, 118, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2492 | 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2493 | -1, 130, -1, 132, 133, 134, 7, 8, -1, -1, |
| 2494 | -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, |
| 2495 | -1, 22, 23, 24, 25, -1, -1, -1, -1, -1, |
| 2496 | -1, 160, -1, -1, -1, -1, -1, -1, -1, 40, |
| 2497 | 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2498 | -1, 7, 8, 54, 10, 11, 12, 13, 14, 15, |
| 2499 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
| 2500 | -1, -1, -1, 74, 75, 76, 77, 78, 79, 80, |
| 2501 | 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
| 2502 | -1, -1, -1, 49, -1, -1, 7, 8, -1, 10, |
| 2503 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
| 2504 | -1, 22, 23, 24, -1, 116, 117, 118, 119, 120, |
| 2505 | 121, 122, 123, 124, 125, 126, 127, 128, 39, 130, |
| 2506 | -1, 132, 133, 134, -1, -1, -1, -1, 49, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2507 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2508 | 151, -1, 7, 8, 155, -1, 157, -1, -1, 160, |
| 2509 | -1, 162, -1, 164, 19, 20, 122, 22, 23, 24, |
| 2510 | 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2511 | -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, |
| 2512 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, |
| 2513 | 156, 157, -1, -1, 160, -1, 162, -1, -1, -1, |
| 2514 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, |
| 2515 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 2516 | 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, |
| 2517 | -1, -1, -1, -1, -1, 156, 157, -1, -1, 160, |
| 2518 | -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2519 | -1, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 2520 | 125, 126, 127, 128, -1, 130, -1, 132, 133, 134, |
| 2521 | -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, |
| 2522 | -1, -1, -1, -1, 9, -1, 151, -1, -1, -1, |
| 2523 | -1, -1, 157, -1, -1, 160, -1, 162, -1, 164, |
| 2524 | 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, |
| 2525 | -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2526 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2527 | -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, |
| 2528 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, |
| 2529 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 2530 | 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, |
| 2531 | -1, -1, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2532 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2533 | -1, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 2534 | 125, 126, 127, 128, 39, 130, -1, 132, 133, 134, |
| 2535 | -1, -1, 7, 8, 49, 10, 11, 12, 13, 14, |
| 2536 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2537 | -1, -1, -1, 7, 8, 160, 10, 11, 12, 13, |
| 2538 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
| 2539 | 24, -1, -1, -1, 49, -1, -1, -1, -1, -1, |
| 2540 | -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2541 | -1, -1, -1, 7, 8, 49, 10, 11, 12, 13, |
| 2542 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2543 | 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2544 | 16, 17, -1, 19, 20, 39, 22, 23, 24, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2545 | -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2546 | -1, 156, 157, -1, -1, 160, -1, 162, -1, -1, |
| 2547 | -1, 7, 8, 49, 10, 11, 12, 13, 14, 15, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2548 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2549 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2550 | -1, 156, 157, -1, 159, 160, -1, 162, -1, -1, |
| 2551 | -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2552 | -1, -1, 156, 157, -1, -1, 160, -1, 162, 7, |
| 2553 | 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2554 | -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, |
| 2555 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2556 | -1, -1, 156, 157, -1, -1, 160, -1, 162, -1, |
| 2557 | -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2558 | 156, 157, -1, -1, 160, -1, 162, 7, 8, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2559 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2560 | 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2561 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2562 | 156, 157, -1, -1, 160, -1, 162, 7, 8, 49, |
| 2563 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2564 | 20, -1, 22, 23, 24, 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, 49, |
| 2567 | -1, -1, -1, -1, -1, -1, -1, -1, 156, 157, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2568 | -1, -1, 160, -1, 162, 7, 8, 49, 10, 11, |
| 2569 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2570 | 22, 23, 24, 7, 8, -1, 10, 11, 12, 13, |
| 2571 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
| 2572 | 24, -1, -1, -1, -1, 19, -1, 49, 22, -1, |
| 2573 | 24, -1, -1, -1, -1, -1, 156, 157, -1, -1, |
| 2574 | 160, -1, 162, -1, -1, 49, -1, -1, -1, -1, |
| 2575 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2576 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2577 | -1, -1, -1, -1, -1, -1, 156, 157, -1, -1, |
| 2578 | 160, -1, 162, -1, -1, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2579 | -1, -1, -1, -1, 156, 157, -1, -1, 160, -1, |
| 2580 | 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2581 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2582 | -1, -1, -1, -1, 118, 119, -1, -1, -1, -1, |
| 2583 | -1, -1, -1, -1, 156, 157, -1, -1, 160, 36, |
| 2584 | 162, -1, 136, 137, -1, 139, 140, -1, 142, 143, |
| 2585 | 144, -1, 156, 157, -1, -1, 160, -1, 162, 56, |
| 2586 | 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2587 | -1, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 2588 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2589 | 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, |
| 2590 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2591 | -1, -1, -1, -1, 111, 112, 113, -1, -1, 116, |
| 2592 | 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 2593 | 127, 128, 129, 130, 131, 132, 133, 134, 135 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2594 | }; |
| 2595 | |
| 2596 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2597 | symbol of state STATE-NUM. */ |
| 2598 | static const yytype_uint8 yystos[] = |
| 2599 | { |
| 2600 | 0, 19, 20, 22, 23, 24, 30, 31, 51, 55, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2601 | 59, 173, 176, 177, 178, 179, 211, 212, 213, 215, |
| 2602 | 214, 52, 67, 220, 153, 58, 153, 18, 153, 42, |
| 2603 | 43, 44, 45, 46, 47, 48, 50, 148, 149, 150, |
| 2604 | 180, 181, 182, 0, 213, 46, 48, 183, 230, 42, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2605 | 43, 44, 47, 184, 227, 229, 237, 153, 153, 157, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2606 | 221, 22, 219, 7, 8, 10, 11, 12, 13, 14, |
| 2607 | 15, 16, 17, 49, 156, 157, 160, 162, 173, 177, |
| 2608 | 198, 199, 233, 182, 182, 35, 37, 209, 182, 182, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2609 | 21, 238, 239, 29, 163, 228, 238, 22, 22, 22, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2610 | 222, 151, 4, 4, 4, 162, 10, 163, 199, 204, |
| 2611 | 54, 151, 175, 209, 209, 42, 44, 185, 32, 33, |
| 2612 | 208, 61, 62, 63, 64, 65, 66, 186, 225, 225, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2613 | 176, 242, 154, 159, 39, 199, 200, 202, 203, 158, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2614 | 158, 163, 204, 154, 163, 151, 203, 155, 208, 208, |
| 2615 | 10, 122, 199, 201, 210, 11, 12, 13, 14, 15, |
| 2616 | 16, 171, 172, 199, 205, 4, 201, 28, 162, 226, |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2617 | 36, 56, 57, 68, 69, 70, 71, 72, 73, 74, |
| 2618 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 2619 | 85, 86, 87, 88, 89, 90, 111, 112, 113, 116, |
| 2620 | 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2621 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 166, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2622 | 167, 168, 240, 246, 247, 248, 249, 22, 188, 154, |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 2623 | 152, 199, 199, 161, 163, 199, 4, 152, 205, 199, |
| 2624 | 151, 233, 26, 27, 3, 4, 5, 6, 9, 25, |
| 2625 | 40, 41, 89, 90, 116, 130, 132, 133, 134, 157, |
| 2626 | 160, 162, 164, 166, 167, 168, 206, 233, 175, 177, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2627 | 56, 10, 199, 235, 236, 11, 17, 11, 171, 186, |
| 2628 | 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, |
| 2629 | 169, 26, 27, 97, 98, 99, 100, 101, 102, 103, |
| 2630 | 104, 105, 106, 107, 108, 109, 110, 170, 199, 199, |
| 2631 | 235, 199, 199, 243, 235, 235, 235, 235, 235, 199, |
| 2632 | 199, 199, 235, 186, 114, 115, 53, 118, 119, 136, |
| 2633 | 137, 139, 140, 142, 143, 144, 187, 39, 200, 190, |
| 2634 | 159, 161, 161, 152, 190, 175, 175, 210, 169, 170, |
| 2635 | 151, 151, 151, 151, 151, 159, 205, 207, 162, 207, |
| 2636 | 163, 207, 22, 151, 151, 151, 216, 151, 3, 4, |
| 2637 | 9, 25, 26, 27, 40, 41, 58, 160, 206, 232, |
| 2638 | 233, 234, 154, 234, 234, 234, 201, 199, 199, 154, |
| 2639 | 193, 154, 193, 234, 157, 154, 154, 154, 154, 154, |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 2640 | 154, 233, 234, 234, 38, 201, 199, 235, 4, 136, |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 2641 | 137, 138, 141, 145, 146, 189, 217, 218, 38, 151, |
| 2642 | 151, 205, 205, 205, 205, 205, 154, 159, 163, 199, |
| 2643 | 207, 161, 163, 205, 205, 205, 154, 196, 39, 199, |
| 2644 | 223, 224, 60, 231, 207, 205, 154, 154, 234, 234, |
| 2645 | 234, 11, 53, 11, 245, 234, 157, 235, 199, 235, |
| 2646 | 235, 235, 154, 154, 154, 199, 234, 234, 154, 196, |
| 2647 | 196, 199, 205, 205, 245, 154, 154, 154, 154, 205, |
| 2648 | 161, 163, 154, 154, 38, 34, 53, 194, 197, 188, |
| 2649 | 154, 152, 22, 161, 17, 17, 151, 154, 154, 234, |
| 2650 | 4, 234, 154, 154, 234, 154, 154, 154, 4, 234, |
| 2651 | 234, 151, 154, 193, 199, 152, 154, 154, 152, 205, |
| 2652 | 205, 205, 205, 161, 205, 205, 199, 22, 4, 196, |
| 2653 | 173, 174, 39, 199, 190, 154, 234, 234, 17, 199, |
| 2654 | 244, 234, 234, 193, 193, 235, 234, 154, 235, 235, |
| 2655 | 235, 244, 234, 205, 205, 154, 152, 154, 154, 152, |
| 2656 | 152, 152, 188, 194, 195, 22, 154, 157, 188, 188, |
| 2657 | 152, 154, 159, 234, 152, 193, 152, 152, 205, 205, |
| 2658 | 205, 174, 53, 192, 17, 159, 171, 241, 118, 119, |
| 2659 | 234, 234, 190, 17, 199, 159, 190, 152, 152, 152, |
| 2660 | 4, 147, 191, 234, 232, 159, 171, 188, 188, 38, |
| 2661 | 188, 188, 22, 154, 232, 17, 234, 234, 17, 154, |
| 2662 | 234, 188, 188, 234, 17, 72, 234, 17, 234 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2663 | }; |
David Greene | 9145dd2 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2664 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2665 | #define yyerrok (yyerrstatus = 0) |
| 2666 | #define yyclearin (yychar = YYEMPTY) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2667 | #define YYEMPTY (-2) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2668 | #define YYEOF 0 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2669 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2670 | #define YYACCEPT goto yyacceptlab |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2671 | #define YYABORT goto yyabortlab |
| 2672 | #define YYERROR goto yyerrorlab |
| 2673 | |
| 2674 | |
| 2675 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2676 | to ease the transition to the new meaning of YYERROR, for GCC. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2677 | Once GCC version 2 has supplanted version 1, this can go. */ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2678 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2679 | #define YYFAIL goto yyerrlab |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2680 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2681 | #define YYRECOVERING() (!!yyerrstatus) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2682 | |
| 2683 | #define YYBACKUP(Token, Value) \ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2684 | do \ |
| 2685 | if (yychar == YYEMPTY && yylen == 1) \ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2686 | { \ |
| 2687 | yychar = (Token); \ |
| 2688 | yylval = (Value); \ |
| 2689 | yytoken = YYTRANSLATE (yychar); \ |
| 2690 | YYPOPSTACK (1); \ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2691 | goto yybackup; \ |
| 2692 | } \ |
| 2693 | else \ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2694 | { \ |
| 2695 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2696 | YYERROR; \ |
| 2697 | } \ |
| 2698 | while (YYID (0)) |
| 2699 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2700 | |
| 2701 | #define YYTERROR 1 |
| 2702 | #define YYERRCODE 256 |
| 2703 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2704 | |
| 2705 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2706 | If N is 0, then set CURRENT to the empty location which ends |
| 2707 | the previous symbol: RHS[0] (always defined). */ |
| 2708 | |
| 2709 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2710 | #ifndef YYLLOC_DEFAULT |
| 2711 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2712 | do \ |
| 2713 | if (YYID (N)) \ |
| 2714 | { \ |
| 2715 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2716 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2717 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2718 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2719 | } \ |
| 2720 | else \ |
| 2721 | { \ |
| 2722 | (Current).first_line = (Current).last_line = \ |
| 2723 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2724 | (Current).first_column = (Current).last_column = \ |
| 2725 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2726 | } \ |
| 2727 | while (YYID (0)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2728 | #endif |
| 2729 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2730 | |
| 2731 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2732 | This macro was not mandated originally: define only if we know |
| 2733 | we won't break user code: when these are the locations we know. */ |
| 2734 | |
| 2735 | #ifndef YY_LOCATION_PRINT |
Devang Patel | eb29334 | 2008-02-20 19:13:10 +0000 | [diff] [blame] | 2736 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2737 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2738 | fprintf (File, "%d.%d-%d.%d", \ |
| 2739 | (Loc).first_line, (Loc).first_column, \ |
| 2740 | (Loc).last_line, (Loc).last_column) |
| 2741 | # else |
| 2742 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2743 | # endif |
| 2744 | #endif |
| 2745 | |
| 2746 | |
| 2747 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2748 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2749 | #ifdef YYLEX_PARAM |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2750 | # define YYLEX yylex (YYLEX_PARAM) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2751 | #else |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2752 | # define YYLEX yylex () |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2753 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2754 | |
| 2755 | /* Enable debugging if requested. */ |
| 2756 | #if YYDEBUG |
| 2757 | |
| 2758 | # ifndef YYFPRINTF |
| 2759 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2760 | # define YYFPRINTF fprintf |
| 2761 | # endif |
| 2762 | |
| 2763 | # define YYDPRINTF(Args) \ |
| 2764 | do { \ |
| 2765 | if (yydebug) \ |
| 2766 | YYFPRINTF Args; \ |
| 2767 | } while (YYID (0)) |
| 2768 | |
| 2769 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2770 | do { \ |
| 2771 | if (yydebug) \ |
| 2772 | { \ |
| 2773 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2774 | yy_symbol_print (stderr, \ |
| 2775 | Type, Value); \ |
| 2776 | YYFPRINTF (stderr, "\n"); \ |
| 2777 | } \ |
| 2778 | } while (YYID (0)) |
| 2779 | |
| 2780 | |
| 2781 | /*--------------------------------. |
| 2782 | | Print this symbol on YYOUTPUT. | |
| 2783 | `--------------------------------*/ |
| 2784 | |
| 2785 | /*ARGSUSED*/ |
| 2786 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2787 | || defined __cplusplus || defined _MSC_VER) |
| 2788 | static void |
| 2789 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2790 | #else |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2791 | static void |
| 2792 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 2793 | FILE *yyoutput; |
| 2794 | int yytype; |
| 2795 | YYSTYPE const * const yyvaluep; |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2796 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2797 | { |
| 2798 | if (!yyvaluep) |
| 2799 | return; |
| 2800 | # ifdef YYPRINT |
| 2801 | if (yytype < YYNTOKENS) |
| 2802 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2803 | # else |
| 2804 | YYUSE (yyoutput); |
| 2805 | # endif |
| 2806 | switch (yytype) |
| 2807 | { |
| 2808 | default: |
| 2809 | break; |
| 2810 | } |
| 2811 | } |
| 2812 | |
| 2813 | |
| 2814 | /*--------------------------------. |
| 2815 | | Print this symbol on YYOUTPUT. | |
| 2816 | `--------------------------------*/ |
| 2817 | |
| 2818 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2819 | || defined __cplusplus || defined _MSC_VER) |
| 2820 | static void |
| 2821 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 2822 | #else |
| 2823 | static void |
| 2824 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 2825 | FILE *yyoutput; |
| 2826 | int yytype; |
| 2827 | YYSTYPE const * const yyvaluep; |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 2828 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2829 | { |
| 2830 | if (yytype < YYNTOKENS) |
| 2831 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2832 | else |
| 2833 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2834 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2835 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 2836 | YYFPRINTF (yyoutput, ")"); |
| 2837 | } |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2838 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2839 | /*------------------------------------------------------------------. |
| 2840 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2841 | | TOP (included). | |
| 2842 | `------------------------------------------------------------------*/ |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2843 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2844 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2845 | || defined __cplusplus || defined _MSC_VER) |
| 2846 | static void |
| 2847 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
| 2848 | #else |
| 2849 | static void |
| 2850 | yy_stack_print (bottom, top) |
| 2851 | yytype_int16 *bottom; |
| 2852 | yytype_int16 *top; |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 2853 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2854 | { |
| 2855 | YYFPRINTF (stderr, "Stack now"); |
| 2856 | for (; bottom <= top; ++bottom) |
| 2857 | YYFPRINTF (stderr, " %d", *bottom); |
| 2858 | YYFPRINTF (stderr, "\n"); |
| 2859 | } |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2860 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2861 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2862 | do { \ |
| 2863 | if (yydebug) \ |
| 2864 | yy_stack_print ((Bottom), (Top)); \ |
| 2865 | } while (YYID (0)) |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2866 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2867 | |
| 2868 | /*------------------------------------------------. |
| 2869 | | Report that the YYRULE is going to be reduced. | |
| 2870 | `------------------------------------------------*/ |
| 2871 | |
| 2872 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2873 | || defined __cplusplus || defined _MSC_VER) |
| 2874 | static void |
| 2875 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 2876 | #else |
| 2877 | static void |
| 2878 | yy_reduce_print (yyvsp, yyrule) |
| 2879 | YYSTYPE *yyvsp; |
| 2880 | int yyrule; |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 2881 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2882 | { |
| 2883 | int yynrhs = yyr2[yyrule]; |
| 2884 | int yyi; |
| 2885 | unsigned long int yylno = yyrline[yyrule]; |
| 2886 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 2887 | yyrule - 1, yylno); |
| 2888 | /* The symbols being reduced. */ |
| 2889 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 2890 | { |
| 2891 | fprintf (stderr, " $%d = ", yyi + 1); |
| 2892 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 2893 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 2894 | ); |
| 2895 | fprintf (stderr, "\n"); |
| 2896 | } |
| 2897 | } |
Anton Korobeynikov | 66e2865 | 2007-11-14 09:53:48 +0000 | [diff] [blame] | 2898 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2899 | # define YY_REDUCE_PRINT(Rule) \ |
| 2900 | do { \ |
| 2901 | if (yydebug) \ |
| 2902 | yy_reduce_print (yyvsp, Rule); \ |
| 2903 | } while (YYID (0)) |
Anton Korobeynikov | 66e2865 | 2007-11-14 09:53:48 +0000 | [diff] [blame] | 2904 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2905 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2906 | multiple parsers can coexist. */ |
| 2907 | int yydebug; |
| 2908 | #else /* !YYDEBUG */ |
| 2909 | # define YYDPRINTF(Args) |
| 2910 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2911 | # define YY_STACK_PRINT(Bottom, Top) |
| 2912 | # define YY_REDUCE_PRINT(Rule) |
| 2913 | #endif /* !YYDEBUG */ |
| 2914 | |
| 2915 | |
| 2916 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2917 | #ifndef YYINITDEPTH |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2918 | # define YYINITDEPTH 200 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2919 | #endif |
| 2920 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2921 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2922 | if the built-in stack extension method is used). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2923 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2924 | Do not make this value too large; the results are undefined if |
| 2925 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2926 | evaluated with infinite-precision integer arithmetic. */ |
David Greene | 9145dd2 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2927 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2928 | #ifndef YYMAXDEPTH |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2929 | # define YYMAXDEPTH 10000 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2930 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2931 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2932 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2933 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2934 | #if YYERROR_VERBOSE |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2935 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2936 | # ifndef yystrlen |
| 2937 | # if defined __GLIBC__ && defined _STRING_H |
| 2938 | # define yystrlen strlen |
| 2939 | # else |
| 2940 | /* Return the length of YYSTR. */ |
| 2941 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2942 | || defined __cplusplus || defined _MSC_VER) |
| 2943 | static YYSIZE_T |
| 2944 | yystrlen (const char *yystr) |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2945 | #else |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2946 | static YYSIZE_T |
| 2947 | yystrlen (yystr) |
| 2948 | const char *yystr; |
| 2949 | #endif |
| 2950 | { |
| 2951 | YYSIZE_T yylen; |
| 2952 | for (yylen = 0; yystr[yylen]; yylen++) |
| 2953 | continue; |
| 2954 | return yylen; |
| 2955 | } |
| 2956 | # endif |
| 2957 | # endif |
| 2958 | |
| 2959 | # ifndef yystpcpy |
| 2960 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 2961 | # define yystpcpy stpcpy |
| 2962 | # else |
| 2963 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2964 | YYDEST. */ |
| 2965 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2966 | || defined __cplusplus || defined _MSC_VER) |
| 2967 | static char * |
| 2968 | yystpcpy (char *yydest, const char *yysrc) |
| 2969 | #else |
| 2970 | static char * |
| 2971 | yystpcpy (yydest, yysrc) |
| 2972 | char *yydest; |
| 2973 | const char *yysrc; |
| 2974 | #endif |
| 2975 | { |
| 2976 | char *yyd = yydest; |
| 2977 | const char *yys = yysrc; |
| 2978 | |
| 2979 | while ((*yyd++ = *yys++) != '\0') |
| 2980 | continue; |
| 2981 | |
| 2982 | return yyd - 1; |
| 2983 | } |
| 2984 | # endif |
| 2985 | # endif |
| 2986 | |
| 2987 | # ifndef yytnamerr |
| 2988 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2989 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2990 | heuristic is that double-quoting is unnecessary unless the string |
| 2991 | contains an apostrophe, a comma, or backslash (other than |
| 2992 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2993 | null, do not copy; instead, return the length of what the result |
| 2994 | would have been. */ |
| 2995 | static YYSIZE_T |
| 2996 | yytnamerr (char *yyres, const char *yystr) |
| 2997 | { |
| 2998 | if (*yystr == '"') |
| 2999 | { |
| 3000 | YYSIZE_T yyn = 0; |
| 3001 | char const *yyp = yystr; |
| 3002 | |
| 3003 | for (;;) |
| 3004 | switch (*++yyp) |
| 3005 | { |
| 3006 | case '\'': |
| 3007 | case ',': |
| 3008 | goto do_not_strip_quotes; |
| 3009 | |
| 3010 | case '\\': |
| 3011 | if (*++yyp != '\\') |
| 3012 | goto do_not_strip_quotes; |
| 3013 | /* Fall through. */ |
| 3014 | default: |
| 3015 | if (yyres) |
| 3016 | yyres[yyn] = *yyp; |
| 3017 | yyn++; |
| 3018 | break; |
| 3019 | |
| 3020 | case '"': |
| 3021 | if (yyres) |
| 3022 | yyres[yyn] = '\0'; |
| 3023 | return yyn; |
| 3024 | } |
| 3025 | do_not_strip_quotes: ; |
| 3026 | } |
| 3027 | |
| 3028 | if (! yyres) |
| 3029 | return yystrlen (yystr); |
| 3030 | |
| 3031 | return yystpcpy (yyres, yystr) - yyres; |
| 3032 | } |
| 3033 | # endif |
| 3034 | |
| 3035 | /* Copy into YYRESULT an error message about the unexpected token |
| 3036 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 3037 | including the terminating null byte. If YYRESULT is null, do not |
| 3038 | copy anything; just return the number of bytes that would be |
| 3039 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 3040 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 3041 | size calculation. */ |
| 3042 | static YYSIZE_T |
| 3043 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 3044 | { |
| 3045 | int yyn = yypact[yystate]; |
| 3046 | |
| 3047 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 3048 | return 0; |
| 3049 | else |
| 3050 | { |
| 3051 | int yytype = YYTRANSLATE (yychar); |
| 3052 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 3053 | YYSIZE_T yysize = yysize0; |
| 3054 | YYSIZE_T yysize1; |
| 3055 | int yysize_overflow = 0; |
| 3056 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 3057 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 3058 | int yyx; |
| 3059 | |
| 3060 | # if 0 |
| 3061 | /* This is so xgettext sees the translatable formats that are |
| 3062 | constructed on the fly. */ |
| 3063 | YY_("syntax error, unexpected %s"); |
| 3064 | YY_("syntax error, unexpected %s, expecting %s"); |
| 3065 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 3066 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 3067 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 3068 | # endif |
| 3069 | char *yyfmt; |
| 3070 | char const *yyf; |
| 3071 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 3072 | static char const yyexpecting[] = ", expecting %s"; |
| 3073 | static char const yyor[] = " or %s"; |
| 3074 | char yyformat[sizeof yyunexpected |
| 3075 | + sizeof yyexpecting - 1 |
| 3076 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 3077 | * (sizeof yyor - 1))]; |
| 3078 | char const *yyprefix = yyexpecting; |
| 3079 | |
| 3080 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 3081 | YYCHECK. */ |
| 3082 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 3083 | |
| 3084 | /* Stay within bounds of both yycheck and yytname. */ |
| 3085 | int yychecklim = YYLAST - yyn + 1; |
| 3086 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 3087 | int yycount = 1; |
| 3088 | |
| 3089 | yyarg[0] = yytname[yytype]; |
| 3090 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 3091 | |
| 3092 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 3093 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 3094 | { |
| 3095 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 3096 | { |
| 3097 | yycount = 1; |
| 3098 | yysize = yysize0; |
| 3099 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 3100 | break; |
| 3101 | } |
| 3102 | yyarg[yycount++] = yytname[yyx]; |
| 3103 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 3104 | yysize_overflow |= (yysize1 < yysize); |
| 3105 | yysize = yysize1; |
| 3106 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 3107 | yyprefix = yyor; |
| 3108 | } |
| 3109 | |
| 3110 | yyf = YY_(yyformat); |
| 3111 | yysize1 = yysize + yystrlen (yyf); |
| 3112 | yysize_overflow |= (yysize1 < yysize); |
| 3113 | yysize = yysize1; |
| 3114 | |
| 3115 | if (yysize_overflow) |
| 3116 | return YYSIZE_MAXIMUM; |
| 3117 | |
| 3118 | if (yyresult) |
| 3119 | { |
| 3120 | /* Avoid sprintf, as that infringes on the user's name space. |
| 3121 | Don't have undefined behavior even if the translation |
| 3122 | produced a string with the wrong number of "%s"s. */ |
| 3123 | char *yyp = yyresult; |
| 3124 | int yyi = 0; |
| 3125 | while ((*yyp = *yyf) != '\0') |
| 3126 | { |
| 3127 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 3128 | { |
| 3129 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 3130 | yyf += 2; |
| 3131 | } |
| 3132 | else |
| 3133 | { |
| 3134 | yyp++; |
| 3135 | yyf++; |
| 3136 | } |
| 3137 | } |
| 3138 | } |
| 3139 | return yysize; |
| 3140 | } |
| 3141 | } |
| 3142 | #endif /* YYERROR_VERBOSE */ |
| 3143 | |
| 3144 | |
| 3145 | /*-----------------------------------------------. |
| 3146 | | Release the memory associated to this symbol. | |
| 3147 | `-----------------------------------------------*/ |
| 3148 | |
| 3149 | /*ARGSUSED*/ |
| 3150 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3151 | || defined __cplusplus || defined _MSC_VER) |
| 3152 | static void |
| 3153 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 3154 | #else |
| 3155 | static void |
| 3156 | yydestruct (yymsg, yytype, yyvaluep) |
| 3157 | const char *yymsg; |
| 3158 | int yytype; |
| 3159 | YYSTYPE *yyvaluep; |
| 3160 | #endif |
| 3161 | { |
| 3162 | YYUSE (yyvaluep); |
| 3163 | |
| 3164 | if (!yymsg) |
| 3165 | yymsg = "Deleting"; |
| 3166 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 3167 | |
| 3168 | switch (yytype) |
| 3169 | { |
| 3170 | |
| 3171 | default: |
| 3172 | break; |
| 3173 | } |
| 3174 | } |
| 3175 | |
| 3176 | |
| 3177 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 3178 | |
| 3179 | #ifdef YYPARSE_PARAM |
| 3180 | #if defined __STDC__ || defined __cplusplus |
| 3181 | int yyparse (void *YYPARSE_PARAM); |
| 3182 | #else |
| 3183 | int yyparse (); |
| 3184 | #endif |
| 3185 | #else /* ! YYPARSE_PARAM */ |
| 3186 | #if defined __STDC__ || defined __cplusplus |
David Greene | 4855639 | 2007-09-04 18:46:50 +0000 | [diff] [blame] | 3187 | int yyparse (void); |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3188 | #else |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3189 | int yyparse (); |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 3190 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3191 | #endif /* ! YYPARSE_PARAM */ |
Anton Korobeynikov | 66e2865 | 2007-11-14 09:53:48 +0000 | [diff] [blame] | 3192 | |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3193 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3194 | |
| 3195 | /* The look-ahead symbol. */ |
| 3196 | int yychar; |
| 3197 | |
| 3198 | /* The semantic value of the look-ahead symbol. */ |
| 3199 | YYSTYPE yylval; |
| 3200 | |
| 3201 | /* Number of syntax errors so far. */ |
| 3202 | int yynerrs; |
| 3203 | |
| 3204 | |
| 3205 | |
| 3206 | /*----------. |
| 3207 | | yyparse. | |
| 3208 | `----------*/ |
| 3209 | |
| 3210 | #ifdef YYPARSE_PARAM |
| 3211 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3212 | || defined __cplusplus || defined _MSC_VER) |
| 3213 | int |
| 3214 | yyparse (void *YYPARSE_PARAM) |
| 3215 | #else |
| 3216 | int |
| 3217 | yyparse (YYPARSE_PARAM) |
| 3218 | void *YYPARSE_PARAM; |
| 3219 | #endif |
| 3220 | #else /* ! YYPARSE_PARAM */ |
| 3221 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3222 | || defined __cplusplus || defined _MSC_VER) |
| 3223 | int |
| 3224 | yyparse (void) |
| 3225 | #else |
| 3226 | int |
| 3227 | yyparse () |
| 3228 | |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3229 | #endif |
| 3230 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3231 | { |
| 3232 | |
| 3233 | int yystate; |
| 3234 | int yyn; |
| 3235 | int yyresult; |
| 3236 | /* Number of tokens to shift before error messages enabled. */ |
| 3237 | int yyerrstatus; |
| 3238 | /* Look-ahead token as an internal (translated) token number. */ |
| 3239 | int yytoken = 0; |
| 3240 | #if YYERROR_VERBOSE |
| 3241 | /* Buffer for error messages, and its allocated size. */ |
| 3242 | char yymsgbuf[128]; |
| 3243 | char *yymsg = yymsgbuf; |
| 3244 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3245 | #endif |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3246 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3247 | /* Three stacks and their tools: |
| 3248 | `yyss': related to states, |
| 3249 | `yyvs': related to semantic values, |
| 3250 | `yyls': related to locations. |
| 3251 | |
| 3252 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3253 | to reallocate them elsewhere. */ |
| 3254 | |
| 3255 | /* The state stack. */ |
| 3256 | yytype_int16 yyssa[YYINITDEPTH]; |
| 3257 | yytype_int16 *yyss = yyssa; |
| 3258 | yytype_int16 *yyssp; |
| 3259 | |
| 3260 | /* The semantic value stack. */ |
| 3261 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3262 | YYSTYPE *yyvs = yyvsa; |
| 3263 | YYSTYPE *yyvsp; |
| 3264 | |
| 3265 | |
| 3266 | |
| 3267 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 3268 | |
| 3269 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 3270 | |
| 3271 | /* The variables used to return semantic value and location from the |
| 3272 | action routines. */ |
| 3273 | YYSTYPE yyval; |
| 3274 | |
| 3275 | |
| 3276 | /* The number of symbols on the RHS of the reduced rule. |
| 3277 | Keep to zero when no symbol should be popped. */ |
| 3278 | int yylen = 0; |
| 3279 | |
| 3280 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 3281 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3282 | yystate = 0; |
| 3283 | yyerrstatus = 0; |
| 3284 | yynerrs = 0; |
| 3285 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3286 | |
| 3287 | /* Initialize stack pointers. |
| 3288 | Waste one element of value and location stack |
| 3289 | so that they stay on the same level as the state stack. |
| 3290 | The wasted elements are never initialized. */ |
| 3291 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3292 | yyssp = yyss; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3293 | yyvsp = yyvs; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3294 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3295 | goto yysetstate; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3296 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3297 | /*------------------------------------------------------------. |
| 3298 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3299 | `------------------------------------------------------------*/ |
| 3300 | yynewstate: |
| 3301 | /* In all cases, when you get here, the value and location stacks |
| 3302 | have just been pushed. So pushing a state here evens the stacks. */ |
| 3303 | yyssp++; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3304 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3305 | yysetstate: |
| 3306 | *yyssp = yystate; |
| 3307 | |
| 3308 | if (yyss + yystacksize - 1 <= yyssp) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3309 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3310 | /* Get the current used size of the three stacks, in elements. */ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3311 | YYSIZE_T yysize = yyssp - yyss + 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3312 | |
| 3313 | #ifdef yyoverflow |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3314 | { |
| 3315 | /* Give user a chance to reallocate the stack. Use copies of |
| 3316 | these so that the &'s don't force the real ones into |
| 3317 | memory. */ |
| 3318 | YYSTYPE *yyvs1 = yyvs; |
| 3319 | yytype_int16 *yyss1 = yyss; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3320 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3321 | |
| 3322 | /* Each stack pointer address is followed by the size of the |
| 3323 | data in use in that stack, in bytes. This used to be a |
| 3324 | conditional around just the two extra args, but that might |
| 3325 | be undefined if yyoverflow is a macro. */ |
| 3326 | yyoverflow (YY_("memory exhausted"), |
| 3327 | &yyss1, yysize * sizeof (*yyssp), |
| 3328 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3329 | |
| 3330 | &yystacksize); |
| 3331 | |
| 3332 | yyss = yyss1; |
| 3333 | yyvs = yyvs1; |
| 3334 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3335 | #else /* no yyoverflow */ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3336 | # ifndef YYSTACK_RELOCATE |
| 3337 | goto yyexhaustedlab; |
| 3338 | # else |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3339 | /* Extend the stack our own way. */ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3340 | if (YYMAXDEPTH <= yystacksize) |
| 3341 | goto yyexhaustedlab; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3342 | yystacksize *= 2; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3343 | if (YYMAXDEPTH < yystacksize) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3344 | yystacksize = YYMAXDEPTH; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3345 | |
| 3346 | { |
| 3347 | yytype_int16 *yyss1 = yyss; |
| 3348 | union yyalloc *yyptr = |
| 3349 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3350 | if (! yyptr) |
| 3351 | goto yyexhaustedlab; |
| 3352 | YYSTACK_RELOCATE (yyss); |
| 3353 | YYSTACK_RELOCATE (yyvs); |
| 3354 | |
| 3355 | # undef YYSTACK_RELOCATE |
| 3356 | if (yyss1 != yyssa) |
| 3357 | YYSTACK_FREE (yyss1); |
| 3358 | } |
| 3359 | # endif |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3360 | #endif /* no yyoverflow */ |
| 3361 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3362 | yyssp = yyss + yysize - 1; |
| 3363 | yyvsp = yyvs + yysize - 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3364 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3365 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3366 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3367 | (unsigned long int) yystacksize)); |
| 3368 | |
| 3369 | if (yyss + yystacksize - 1 <= yyssp) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3370 | YYABORT; |
| 3371 | } |
| 3372 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3373 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3374 | |
| 3375 | goto yybackup; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3376 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3377 | /*-----------. |
| 3378 | | yybackup. | |
| 3379 | `-----------*/ |
| 3380 | yybackup: |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3381 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3382 | /* Do appropriate processing given the current state. Read a |
| 3383 | 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] | 3384 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3385 | /* 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] | 3386 | yyn = yypact[yystate]; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3387 | if (yyn == YYPACT_NINF) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3388 | goto yydefault; |
| 3389 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3390 | /* 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] | 3391 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3392 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3393 | if (yychar == YYEMPTY) |
| 3394 | { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3395 | YYDPRINTF ((stderr, "Reading a token: ")); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3396 | yychar = YYLEX; |
| 3397 | } |
| 3398 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3399 | if (yychar <= YYEOF) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3400 | { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3401 | yychar = yytoken = YYEOF; |
| 3402 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3403 | } |
| 3404 | else |
| 3405 | { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3406 | yytoken = YYTRANSLATE (yychar); |
| 3407 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3408 | } |
| 3409 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3410 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3411 | detect an error, take that action. */ |
| 3412 | yyn += yytoken; |
| 3413 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3414 | goto yydefault; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3415 | yyn = yytable[yyn]; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3416 | if (yyn <= 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3417 | { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3418 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3419 | goto yyerrlab; |
| 3420 | yyn = -yyn; |
| 3421 | goto yyreduce; |
| 3422 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3423 | |
| 3424 | if (yyn == YYFINAL) |
| 3425 | YYACCEPT; |
| 3426 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3427 | /* Count tokens shifted since error; after three, turn off error |
| 3428 | status. */ |
| 3429 | if (yyerrstatus) |
| 3430 | yyerrstatus--; |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 3431 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3432 | /* Shift the look-ahead token. */ |
| 3433 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3434 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3435 | /* Discard the shifted token unless it is eof. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3436 | if (yychar != YYEOF) |
| 3437 | yychar = YYEMPTY; |
| 3438 | |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3439 | yystate = yyn; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3440 | *++yyvsp = yylval; |
| 3441 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3442 | goto yynewstate; |
| 3443 | |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3444 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3445 | /*-----------------------------------------------------------. |
| 3446 | | yydefault -- do the default action for the current state. | |
| 3447 | `-----------------------------------------------------------*/ |
| 3448 | yydefault: |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3449 | yyn = yydefact[yystate]; |
| 3450 | if (yyn == 0) |
| 3451 | goto yyerrlab; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3452 | goto yyreduce; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3453 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3454 | |
| 3455 | /*-----------------------------. |
| 3456 | | yyreduce -- Do a reduction. | |
| 3457 | `-----------------------------*/ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3458 | yyreduce: |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3459 | /* yyn is the number of a rule to reduce with. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3460 | yylen = yyr2[yyn]; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3461 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3462 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3463 | `$$ = $1'. |
| 3464 | |
| 3465 | Otherwise, the following line sets YYVAL to garbage. |
| 3466 | This behavior is undocumented and Bison |
| 3467 | users should not rely upon it. Assigning to YYVAL |
| 3468 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3469 | GCC warning that YYVAL may be used uninitialized. */ |
| 3470 | yyval = yyvsp[1-yylen]; |
| 3471 | |
| 3472 | |
| 3473 | YY_REDUCE_PRINT (yyn); |
| 3474 | switch (yyn) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3475 | { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3476 | case 29: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3477 | #line 1121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3478 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3479 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3480 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3481 | case 30: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3482 | #line 1121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3483 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3484 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3485 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3486 | case 31: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3487 | #line 1122 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3488 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3489 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3490 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3491 | case 32: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3492 | #line 1122 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3493 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3494 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3495 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3496 | case 33: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3497 | #line 1123 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3498 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3499 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3500 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3501 | case 34: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3502 | #line 1123 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3503 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3504 | break; |
| 3505 | |
| 3506 | case 35: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3507 | #line 1124 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3508 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3509 | break; |
| 3510 | |
| 3511 | case 36: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3512 | #line 1124 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3513 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3514 | break; |
| 3515 | |
| 3516 | case 37: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3517 | #line 1125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3518 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3519 | break; |
| 3520 | |
| 3521 | case 38: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3522 | #line 1125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3523 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3524 | break; |
| 3525 | |
| 3526 | case 39: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3527 | #line 1129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3528 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3529 | break; |
| 3530 | |
| 3531 | case 40: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3532 | #line 1129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3533 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3534 | break; |
| 3535 | |
| 3536 | case 41: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3537 | #line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3538 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3539 | break; |
| 3540 | |
| 3541 | case 42: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3542 | #line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3543 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3544 | break; |
| 3545 | |
| 3546 | case 43: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3547 | #line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3548 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3549 | break; |
| 3550 | |
| 3551 | case 44: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3552 | #line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3553 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3554 | break; |
| 3555 | |
| 3556 | case 45: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3557 | #line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3558 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3559 | break; |
| 3560 | |
| 3561 | case 46: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3562 | #line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3563 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3564 | break; |
| 3565 | |
| 3566 | case 47: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3567 | #line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3568 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3569 | break; |
| 3570 | |
| 3571 | case 48: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3572 | #line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3573 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3574 | break; |
| 3575 | |
| 3576 | case 49: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3577 | #line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3578 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3579 | break; |
| 3580 | |
| 3581 | case 50: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3582 | #line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3583 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3584 | break; |
| 3585 | |
| 3586 | case 51: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3587 | #line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3588 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3589 | break; |
| 3590 | |
| 3591 | case 52: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3592 | #line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3593 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3594 | break; |
| 3595 | |
| 3596 | case 53: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3597 | #line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3598 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3599 | break; |
| 3600 | |
| 3601 | case 54: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3602 | #line 1137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3603 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3604 | break; |
| 3605 | |
| 3606 | case 65: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3607 | #line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3608 | { (yyval.StrVal) = 0; ;} |
| 3609 | break; |
| 3610 | |
| 3611 | case 66: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3612 | #line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3613 | { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} |
| 3614 | break; |
| 3615 | |
| 3616 | case 67: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3617 | #line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3618 | { (yyval.UIntVal)=0; ;} |
| 3619 | break; |
| 3620 | |
| 3621 | case 68: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3622 | #line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3623 | { |
| 3624 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3625 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3626 | ;} |
| 3627 | break; |
| 3628 | |
| 3629 | case 69: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3630 | #line 1157 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3631 | { |
| 3632 | (yyval.StrVal) = 0; |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3633 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3634 | ;} |
| 3635 | break; |
| 3636 | |
| 3637 | case 73: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3638 | #line 1165 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3639 | { |
| 3640 | (yyval.StrVal) = 0; |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3641 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3642 | ;} |
| 3643 | break; |
| 3644 | |
| 3645 | case 74: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3646 | #line 1170 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3647 | { |
| 3648 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3649 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3650 | ;} |
| 3651 | break; |
| 3652 | |
| 3653 | case 75: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3654 | #line 1176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3655 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3656 | break; |
| 3657 | |
| 3658 | case 76: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3659 | #line 1177 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3660 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3661 | break; |
| 3662 | |
| 3663 | case 77: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3664 | #line 1178 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3665 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3666 | break; |
| 3667 | |
| 3668 | case 78: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3669 | #line 1179 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3670 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3671 | break; |
| 3672 | |
| 3673 | case 79: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3674 | #line 1180 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3675 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3676 | break; |
| 3677 | |
| 3678 | case 80: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3679 | #line 1184 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3680 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3681 | break; |
| 3682 | |
| 3683 | case 81: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3684 | #line 1185 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3685 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3686 | break; |
| 3687 | |
| 3688 | case 82: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3689 | #line 1186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3690 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3691 | break; |
| 3692 | |
| 3693 | case 83: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3694 | #line 1190 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3695 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3696 | break; |
| 3697 | |
| 3698 | case 84: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3699 | #line 1191 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3700 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3701 | break; |
| 3702 | |
| 3703 | case 85: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3704 | #line 1192 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3705 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3706 | break; |
| 3707 | |
| 3708 | case 86: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3709 | #line 1193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3710 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
| 3711 | break; |
| 3712 | |
| 3713 | case 87: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3714 | #line 1197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3715 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3716 | break; |
| 3717 | |
| 3718 | case 88: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3719 | #line 1198 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3720 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3721 | break; |
| 3722 | |
| 3723 | case 89: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3724 | #line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3725 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3726 | break; |
| 3727 | |
| 3728 | case 90: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3729 | #line 1203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3730 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3731 | break; |
| 3732 | |
| 3733 | case 91: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3734 | #line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3735 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3736 | break; |
| 3737 | |
| 3738 | case 92: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3739 | #line 1205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3740 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3741 | break; |
| 3742 | |
| 3743 | case 93: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3744 | #line 1206 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3745 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3746 | break; |
| 3747 | |
| 3748 | case 94: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3749 | #line 1207 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3750 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3751 | break; |
| 3752 | |
| 3753 | case 95: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3754 | #line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3755 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3756 | break; |
| 3757 | |
| 3758 | case 96: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3759 | #line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3760 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3761 | break; |
| 3762 | |
| 3763 | case 97: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3764 | #line 1213 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3765 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3766 | break; |
| 3767 | |
| 3768 | case 98: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3769 | #line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3770 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3771 | break; |
| 3772 | |
| 3773 | case 99: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3774 | #line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3775 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3776 | break; |
| 3777 | |
| 3778 | case 100: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3779 | #line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3780 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3781 | break; |
| 3782 | |
| 3783 | case 101: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3784 | #line 1219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3785 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3786 | break; |
| 3787 | |
| 3788 | case 102: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3789 | #line 1220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3790 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3791 | break; |
| 3792 | |
| 3793 | case 103: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3794 | #line 1221 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3795 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3796 | break; |
| 3797 | |
| 3798 | case 104: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3799 | #line 1222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3800 | { |
| 3801 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3802 | GEN_ERROR("Calling conv too large"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3803 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3804 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3805 | ;} |
| 3806 | break; |
| 3807 | |
| 3808 | case 105: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3809 | #line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3810 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3811 | break; |
| 3812 | |
| 3813 | case 106: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3814 | #line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3815 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3816 | break; |
| 3817 | |
| 3818 | case 107: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3819 | #line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3820 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3821 | break; |
| 3822 | |
| 3823 | case 108: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3824 | #line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3825 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3826 | break; |
| 3827 | |
| 3828 | case 109: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3829 | #line 1233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3830 | { (yyval.ParamAttrs) = ParamAttr::InReg; ;} |
| 3831 | break; |
| 3832 | |
| 3833 | case 110: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3834 | #line 1234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3835 | { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} |
| 3836 | break; |
| 3837 | |
| 3838 | case 111: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3839 | #line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3840 | { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} |
| 3841 | break; |
| 3842 | |
| 3843 | case 112: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3844 | #line 1236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3845 | { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} |
| 3846 | break; |
| 3847 | |
| 3848 | case 113: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3849 | #line 1237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3850 | { (yyval.ParamAttrs) = ParamAttr::Nest; ;} |
| 3851 | break; |
| 3852 | |
| 3853 | case 114: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3854 | #line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | f92f316 | 2008-02-22 17:50:51 +0000 | [diff] [blame] | 3855 | { (yyval.ParamAttrs) = |
| 3856 | ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3857 | break; |
| 3858 | |
| 3859 | case 115: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3860 | #line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3861 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3862 | break; |
| 3863 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3864 | case 116: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3865 | #line 1243 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3866 | { |
| 3867 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 3868 | ;} |
| 3869 | break; |
| 3870 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3871 | case 117: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3872 | #line 1248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3873 | { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} |
| 3874 | break; |
| 3875 | |
| 3876 | case 118: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3877 | #line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3878 | { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} |
| 3879 | break; |
| 3880 | |
| 3881 | case 119: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3882 | #line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3883 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3884 | break; |
| 3885 | |
| 3886 | case 120: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3887 | #line 1251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3888 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3889 | break; |
| 3890 | |
| 3891 | case 121: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3892 | #line 1252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3893 | { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} |
| 3894 | break; |
| 3895 | |
| 3896 | case 122: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3897 | #line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3898 | { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} |
| 3899 | break; |
| 3900 | |
| 3901 | case 123: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3902 | #line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3903 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3904 | break; |
| 3905 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3906 | case 124: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3907 | #line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3908 | { |
| 3909 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 3910 | ;} |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3911 | break; |
| 3912 | |
| 3913 | case 125: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3914 | #line 1262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3915 | { (yyval.StrVal) = 0; ;} |
| 3916 | break; |
| 3917 | |
| 3918 | case 126: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3919 | #line 1263 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3920 | { |
| 3921 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
| 3922 | ;} |
| 3923 | break; |
| 3924 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3925 | case 127: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3926 | #line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3927 | { (yyval.UIntVal) = 0; ;} |
| 3928 | break; |
| 3929 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3930 | case 128: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3931 | #line 1271 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3932 | { |
| 3933 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
| 3934 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3935 | GEN_ERROR("Alignment must be a power of two"); |
| 3936 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3937 | ;} |
| 3938 | break; |
| 3939 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3940 | case 129: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3941 | #line 1277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3942 | { (yyval.UIntVal) = 0; ;} |
| 3943 | break; |
| 3944 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3945 | case 130: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3946 | #line 1278 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3947 | { |
| 3948 | (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); |
| 3949 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3950 | GEN_ERROR("Alignment must be a power of two"); |
| 3951 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3952 | ;} |
| 3953 | break; |
| 3954 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3955 | case 131: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3956 | #line 1287 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3957 | { |
| 3958 | for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) |
| 3959 | if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3960 | GEN_ERROR("Invalid character in section name"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3961 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3962 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3963 | ;} |
| 3964 | break; |
| 3965 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3966 | case 132: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3967 | #line 1295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3968 | { (yyval.StrVal) = 0; ;} |
| 3969 | break; |
| 3970 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3971 | case 133: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3972 | #line 1296 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3973 | { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} |
| 3974 | break; |
| 3975 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3976 | case 134: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3977 | #line 1301 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3978 | {;} |
| 3979 | break; |
| 3980 | |
| 3981 | case 135: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3982 | #line 1302 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3983 | {;} |
| 3984 | break; |
| 3985 | |
| 3986 | case 136: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3987 | #line 1303 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3988 | { |
| 3989 | CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); |
| 3990 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3991 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3992 | ;} |
| 3993 | break; |
| 3994 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 3995 | case 137: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 3996 | #line 1308 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3997 | { |
| 3998 | if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3999 | GEN_ERROR("Alignment must be a power of two"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4000 | CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4001 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4002 | ;} |
| 4003 | break; |
| 4004 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4005 | case 145: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4006 | #line 1324 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4007 | { |
| 4008 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4009 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4010 | ;} |
| 4011 | break; |
| 4012 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4013 | case 146: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4014 | #line 1328 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4015 | { |
| 4016 | (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4017 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4018 | ;} |
| 4019 | break; |
| 4020 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4021 | case 147: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4022 | #line 1332 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4023 | { // Pointer type? |
| 4024 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4025 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4026 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal)))); |
| 4027 | delete (yyvsp[(1) - (3)].TypeVal); |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4028 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4029 | ;} |
| 4030 | break; |
| 4031 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4032 | case 148: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4033 | #line 1339 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4034 | { // Named types are also simple types... |
| 4035 | const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 4036 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4037 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 4038 | ;} |
| 4039 | break; |
| 4040 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4041 | case 149: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4042 | #line 1344 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4043 | { // Type UpReference |
| 4044 | 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] | 4045 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4046 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... |
| 4047 | (yyval.TypeVal) = new PATypeHolder(OT); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4048 | UR_OUT("New Upreference!\n"); |
| 4049 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4050 | ;} |
| 4051 | break; |
| 4052 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4053 | case 150: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4054 | #line 1352 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4055 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4056 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4057 | // FIXME: remove in LLVM 3.0. |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4058 | const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal); |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4059 | if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy || |
| 4060 | isa<OpaqueType>(RetTy))) |
Anton Korobeynikov | 0cdd269 | 2007-12-03 19:17:47 +0000 | [diff] [blame] | 4061 | GEN_ERROR("LLVM Functions cannot return aggregates"); |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4062 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4063 | std::vector<const Type*> Params; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4064 | 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] | 4065 | for (; I != E; ++I ) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4066 | const Type *Ty = I->Ty->get(); |
| 4067 | Params.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4068 | } |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4069 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4070 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4071 | if (isVarArg) Params.pop_back(); |
| 4072 | |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4073 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4074 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4075 | GEN_ERROR("Function arguments must be value types!"); |
| 4076 | |
| 4077 | CHECK_FOR_ERROR |
| 4078 | |
Anton Korobeynikov | 0cdd269 | 2007-12-03 19:17:47 +0000 | [diff] [blame] | 4079 | FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4080 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4081 | delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle |
| 4082 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4083 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4084 | ;} |
| 4085 | break; |
| 4086 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4087 | case 151: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4088 | #line 1382 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4089 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4090 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4091 | // FIXME: remove in LLVM 3.0. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4092 | std::vector<const Type*> Params; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4093 | 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] | 4094 | for ( ; I != E; ++I ) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4095 | const Type* Ty = I->Ty->get(); |
| 4096 | Params.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4097 | } |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4098 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4099 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4100 | if (isVarArg) Params.pop_back(); |
| 4101 | |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4102 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4103 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4104 | GEN_ERROR("Function arguments must be value types!"); |
| 4105 | |
| 4106 | CHECK_FOR_ERROR |
| 4107 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4108 | FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); |
| 4109 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4110 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4111 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4112 | ;} |
| 4113 | break; |
| 4114 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4115 | case 152: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4116 | #line 1407 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4117 | { // Sized array type? |
| 4118 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4119 | delete (yyvsp[(4) - (5)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4120 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4121 | ;} |
| 4122 | break; |
| 4123 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4124 | case 153: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4125 | #line 1412 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4126 | { // Vector type? |
| 4127 | const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); |
| 4128 | if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4129 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 4130 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 4131 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4132 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4133 | delete (yyvsp[(4) - (5)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4134 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4135 | ;} |
| 4136 | break; |
| 4137 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4138 | case 154: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4139 | #line 1422 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4140 | { // Structure type? |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4141 | std::vector<const Type*> Elements; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4142 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), |
| 4143 | E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4144 | Elements.push_back(*I); |
| 4145 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4146 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 4147 | delete (yyvsp[(2) - (3)].TypeList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4148 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4149 | ;} |
| 4150 | break; |
| 4151 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4152 | case 155: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4153 | #line 1432 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4154 | { // Empty structure type? |
| 4155 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4156 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4157 | ;} |
| 4158 | break; |
| 4159 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4160 | case 156: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4161 | #line 1436 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4162 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4163 | std::vector<const Type*> Elements; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4164 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), |
| 4165 | E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4166 | Elements.push_back(*I); |
| 4167 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4168 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 4169 | delete (yyvsp[(3) - (5)].TypeList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4170 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4171 | ;} |
| 4172 | break; |
| 4173 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4174 | case 157: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4175 | #line 1446 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4176 | { // Empty structure type? |
| 4177 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4178 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4179 | ;} |
| 4180 | break; |
| 4181 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4182 | case 158: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4183 | #line 1453 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4184 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4185 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4186 | // FIXME: remove in LLVM 3.0. |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4187 | (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); |
| 4188 | (yyval.TypeWithAttrs).Attrs = ParamAttr::None; |
| 4189 | ;} |
| 4190 | break; |
| 4191 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4192 | case 159: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4193 | #line 1462 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4194 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4195 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4196 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 4197 | if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && (*(yyvsp[(1) - (1)].TypeVal))->getTypeID() != Type::StructTyID) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4198 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4199 | (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); |
| 4200 | ;} |
| 4201 | break; |
| 4202 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4203 | case 160: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4204 | #line 1469 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4205 | { |
| 4206 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 4207 | ;} |
| 4208 | break; |
| 4209 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4210 | case 161: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4211 | #line 1474 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4212 | { |
| 4213 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 4214 | (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4215 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4216 | ;} |
| 4217 | break; |
| 4218 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4219 | case 162: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4220 | #line 1479 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4221 | { |
| 4222 | ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4223 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4224 | ;} |
| 4225 | break; |
| 4226 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4227 | case 164: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4228 | #line 1487 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4229 | { |
| 4230 | (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4231 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 4232 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4233 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4234 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4235 | ;} |
| 4236 | break; |
| 4237 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4238 | case 165: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4239 | #line 1494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4240 | { |
| 4241 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4242 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 4243 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4244 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4245 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4246 | ;} |
| 4247 | break; |
| 4248 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4249 | case 166: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4250 | #line 1501 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4251 | { |
| 4252 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4253 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4254 | ;} |
| 4255 | break; |
| 4256 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4257 | case 167: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4258 | #line 1509 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4259 | { |
| 4260 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 4261 | (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); |
| 4262 | delete (yyvsp[(1) - (1)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4263 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4264 | ;} |
| 4265 | break; |
| 4266 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4267 | case 168: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4268 | #line 1515 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4269 | { |
| 4270 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); |
| 4271 | delete (yyvsp[(3) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4272 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4273 | ;} |
| 4274 | break; |
| 4275 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4276 | case 169: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4277 | #line 1527 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4278 | { // Nonempty unsized arr |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4279 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4280 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4281 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4282 | if (ATy == 0) |
| 4283 | GEN_ERROR("Cannot make array constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4284 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4285 | const Type *ETy = ATy->getElementType(); |
| 4286 | int NumElements = ATy->getNumElements(); |
| 4287 | |
| 4288 | // Verify that we have the correct size... |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4289 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4290 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4291 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4292 | itostr(NumElements) + ""); |
| 4293 | |
| 4294 | // Verify all elements are correct type! |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4295 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4296 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4297 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4298 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4299 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4300 | } |
| 4301 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4302 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4303 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4304 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4305 | ;} |
| 4306 | break; |
| 4307 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4308 | case 170: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4309 | #line 1555 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4310 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4311 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4312 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4313 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4314 | if (ATy == 0) |
| 4315 | GEN_ERROR("Cannot make array constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4316 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4317 | |
| 4318 | int NumElements = ATy->getNumElements(); |
| 4319 | if (NumElements != -1 && NumElements != 0) |
| 4320 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
| 4321 | " arguments, but has size of " + itostr(NumElements) +""); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4322 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 4323 | delete (yyvsp[(1) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4324 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4325 | ;} |
| 4326 | break; |
| 4327 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4328 | case 171: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4329 | #line 1571 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4330 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4331 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4332 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4333 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4334 | if (ATy == 0) |
| 4335 | GEN_ERROR("Cannot make array constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4336 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4337 | |
| 4338 | int NumElements = ATy->getNumElements(); |
| 4339 | const Type *ETy = ATy->getElementType(); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4340 | if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4341 | GEN_ERROR("Can't build string constant of size " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4342 | itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4343 | " when array has size " + itostr(NumElements) + ""); |
| 4344 | std::vector<Constant*> Vals; |
| 4345 | if (ETy == Type::Int8Ty) { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4346 | for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) |
| 4347 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4348 | } else { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4349 | delete (yyvsp[(3) - (3)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4350 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 4351 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4352 | delete (yyvsp[(3) - (3)].StrVal); |
| 4353 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 4354 | delete (yyvsp[(1) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4355 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4356 | ;} |
| 4357 | break; |
| 4358 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4359 | case 172: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4360 | #line 1598 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4361 | { // Nonempty unsized arr |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4362 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4363 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4364 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4365 | if (PTy == 0) |
| 4366 | GEN_ERROR("Cannot make packed constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4367 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4368 | const Type *ETy = PTy->getElementType(); |
| 4369 | int NumElements = PTy->getNumElements(); |
| 4370 | |
| 4371 | // Verify that we have the correct size... |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4372 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4373 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4374 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4375 | itostr(NumElements) + ""); |
| 4376 | |
| 4377 | // Verify all elements are correct type! |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4378 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4379 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4380 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4381 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4382 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4383 | } |
| 4384 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4385 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4386 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4387 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4388 | ;} |
| 4389 | break; |
| 4390 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4391 | case 173: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4392 | #line 1626 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4393 | { |
| 4394 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4395 | if (STy == 0) |
| 4396 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4397 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4398 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4399 | if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4400 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4401 | |
| 4402 | // Check to ensure that constants are compatible with the type initializer! |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4403 | for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) |
| 4404 | if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4405 | GEN_ERROR("Expected type '" + |
| 4406 | STy->getElementType(i)->getDescription() + |
| 4407 | "' for element #" + utostr(i) + |
| 4408 | " of structure initializer"); |
| 4409 | |
| 4410 | // Check to ensure that Type is not packed |
| 4411 | if (STy->isPacked()) |
| 4412 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4413 | STy->getDescription() + "'"); |
| 4414 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4415 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4416 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4417 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4418 | ;} |
| 4419 | break; |
| 4420 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4421 | case 174: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4422 | #line 1652 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4423 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4424 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4425 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4426 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4427 | if (STy == 0) |
| 4428 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4429 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4430 | |
| 4431 | if (STy->getNumContainedTypes() != 0) |
| 4432 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4439 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4440 | delete (yyvsp[(1) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4441 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4442 | ;} |
| 4443 | break; |
| 4444 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4445 | case 175: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4446 | #line 1672 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4447 | { |
| 4448 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4449 | if (STy == 0) |
| 4450 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4451 | (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4452 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4453 | if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4454 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4455 | |
| 4456 | // Check to ensure that constants are compatible with the type initializer! |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4457 | for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) |
| 4458 | if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4459 | GEN_ERROR("Expected type '" + |
| 4460 | STy->getElementType(i)->getDescription() + |
| 4461 | "' for element #" + utostr(i) + |
| 4462 | " of structure initializer"); |
| 4463 | |
| 4464 | // Check to ensure that Type is packed |
| 4465 | if (!STy->isPacked()) |
| 4466 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4467 | STy->getDescription() + "'"); |
| 4468 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4469 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector)); |
| 4470 | delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4471 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4472 | ;} |
| 4473 | break; |
| 4474 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4475 | case 176: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4476 | #line 1698 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4477 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4478 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4479 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); |
| 4480 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4481 | if (STy == 0) |
| 4482 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4483 | (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4484 | |
| 4485 | if (STy->getNumContainedTypes() != 0) |
| 4486 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 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 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4493 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4494 | delete (yyvsp[(1) - (5)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4495 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4496 | ;} |
| 4497 | break; |
| 4498 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4499 | case 177: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4500 | #line 1718 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4501 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4502 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4503 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4504 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4505 | if (PTy == 0) |
| 4506 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4507 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4508 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4509 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4510 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4511 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4512 | ;} |
| 4513 | break; |
| 4514 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4515 | case 178: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4516 | #line 1730 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4517 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4518 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4519 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4520 | (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); |
| 4521 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4522 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4523 | ;} |
| 4524 | break; |
| 4525 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4526 | case 179: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4527 | #line 1737 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4528 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4529 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4530 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4531 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4532 | if (Ty == 0) |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 4533 | 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] | 4534 | |
| 4535 | // ConstExprs can exist in the body of a function, thus creating |
| 4536 | // GlobalValues whenever they refer to a variable. Because we are in |
| 4537 | // the context of a function, getExistingVal will search the functions |
| 4538 | // symbol table instead of the module symbol table for the global symbol, |
| 4539 | // which throws things all off. To get around this, we just tell |
| 4540 | // getExistingVal that we are at global scope here. |
| 4541 | // |
| 4542 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4543 | CurFun.CurrentFunction = 0; |
| 4544 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4545 | Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4546 | CHECK_FOR_ERROR |
| 4547 | |
| 4548 | CurFun.CurrentFunction = SavedCurFn; |
| 4549 | |
| 4550 | // If this is an initializer for a constant pointer, which is referencing a |
| 4551 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4552 | // in the future with the right type of variable. |
| 4553 | // |
| 4554 | if (V == 0) { |
| 4555 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 4556 | const PointerType *PT = cast<PointerType>(Ty); |
| 4557 | |
| 4558 | // First check to see if the forward references value is already created! |
| 4559 | PerModuleInfo::GlobalRefsType::iterator I = |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4560 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4561 | |
| 4562 | if (I != CurModule.GlobalRefs.end()) { |
| 4563 | V = I->second; // Placeholder already exists, use it... |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4564 | (yyvsp[(2) - (2)].ValIDVal).destroy(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4565 | } else { |
| 4566 | std::string Name; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4567 | if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName) |
| 4568 | Name = (yyvsp[(2) - (2)].ValIDVal).getName(); |
| 4569 | else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4570 | GEN_ERROR("Invalid reference to global"); |
| 4571 | |
| 4572 | // Create the forward referenced global. |
| 4573 | GlobalValue *GV; |
| 4574 | if (const FunctionType *FTy = |
| 4575 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 4576 | GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name, |
| 4577 | CurModule.CurrentModule); |
| 4578 | } else { |
| 4579 | GV = new GlobalVariable(PT->getElementType(), false, |
| 4580 | GlobalValue::ExternalWeakLinkage, 0, |
| 4581 | Name, CurModule.CurrentModule); |
| 4582 | } |
| 4583 | |
| 4584 | // Keep track of the fact that we have a forward ref to recycle it |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4585 | 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] | 4586 | V = GV; |
| 4587 | } |
| 4588 | } |
| 4589 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4590 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4591 | delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4592 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4593 | ;} |
| 4594 | break; |
| 4595 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4596 | case 180: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4597 | #line 1803 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4598 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4599 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4600 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4601 | if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4602 | GEN_ERROR("Mismatched types for constant expression: " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4603 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription()); |
| 4604 | (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); |
| 4605 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4606 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4607 | ;} |
| 4608 | break; |
| 4609 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4610 | case 181: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4611 | #line 1813 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4612 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4613 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4614 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4615 | const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4616 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4617 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4618 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4619 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4620 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4621 | ;} |
| 4622 | break; |
| 4623 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4624 | case 182: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4625 | #line 1823 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4626 | { // integral constants |
| 4627 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4628 | GEN_ERROR("Constant value doesn't fit in type"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4629 | (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] | 4630 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4631 | ;} |
| 4632 | break; |
| 4633 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4634 | case 183: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4635 | #line 1829 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4636 | { // arbitrary precision integer constants |
| 4637 | uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); |
| 4638 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4639 | GEN_ERROR("Constant value does not fit in type"); |
| 4640 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4641 | (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth); |
| 4642 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4643 | delete (yyvsp[(2) - (2)].APIntVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4644 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4645 | ;} |
| 4646 | break; |
| 4647 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4648 | case 184: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4649 | #line 1839 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4650 | { // integral constants |
| 4651 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4652 | GEN_ERROR("Constant value doesn't fit in type"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4653 | (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] | 4654 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4655 | ;} |
| 4656 | break; |
| 4657 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4658 | case 185: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4659 | #line 1845 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4665 | (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(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 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4669 | ;} |
| 4670 | break; |
| 4671 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4672 | case 186: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4673 | #line 1855 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4674 | { // Boolean constants |
| 4675 | assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4676 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4677 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4678 | ;} |
| 4679 | break; |
| 4680 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4681 | case 187: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4682 | #line 1860 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4683 | { // Boolean constants |
| 4684 | assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4685 | (yyval.ConstVal) = ConstantInt::getFalse(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4686 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4687 | ;} |
| 4688 | break; |
| 4689 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4690 | case 188: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4691 | #line 1865 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4692 | { // Floating point constants |
| 4693 | if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4694 | GEN_ERROR("Floating point constant invalid for type"); |
Dale Johannesen | 255b8fe | 2007-09-11 18:33:39 +0000 | [diff] [blame] | 4695 | // Lexer has no type info, so builds all float and double FP constants |
| 4696 | // as double. Fix this here. Long double is done right. |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4697 | if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy) |
| 4698 | (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
| 4699 | (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)); |
| 4700 | delete (yyvsp[(2) - (2)].FPVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4701 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4702 | ;} |
| 4703 | break; |
| 4704 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4705 | case 189: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4706 | #line 1878 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4707 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4708 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4709 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); |
| 4710 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 4711 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 4712 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4713 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4714 | Val->getType()->getDescription() + "' to '" + |
| 4715 | DestTy->getDescription() + "'"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4716 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
| 4717 | delete (yyvsp[(5) - (6)].TypeVal); |
| 4718 | ;} |
| 4719 | break; |
| 4720 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4721 | case 190: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4722 | #line 1890 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4723 | { |
| 4724 | if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4725 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
| 4726 | |
| 4727 | const Type *IdxTy = |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4728 | 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] | 4729 | true); |
| 4730 | if (!IdxTy) |
| 4731 | GEN_ERROR("Index list invalid for constant getelementptr"); |
| 4732 | |
| 4733 | SmallVector<Constant*, 8> IdxVec; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4734 | for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) |
| 4735 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4736 | IdxVec.push_back(C); |
| 4737 | else |
| 4738 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
| 4739 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4740 | delete (yyvsp[(4) - (5)].ValueList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4741 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4742 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4743 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4744 | ;} |
| 4745 | break; |
| 4746 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4747 | case 191: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4748 | #line 1912 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4749 | { |
| 4750 | if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4751 | GEN_ERROR("Select condition must be of boolean type"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4752 | if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4753 | GEN_ERROR("Select operand types must match"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4754 | (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] | 4755 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4756 | ;} |
| 4757 | break; |
| 4758 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4759 | case 192: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4760 | #line 1920 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4761 | { |
| 4762 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4763 | GEN_ERROR("Binary operator types must match"); |
| 4764 | CHECK_FOR_ERROR; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4765 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
| 4766 | ;} |
| 4767 | break; |
| 4768 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4769 | case 193: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4770 | #line 1926 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4771 | { |
| 4772 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4773 | GEN_ERROR("Logical operator types must match"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4774 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) { |
| 4775 | if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) || |
| 4776 | !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4777 | GEN_ERROR("Logical operator requires integral operands"); |
| 4778 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4779 | (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] | 4780 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4781 | ;} |
| 4782 | break; |
| 4783 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4784 | case 194: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4785 | #line 1937 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4786 | { |
| 4787 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4788 | GEN_ERROR("icmp operand types must match"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4789 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4790 | ;} |
| 4791 | break; |
| 4792 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4793 | case 195: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4794 | #line 1942 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4795 | { |
| 4796 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4797 | GEN_ERROR("fcmp operand types must match"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4798 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4799 | ;} |
| 4800 | break; |
| 4801 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4802 | case 196: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4803 | #line 1947 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4804 | { |
| 4805 | if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4806 | GEN_ERROR("Invalid extractelement operands"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4807 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4808 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4809 | ;} |
| 4810 | break; |
| 4811 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4812 | case 197: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4813 | #line 1953 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4814 | { |
| 4815 | 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] | 4816 | GEN_ERROR("Invalid insertelement operands"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4817 | (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] | 4818 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4819 | ;} |
| 4820 | break; |
| 4821 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4822 | case 198: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4823 | #line 1959 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4824 | { |
| 4825 | 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] | 4826 | GEN_ERROR("Invalid shufflevector operands"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4827 | (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] | 4828 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4829 | ;} |
| 4830 | break; |
| 4831 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4832 | case 199: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4833 | #line 1968 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4834 | { |
| 4835 | ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4836 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4837 | ;} |
| 4838 | break; |
| 4839 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4840 | case 200: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4841 | #line 1972 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4842 | { |
| 4843 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4844 | (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4845 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4846 | ;} |
| 4847 | break; |
| 4848 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4849 | case 201: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4850 | #line 1980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4851 | { (yyval.BoolVal) = false; ;} |
| 4852 | break; |
| 4853 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4854 | case 202: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4855 | #line 1980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4856 | { (yyval.BoolVal) = true; ;} |
| 4857 | break; |
| 4858 | |
| 4859 | case 203: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4860 | #line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4861 | { (yyval.BoolVal) = true; ;} |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4862 | break; |
| 4863 | |
| 4864 | case 204: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4865 | #line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4866 | { (yyval.BoolVal) = false; ;} |
| 4867 | break; |
| 4868 | |
| 4869 | case 205: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4870 | #line 1986 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4871 | { |
| 4872 | const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); |
| 4873 | Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); |
Chris Lattner | bb856a3 | 2007-08-06 21:00:46 +0000 | [diff] [blame] | 4874 | CHECK_FOR_ERROR |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4875 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 4876 | if (!Aliasee) |
| 4877 | GEN_ERROR("Aliases can be created only to global values"); |
| 4878 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4879 | (yyval.ConstVal) = Aliasee; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4880 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4881 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4882 | ;} |
| 4883 | break; |
| 4884 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4885 | case 206: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4886 | #line 1998 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4887 | { |
| 4888 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 4889 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 4890 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4891 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4892 | Val->getType()->getDescription() + "' to '" + |
| 4893 | DestTy->getDescription() + "'"); |
| 4894 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4895 | (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] | 4896 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4897 | delete (yyvsp[(5) - (6)].TypeVal); |
| 4898 | ;} |
| 4899 | break; |
| 4900 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4901 | case 207: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4902 | #line 2019 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4903 | { |
| 4904 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4905 | CurModule.ModuleDone(); |
| 4906 | CHECK_FOR_ERROR; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4907 | ;} |
| 4908 | break; |
| 4909 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4910 | case 208: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4911 | #line 2024 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4912 | { |
| 4913 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 4914 | CurModule.ModuleDone(); |
| 4915 | CHECK_FOR_ERROR; |
| 4916 | ;} |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4917 | break; |
| 4918 | |
| 4919 | case 211: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4920 | #line 2037 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4921 | { CurFun.isDeclare = false; ;} |
| 4922 | break; |
| 4923 | |
| 4924 | case 212: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4925 | #line 2037 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4926 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4927 | CurFun.FunctionDone(); |
| 4928 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4929 | ;} |
| 4930 | break; |
| 4931 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4932 | case 213: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4933 | #line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4934 | { CurFun.isDeclare = true; ;} |
| 4935 | break; |
| 4936 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4937 | case 214: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4938 | #line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4939 | { |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4940 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4941 | ;} |
| 4942 | break; |
| 4943 | |
| 4944 | case 215: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4945 | #line 2044 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4946 | { |
| 4947 | CHECK_FOR_ERROR |
| 4948 | ;} |
| 4949 | break; |
| 4950 | |
| 4951 | case 216: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4952 | #line 2047 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4953 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4954 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4955 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4956 | // Eagerly resolve types. This is not an optimization, this is a |
| 4957 | // requirement that is due to the fact that we could have this: |
| 4958 | // |
| 4959 | // %list = type { %list * } |
| 4960 | // %list = type { %list * } ; repeated type decl |
| 4961 | // |
| 4962 | // If types are not resolved eagerly, then the two types will not be |
| 4963 | // determined to be the same type! |
| 4964 | // |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4965 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4966 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4967 | 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] | 4968 | CHECK_FOR_ERROR |
| 4969 | // If this is a named type that is not a redefinition, add it to the slot |
| 4970 | // table. |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4971 | CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4972 | } |
| 4973 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4974 | delete (yyvsp[(3) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4975 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4976 | ;} |
| 4977 | break; |
Reid Spencer | aa8ae28 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4978 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4979 | case 217: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4980 | #line 2071 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4981 | { |
| 4982 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); |
| 4983 | |
| 4984 | 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] | 4985 | CHECK_FOR_ERROR |
| 4986 | // If this is a named type that is not a redefinition, add it to the slot |
| 4987 | // table. |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4988 | CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4989 | } |
| 4990 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4991 | ;} |
| 4992 | break; |
| 4993 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4994 | case 218: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 4995 | #line 2083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4996 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4997 | /* "Externally Visible" Linkage */ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 4998 | if ((yyvsp[(5) - (6)].ConstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4999 | GEN_ERROR("Global value initializer is not a constant"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5000 | CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage, |
| 5001 | (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] | 5002 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5003 | ;} |
| 5004 | break; |
| 5005 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5006 | case 219: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5007 | #line 2090 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5008 | { |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5009 | CurGV = 0; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5010 | ;} |
| 5011 | break; |
| 5012 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5013 | case 220: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5014 | #line 2094 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5015 | { |
| 5016 | if ((yyvsp[(6) - (7)].ConstVal) == 0) |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5017 | GEN_ERROR("Global value initializer is not a constant"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5018 | 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] | 5019 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5020 | ;} |
| 5021 | break; |
| 5022 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5023 | case 221: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5024 | #line 2099 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5025 | { |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5026 | CurGV = 0; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5027 | ;} |
| 5028 | break; |
| 5029 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5030 | case 222: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5031 | #line 2103 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5032 | { |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5033 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5034 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); |
| 5035 | 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] | 5036 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5037 | delete (yyvsp[(6) - (7)].TypeVal); |
| 5038 | ;} |
| 5039 | break; |
| 5040 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5041 | case 223: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5042 | #line 2109 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5043 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5044 | CurGV = 0; |
| 5045 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5046 | ;} |
| 5047 | break; |
| 5048 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5049 | case 224: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5050 | #line 2113 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5051 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5052 | std::string Name; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5053 | if ((yyvsp[(1) - (5)].StrVal)) { |
| 5054 | Name = *(yyvsp[(1) - (5)].StrVal); |
| 5055 | delete (yyvsp[(1) - (5)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5056 | } |
| 5057 | if (Name.empty()) |
| 5058 | GEN_ERROR("Alias name cannot be empty"); |
| 5059 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5060 | Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5061 | if (Aliasee == 0) |
| 5062 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
| 5063 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5064 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5065 | CurModule.CurrentModule); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5066 | GA->setVisibility((yyvsp[(2) - (5)].Visibility)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5067 | InsertValue(GA, CurModule.Values); |
Chris Lattner | 5eefce3 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5068 | |
| 5069 | |
| 5070 | // If there was a forward reference of this alias, resolve it now. |
| 5071 | |
| 5072 | ValID ID; |
| 5073 | if (!Name.empty()) |
| 5074 | ID = ValID::createGlobalName(Name); |
| 5075 | else |
| 5076 | ID = ValID::createGlobalID(CurModule.Values.size()-1); |
| 5077 | |
| 5078 | if (GlobalValue *FWGV = |
| 5079 | CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { |
| 5080 | // Replace uses of the fwdref with the actual alias. |
| 5081 | FWGV->replaceAllUsesWith(GA); |
| 5082 | if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV)) |
| 5083 | GV->eraseFromParent(); |
| 5084 | else |
| 5085 | cast<Function>(FWGV)->eraseFromParent(); |
| 5086 | } |
| 5087 | ID.destroy(); |
| 5088 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5089 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5090 | ;} |
| 5091 | break; |
| 5092 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5093 | case 225: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5094 | #line 2153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5095 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5096 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5097 | ;} |
| 5098 | break; |
| 5099 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5100 | case 226: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5101 | #line 2156 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5102 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5103 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5104 | ;} |
| 5105 | break; |
| 5106 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5107 | case 227: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5108 | #line 2162 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5109 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5110 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
| 5111 | if (AsmSoFar.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5112 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5113 | else |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5114 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal)); |
| 5115 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5116 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5117 | ;} |
| 5118 | break; |
| 5119 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5120 | case 228: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5121 | #line 2172 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5122 | { |
| 5123 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); |
| 5124 | delete (yyvsp[(3) - (3)].StrVal); |
| 5125 | ;} |
| 5126 | break; |
| 5127 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5128 | case 229: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5129 | #line 2176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5130 | { |
| 5131 | CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); |
| 5132 | delete (yyvsp[(3) - (3)].StrVal); |
| 5133 | ;} |
| 5134 | break; |
| 5135 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5136 | case 231: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5137 | #line 2183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5138 | { |
| 5139 | CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); |
| 5140 | delete (yyvsp[(3) - (3)].StrVal); |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5141 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5142 | ;} |
| 5143 | break; |
| 5144 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5145 | case 232: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5146 | #line 2188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5147 | { |
| 5148 | CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); |
| 5149 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 4747002 | 2007-07-31 14:41:17 +0000 | [diff] [blame] | 5150 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5151 | ;} |
| 5152 | break; |
| 5153 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5154 | case 233: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5155 | #line 2193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5156 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5157 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5158 | ;} |
| 5159 | break; |
| 5160 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5161 | case 234: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5162 | #line 2202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5163 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5164 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5165 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 5166 | if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5167 | GEN_ERROR("void typed arguments are invalid"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5168 | ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal); |
| 5169 | (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList); |
| 5170 | (yyvsp[(1) - (5)].ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5171 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5172 | ;} |
| 5173 | break; |
| 5174 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5175 | case 235: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5176 | #line 2212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5177 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5178 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5179 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 5180 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5181 | GEN_ERROR("void typed arguments are invalid"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5182 | ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal); |
| 5183 | (yyval.ArgList) = new ArgListType; |
| 5184 | (yyval.ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5185 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5186 | ;} |
| 5187 | break; |
| 5188 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5189 | case 236: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5190 | #line 2223 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5191 | { |
| 5192 | (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5193 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5194 | ;} |
| 5195 | break; |
| 5196 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5197 | case 237: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5198 | #line 2227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5199 | { |
| 5200 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5201 | struct ArgListEntry E; |
| 5202 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5203 | E.Name = 0; |
| 5204 | E.Attrs = ParamAttr::None; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5205 | (yyval.ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5206 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5207 | ;} |
| 5208 | break; |
| 5209 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5210 | case 238: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5211 | #line 2236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5212 | { |
| 5213 | (yyval.ArgList) = new ArgListType; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5214 | struct ArgListEntry E; |
| 5215 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5216 | E.Name = 0; |
| 5217 | E.Attrs = ParamAttr::None; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5218 | (yyval.ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5219 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5220 | ;} |
| 5221 | break; |
| 5222 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5223 | case 239: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5224 | #line 2245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5225 | { |
| 5226 | (yyval.ArgList) = 0; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5227 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5228 | ;} |
| 5229 | break; |
| 5230 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5231 | case 240: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5232 | #line 2251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5233 | { |
| 5234 | std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); |
| 5235 | delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5236 | |
| 5237 | // Check the function result for abstractness if this is a define. We should |
| 5238 | // have no abstract types at this point |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5239 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal))) |
| 5240 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5241 | |
| 5242 | std::vector<const Type*> ParamTypeList; |
| 5243 | ParamAttrsVector Attrs; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5244 | if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5245 | ParamAttrsWithIndex PAWI; |
| 5246 | PAWI.index = 0; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5247 | PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5248 | Attrs.push_back(PAWI); |
| 5249 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5250 | if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5251 | unsigned index = 1; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5252 | 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] | 5253 | const Type* Ty = I->Ty->get(); |
| 5254 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 5255 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
| 5256 | ParamTypeList.push_back(Ty); |
| 5257 | if (Ty != Type::VoidTy) |
| 5258 | if (I->Attrs != ParamAttr::None) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5259 | ParamAttrsWithIndex PAWI; |
| 5260 | PAWI.index = index; |
| 5261 | PAWI.attrs = I->Attrs; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5262 | Attrs.push_back(PAWI); |
| 5263 | } |
| 5264 | } |
| 5265 | } |
| 5266 | |
| 5267 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 5268 | if (isVarArg) ParamTypeList.pop_back(); |
| 5269 | |
Duncan Sands | 637ec55 | 2007-11-28 17:07:01 +0000 | [diff] [blame] | 5270 | const ParamAttrsList *PAL = 0; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5271 | if (!Attrs.empty()) |
| 5272 | PAL = ParamAttrsList::get(Attrs); |
| 5273 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5274 | FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg); |
Christopher Lamb | fb623c6 | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5275 | const PointerType *PFT = PointerType::getUnqual(FT); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5276 | delete (yyvsp[(2) - (10)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5277 | |
| 5278 | ValID ID; |
| 5279 | if (!FunctionName.empty()) { |
| 5280 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
| 5281 | } else { |
| 5282 | ID = ValID::createGlobalID(CurModule.Values.size()); |
| 5283 | } |
| 5284 | |
| 5285 | Function *Fn = 0; |
| 5286 | // See if this function was forward referenced. If so, recycle the object. |
| 5287 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 5288 | // Move the function to the end of the list, from whereever it was |
| 5289 | // previously inserted. |
| 5290 | Fn = cast<Function>(FWRef); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5291 | assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5292 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 5293 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 5294 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 5295 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5296 | if (Fn->getFunctionType() != FT ) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5297 | // The existing function doesn't have the same type. This is an overload |
| 5298 | // error. |
| 5299 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5300 | } else if (Fn->getParamAttrs() != PAL) { |
| 5301 | // The existing function doesn't have the same parameter attributes. |
| 5302 | // This is an overload error. |
| 5303 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5304 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
| 5305 | // Neither the existing or the current function is a declaration and they |
| 5306 | // have the same name and same type. Clearly this is a redefinition. |
| 5307 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5308 | } else if (Fn->isDeclaration()) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5309 | // Make sure to strip off any argument names so we can't get conflicts. |
| 5310 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 5311 | AI != AE; ++AI) |
| 5312 | AI->setName(""); |
| 5313 | } |
| 5314 | } else { // Not already defined? |
| 5315 | Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
| 5316 | CurModule.CurrentModule); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5317 | InsertValue(Fn, CurModule.Values); |
| 5318 | } |
| 5319 | |
| 5320 | CurFun.FunctionStart(Fn); |
| 5321 | |
| 5322 | if (CurFun.isDeclare) { |
| 5323 | // If we have declaration, always overwrite linkage. This will allow us to |
| 5324 | // correctly handle cases, when pointer to function is passed as argument to |
| 5325 | // another function. |
| 5326 | Fn->setLinkage(CurFun.Linkage); |
| 5327 | Fn->setVisibility(CurFun.Visibility); |
| 5328 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5329 | Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal)); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5330 | Fn->setParamAttrs(PAL); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5331 | Fn->setAlignment((yyvsp[(9) - (10)].UIntVal)); |
| 5332 | if ((yyvsp[(8) - (10)].StrVal)) { |
| 5333 | Fn->setSection(*(yyvsp[(8) - (10)].StrVal)); |
| 5334 | delete (yyvsp[(8) - (10)].StrVal); |
Gordon Henriksen | 13fe5e3 | 2007-12-10 03:18:06 +0000 | [diff] [blame] | 5335 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5336 | if ((yyvsp[(10) - (10)].StrVal)) { |
| 5337 | Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str()); |
| 5338 | delete (yyvsp[(10) - (10)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5339 | } |
| 5340 | |
| 5341 | // Add all of the arguments we parsed to the function... |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5342 | if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5343 | if (isVarArg) { // Nuke the last entry |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5344 | 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] | 5345 | "Not a varargs marker!"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5346 | delete (yyvsp[(5) - (10)].ArgList)->back().Ty; |
| 5347 | (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5348 | } |
| 5349 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
| 5350 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
| 5351 | unsigned Idx = 1; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5352 | for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); |
| 5353 | I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5354 | delete I->Ty; // Delete the typeholder... |
| 5355 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
| 5356 | CHECK_FOR_ERROR |
| 5357 | InsertValue(ArgIt); |
| 5358 | Idx++; |
| 5359 | } |
| 5360 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5361 | 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] | 5362 | } |
| 5363 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5364 | ;} |
| 5365 | break; |
| 5366 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5367 | case 243: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5368 | #line 2386 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5369 | { |
| 5370 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5371 | |
| 5372 | // Make sure that we keep track of the linkage type even if there was a |
| 5373 | // previous "declare". |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5374 | (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); |
| 5375 | (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility)); |
| 5376 | ;} |
| 5377 | break; |
| 5378 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5379 | case 246: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5380 | #line 2397 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5381 | { |
| 5382 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5383 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5384 | ;} |
| 5385 | break; |
| 5386 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5387 | case 247: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5388 | #line 2402 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5389 | { |
| 5390 | CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); |
| 5391 | CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); |
| 5392 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5393 | CurFun.FunctionDone(); |
| 5394 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5395 | ;} |
| 5396 | break; |
| 5397 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5398 | case 248: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5399 | #line 2414 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5400 | { |
| 5401 | (yyval.BoolVal) = false; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5402 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5403 | ;} |
| 5404 | break; |
| 5405 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5406 | case 249: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5407 | #line 2418 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5408 | { |
| 5409 | (yyval.BoolVal) = true; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5410 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5411 | ;} |
| 5412 | break; |
| 5413 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5414 | case 250: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5415 | #line 2423 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5416 | { // A reference to a direct constant |
| 5417 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5418 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5419 | ;} |
| 5420 | break; |
| 5421 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5422 | case 251: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5423 | #line 2427 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5424 | { |
| 5425 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5426 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5427 | ;} |
| 5428 | break; |
| 5429 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5430 | case 252: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5431 | #line 2431 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5432 | { // Perhaps it's an FP constant? |
| 5433 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5434 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5435 | ;} |
| 5436 | break; |
| 5437 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5438 | case 253: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5439 | #line 2435 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5440 | { |
| 5441 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5442 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5443 | ;} |
| 5444 | break; |
| 5445 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5446 | case 254: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5447 | #line 2439 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5448 | { |
| 5449 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5450 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5451 | ;} |
| 5452 | break; |
| 5453 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5454 | case 255: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5455 | #line 2443 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5456 | { |
| 5457 | (yyval.ValIDVal) = ValID::createNull(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5458 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5459 | ;} |
| 5460 | break; |
| 5461 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5462 | case 256: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5463 | #line 2447 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5464 | { |
| 5465 | (yyval.ValIDVal) = ValID::createUndef(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5466 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5467 | ;} |
| 5468 | break; |
| 5469 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5470 | case 257: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5471 | #line 2451 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5472 | { // A vector zero constant. |
| 5473 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5474 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5475 | ;} |
| 5476 | break; |
| 5477 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5478 | case 258: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5479 | #line 2455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5480 | { // Nonempty unsized packed vector |
| 5481 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
| 5482 | int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5483 | |
| 5484 | VectorType* pt = VectorType::get(ETy, NumElements); |
| 5485 | PATypeHolder* PTy = new PATypeHolder( |
| 5486 | HandleUpRefs( |
| 5487 | VectorType::get( |
| 5488 | ETy, |
| 5489 | NumElements) |
| 5490 | ) |
| 5491 | ); |
| 5492 | |
| 5493 | // Verify all elements are correct type! |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5494 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5495 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5496 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 5497 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5498 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5499 | } |
| 5500 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5501 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector))); |
| 5502 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5503 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5504 | ;} |
| 5505 | break; |
| 5506 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5507 | case 259: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5508 | #line 2480 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5509 | { |
| 5510 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5511 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5512 | ;} |
| 5513 | break; |
| 5514 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5515 | case 260: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5516 | #line 2484 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5517 | { |
| 5518 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); |
| 5519 | delete (yyvsp[(3) - (5)].StrVal); |
| 5520 | delete (yyvsp[(5) - (5)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5521 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5522 | ;} |
| 5523 | break; |
| 5524 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5525 | case 261: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5526 | #line 2494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5527 | { // Is it an integer reference...? |
| 5528 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5529 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5530 | ;} |
| 5531 | break; |
| 5532 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5533 | case 262: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5534 | #line 2498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5535 | { |
| 5536 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5537 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5538 | ;} |
| 5539 | break; |
| 5540 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5541 | case 263: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5542 | #line 2502 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5543 | { // Is it a named reference...? |
| 5544 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5545 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5546 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5547 | ;} |
| 5548 | break; |
| 5549 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5550 | case 264: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5551 | #line 2507 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5552 | { // Is it a named reference...? |
| 5553 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5554 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5555 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5556 | ;} |
| 5557 | break; |
| 5558 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5559 | case 267: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5560 | #line 2520 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5561 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5562 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5563 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 5564 | (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); |
| 5565 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5566 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5567 | ;} |
| 5568 | break; |
| 5569 | |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5570 | case 268: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5571 | #line 2529 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5572 | { |
| 5573 | (yyval.ValueList) = new std::vector<Value *>(); |
| 5574 | (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); |
| 5575 | CHECK_FOR_ERROR |
| 5576 | ;} |
| 5577 | break; |
| 5578 | |
| 5579 | case 269: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5580 | #line 2534 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5581 | { |
| 5582 | ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ConstVal)); |
| 5583 | CHECK_FOR_ERROR |
| 5584 | ;} |
| 5585 | break; |
| 5586 | |
| 5587 | case 270: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5588 | #line 2539 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5589 | { |
| 5590 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5591 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5592 | ;} |
| 5593 | break; |
| 5594 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5595 | case 271: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5596 | #line 2543 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5597 | { // Do not allow functions with 0 basic blocks |
| 5598 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5599 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5600 | ;} |
| 5601 | break; |
| 5602 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5603 | case 272: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5604 | #line 2552 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5605 | { |
| 5606 | setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5607 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5608 | InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 5609 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 5610 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5611 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5612 | ;} |
| 5613 | break; |
| 5614 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5615 | case 273: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5616 | #line 2561 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5617 | { |
| 5618 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5619 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 5620 | if (CI2->getParent() == 0) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5621 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); |
| 5622 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); |
| 5623 | (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5624 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5625 | ;} |
| 5626 | break; |
| 5627 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5628 | case 274: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5629 | #line 2570 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5630 | { // Empty space between instruction lists |
| 5631 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5632 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5633 | ;} |
| 5634 | break; |
| 5635 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5636 | case 275: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5637 | #line 2574 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5638 | { // Labelled (named) basic block |
| 5639 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); |
| 5640 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5641 | CHECK_FOR_ERROR |
| 5642 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5643 | ;} |
| 5644 | break; |
Reid Spencer | aa8ae28 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5645 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5646 | case 276: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5647 | #line 2582 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5648 | { // Return with a result... |
| 5649 | if((yyvsp[(2) - (2)].ValueList)->size() == 1) |
| 5650 | (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueList)->back()); |
| 5651 | else { |
| 5652 | |
| 5653 | std::vector<const Type*> Elements; |
| 5654 | std::vector<Constant*> Vals; |
| 5655 | for (std::vector<Value *>::iterator I = (yyvsp[(2) - (2)].ValueList)->begin(), |
| 5656 | E = (yyvsp[(2) - (2)].ValueList)->end(); I != E; ++I) { |
| 5657 | Value *V = *I; |
| 5658 | Constant *C = cast<Constant>(V); |
| 5659 | Elements.push_back(V->getType()); |
| 5660 | Vals.push_back(C); |
| 5661 | } |
| 5662 | |
| 5663 | const StructType *STy = StructType::get(Elements); |
| 5664 | PATypeHolder *PTy = |
| 5665 | new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 5666 | |
| 5667 | Constant *CS = ConstantStruct::get(STy, Vals); // *$2); |
| 5668 | (yyval.TermInstVal) = new ReturnInst(CS); |
| 5669 | delete PTy; |
| 5670 | } |
| 5671 | delete (yyvsp[(2) - (2)].ValueList); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5672 | CHECK_FOR_ERROR |
| 5673 | ;} |
| 5674 | break; |
| 5675 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5676 | case 277: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5677 | #line 2608 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5678 | { // Return with no result... |
| 5679 | (yyval.TermInstVal) = new ReturnInst(); |
| 5680 | CHECK_FOR_ERROR |
| 5681 | ;} |
| 5682 | break; |
| 5683 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5684 | case 278: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5685 | #line 2612 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5686 | { // Unconditional Branch... |
| 5687 | BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); |
| 5688 | CHECK_FOR_ERROR |
| 5689 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 5690 | ;} |
| 5691 | break; |
| 5692 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5693 | case 279: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5694 | #line 2617 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5695 | { |
| 5696 | assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 5697 | BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 5698 | CHECK_FOR_ERROR |
| 5699 | BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); |
| 5700 | CHECK_FOR_ERROR |
| 5701 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); |
| 5702 | CHECK_FOR_ERROR |
| 5703 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 5704 | ;} |
| 5705 | break; |
| 5706 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5707 | case 280: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5708 | #line 2627 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5709 | { |
| 5710 | Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); |
| 5711 | CHECK_FOR_ERROR |
| 5712 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 5713 | CHECK_FOR_ERROR |
| 5714 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); |
| 5715 | (yyval.TermInstVal) = S; |
| 5716 | |
| 5717 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), |
| 5718 | E = (yyvsp[(8) - (9)].JumpTable)->end(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5719 | for (; I != E; ++I) { |
| 5720 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5721 | S->addCase(CI, I->second); |
| 5722 | else |
| 5723 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
| 5724 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5725 | delete (yyvsp[(8) - (9)].JumpTable); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5726 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5727 | ;} |
| 5728 | break; |
| 5729 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5730 | case 281: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5731 | #line 2646 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5732 | { |
| 5733 | Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5734 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5735 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5736 | CHECK_FOR_ERROR |
| 5737 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5738 | (yyval.TermInstVal) = S; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5739 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5740 | ;} |
| 5741 | break; |
| 5742 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5743 | case 282: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5744 | #line 2656 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5745 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5746 | |
| 5747 | // Handle the short syntax |
| 5748 | const PointerType *PFTy = 0; |
| 5749 | const FunctionType *Ty = 0; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5750 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) || |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5751 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5752 | // Pull out the types of all of the arguments... |
| 5753 | std::vector<const Type*> ParamTypes; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5754 | 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] | 5755 | for (; I != E; ++I) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5756 | const Type *Ty = I->Val->getType(); |
| 5757 | if (Ty == Type::VoidTy) |
| 5758 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5759 | ParamTypes.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5760 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5761 | Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | fb623c6 | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5762 | PFTy = PointerType::getUnqual(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5763 | } |
| 5764 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5765 | delete (yyvsp[(3) - (14)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5766 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5767 | 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] | 5768 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5769 | BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5770 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5771 | BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5772 | CHECK_FOR_ERROR |
| 5773 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5774 | ParamAttrsVector Attrs; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5775 | if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) { |
| 5776 | ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5777 | Attrs.push_back(PAWI); |
| 5778 | } |
| 5779 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5780 | // Check the arguments |
| 5781 | ValueList Args; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5782 | if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments? |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5783 | // Make sure no arguments is a good thing! |
| 5784 | if (Ty->getNumParams() != 0) |
| 5785 | GEN_ERROR("No arguments passed to a function that " |
| 5786 | "expects arguments"); |
| 5787 | } else { // Has arguments? |
| 5788 | // Loop through FunctionType's arguments and ensure they are specified |
| 5789 | // correctly! |
| 5790 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5791 | FunctionType::param_iterator E = Ty->param_end(); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5792 | 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] | 5793 | unsigned index = 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5794 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5795 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5796 | if (ArgI->Val->getType() != *I) |
| 5797 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
| 5798 | (*I)->getDescription() + "'"); |
| 5799 | Args.push_back(ArgI->Val); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5800 | if (ArgI->Attrs != ParamAttr::None) { |
| 5801 | ParamAttrsWithIndex PAWI; |
| 5802 | PAWI.index = index; |
| 5803 | PAWI.attrs = ArgI->Attrs; |
| 5804 | Attrs.push_back(PAWI); |
| 5805 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5806 | } |
| 5807 | |
| 5808 | if (Ty->isVarArg()) { |
| 5809 | if (I == E) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5810 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5811 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5812 | if (ArgI->Attrs != ParamAttr::None) { |
| 5813 | ParamAttrsWithIndex PAWI; |
| 5814 | PAWI.index = index; |
| 5815 | PAWI.attrs = ArgI->Attrs; |
| 5816 | Attrs.push_back(PAWI); |
| 5817 | } |
| 5818 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5819 | } else if (I != E || ArgI != ArgE) |
| 5820 | GEN_ERROR("Invalid number of parameters detected"); |
| 5821 | } |
| 5822 | |
Duncan Sands | 637ec55 | 2007-11-28 17:07:01 +0000 | [diff] [blame] | 5823 | const ParamAttrsList *PAL = 0; |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5824 | if (!Attrs.empty()) |
| 5825 | PAL = ParamAttrsList::get(Attrs); |
| 5826 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5827 | // Create the InvokeInst |
Chris Lattner | d140ada | 2007-08-29 16:15:23 +0000 | [diff] [blame] | 5828 | InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5829 | II->setCallingConv((yyvsp[(2) - (14)].UIntVal)); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5830 | II->setParamAttrs(PAL); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5831 | (yyval.TermInstVal) = II; |
| 5832 | delete (yyvsp[(6) - (14)].ParamList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5833 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5834 | ;} |
| 5835 | break; |
| 5836 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5837 | case 283: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5838 | #line 2746 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5839 | { |
| 5840 | (yyval.TermInstVal) = new UnwindInst(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5841 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5842 | ;} |
| 5843 | break; |
| 5844 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5845 | case 284: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5846 | #line 2750 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5847 | { |
| 5848 | (yyval.TermInstVal) = new UnreachableInst(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5849 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5850 | ;} |
| 5851 | break; |
| 5852 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5853 | case 285: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5854 | #line 2757 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5855 | { |
| 5856 | (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); |
| 5857 | 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] | 5858 | CHECK_FOR_ERROR |
| 5859 | if (V == 0) |
| 5860 | GEN_ERROR("May only switch on a constant pool value"); |
| 5861 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5862 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5863 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5864 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5865 | ;} |
| 5866 | break; |
| 5867 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5868 | case 286: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5869 | #line 2768 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5870 | { |
| 5871 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5872 | 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] | 5873 | CHECK_FOR_ERROR |
| 5874 | |
| 5875 | if (V == 0) |
| 5876 | GEN_ERROR("May only switch on a constant pool value"); |
| 5877 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5878 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5879 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5880 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5881 | ;} |
| 5882 | break; |
| 5883 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5884 | case 287: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5885 | #line 2781 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5886 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5887 | // Is this definition named?? if so, assign the name... |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5888 | setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5889 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5890 | InsertValue((yyvsp[(2) - (2)].InstVal)); |
| 5891 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5892 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5893 | ;} |
| 5894 | break; |
| 5895 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5896 | case 288: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5897 | #line 2791 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5898 | { // Used for PHI nodes |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5899 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5900 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); |
| 5901 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5902 | Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5903 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5904 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5905 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5906 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5907 | delete (yyvsp[(1) - (6)].TypeVal); |
| 5908 | ;} |
| 5909 | break; |
| 5910 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5911 | case 289: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5912 | #line 2802 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5913 | { |
| 5914 | (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); |
| 5915 | 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] | 5916 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5917 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5918 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5919 | (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5920 | ;} |
| 5921 | break; |
| 5922 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5923 | case 290: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5924 | #line 2812 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5925 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5926 | // 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] | 5927 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5928 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5929 | // Used for call and invoke instructions |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5930 | (yyval.ParamList) = new ParamList(); |
| 5931 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal)); |
| 5932 | (yyval.ParamList)->push_back(E); |
| 5933 | delete (yyvsp[(1) - (4)].TypeVal); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5934 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5935 | ;} |
| 5936 | break; |
| 5937 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5938 | case 291: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5939 | #line 2823 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5940 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5941 | // 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] | 5942 | // Labels are only valid in ASMs |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5943 | (yyval.ParamList) = new ParamList(); |
| 5944 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal)); |
| 5945 | (yyval.ParamList)->push_back(E); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5946 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5947 | ;} |
| 5948 | break; |
| 5949 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5950 | case 292: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5951 | #line 2831 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +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 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5954 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5955 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 5956 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 5957 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal)); |
| 5958 | (yyval.ParamList)->push_back(E); |
| 5959 | delete (yyvsp[(3) - (6)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5960 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5961 | ;} |
| 5962 | break; |
| 5963 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5964 | case 293: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5965 | #line 2841 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5966 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5967 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5968 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 5969 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
| 5970 | (yyval.ParamList)->push_back(E); |
Dale Johannesen | cfb19e6 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 5971 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5972 | ;} |
| 5973 | break; |
| 5974 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5975 | case 294: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5976 | #line 2848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5977 | { (yyval.ParamList) = new ParamList(); ;} |
| 5978 | break; |
| 5979 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5980 | case 295: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5981 | #line 2851 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5982 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5983 | break; |
| 5984 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5985 | case 296: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5986 | #line 2852 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5987 | { |
| 5988 | (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); |
| 5989 | (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5990 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5991 | ;} |
| 5992 | break; |
| 5993 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5994 | case 297: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 5995 | #line 2859 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5996 | { |
| 5997 | (yyval.BoolVal) = true; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5998 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5999 | ;} |
| 6000 | break; |
| 6001 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6002 | case 298: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6003 | #line 2863 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6004 | { |
| 6005 | (yyval.BoolVal) = false; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6006 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6007 | ;} |
| 6008 | break; |
| 6009 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6010 | case 299: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6011 | #line 2868 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6012 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6013 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6014 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6015 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && |
| 6016 | !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6017 | GEN_ERROR( |
| 6018 | "Arithmetic operator requires integer, FP, or packed operands"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6019 | Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6020 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6021 | Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6022 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6023 | (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); |
| 6024 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6025 | GEN_ERROR("binary operator returned null"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6026 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6027 | ;} |
| 6028 | break; |
| 6029 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6030 | case 300: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6031 | #line 2884 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6032 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6033 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6034 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6035 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) { |
| 6036 | if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) || |
| 6037 | !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6038 | GEN_ERROR("Logical operator requires integral operands"); |
| 6039 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6040 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6041 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6042 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6043 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6044 | (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
| 6045 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6046 | GEN_ERROR("binary operator returned null"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6047 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6048 | ;} |
| 6049 | break; |
| 6050 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6051 | case 301: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6052 | #line 2901 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6053 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6054 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6055 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6056 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6057 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6058 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6059 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6060 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6061 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6062 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); |
| 6063 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6064 | GEN_ERROR("icmp operator returned null"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6065 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6066 | ;} |
| 6067 | break; |
| 6068 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6069 | case 302: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6070 | #line 2915 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6071 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6072 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6073 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6074 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6075 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6076 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6077 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6078 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6079 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6080 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); |
| 6081 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6082 | GEN_ERROR("fcmp operator returned null"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6083 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6084 | ;} |
| 6085 | break; |
| 6086 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6087 | case 303: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6088 | #line 2929 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6089 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6090 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6091 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6092 | Value* Val = (yyvsp[(2) - (4)].ValueVal); |
| 6093 | const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get(); |
| 6094 | if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6095 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 6096 | Val->getType()->getDescription() + "' to '" + |
| 6097 | DestTy->getDescription() + "'"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6098 | (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy); |
| 6099 | delete (yyvsp[(4) - (4)].TypeVal); |
| 6100 | ;} |
| 6101 | break; |
| 6102 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6103 | case 304: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6104 | #line 2941 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6105 | { |
| 6106 | if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6107 | GEN_ERROR("select condition must be boolean"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6108 | if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6109 | GEN_ERROR("select value types should match"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6110 | (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6111 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6112 | ;} |
| 6113 | break; |
| 6114 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6115 | case 305: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6116 | #line 2949 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6117 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6118 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6119 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6120 | (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); |
| 6121 | delete (yyvsp[(4) - (4)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6122 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6123 | ;} |
| 6124 | break; |
| 6125 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6126 | case 306: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6127 | #line 2956 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6128 | { |
| 6129 | if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6130 | GEN_ERROR("Invalid extractelement operands"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6131 | (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6132 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6133 | ;} |
| 6134 | break; |
| 6135 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6136 | case 307: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6137 | #line 2962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6138 | { |
| 6139 | 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] | 6140 | GEN_ERROR("Invalid insertelement operands"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6141 | (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6142 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6143 | ;} |
| 6144 | break; |
| 6145 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6146 | case 308: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6147 | #line 2968 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6148 | { |
| 6149 | 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] | 6150 | GEN_ERROR("Invalid shufflevector operands"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6151 | (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] | 6152 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6153 | ;} |
| 6154 | break; |
| 6155 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6156 | case 309: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6157 | #line 2974 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6158 | { |
| 6159 | const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6160 | if (!Ty->isFirstClassType()) |
| 6161 | GEN_ERROR("PHI node operands must be of first class type"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6162 | (yyval.InstVal) = new PHINode(Ty); |
| 6163 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); |
| 6164 | while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { |
| 6165 | if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6166 | GEN_ERROR("All elements of a PHI node must be of the same type"); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6167 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); |
| 6168 | (yyvsp[(2) - (2)].PHIList)->pop_front(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6169 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6170 | delete (yyvsp[(2) - (2)].PHIList); // Free the list... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6171 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6172 | ;} |
| 6173 | break; |
| 6174 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6175 | case 310: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6176 | #line 2990 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6177 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6178 | |
| 6179 | // Handle the short syntax |
| 6180 | const PointerType *PFTy = 0; |
| 6181 | const FunctionType *Ty = 0; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6182 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) || |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6183 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6184 | // Pull out the types of all of the arguments... |
| 6185 | std::vector<const Type*> ParamTypes; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6186 | 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] | 6187 | for (; I != E; ++I) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6188 | const Type *Ty = I->Val->getType(); |
| 6189 | if (Ty == Type::VoidTy) |
| 6190 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6191 | ParamTypes.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6192 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6193 | Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | fb623c6 | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6194 | PFTy = PointerType::getUnqual(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6195 | } |
| 6196 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6197 | 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] | 6198 | CHECK_FOR_ERROR |
| 6199 | |
| 6200 | // Check for call to invalid intrinsic to avoid crashing later. |
| 6201 | if (Function *theF = dyn_cast<Function>(V)) { |
| 6202 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
| 6203 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 6204 | !theF->getIntrinsicID(true)) |
| 6205 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 6206 | theF->getName() + "'"); |
| 6207 | } |
| 6208 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6209 | // Set up the ParamAttrs for the function |
| 6210 | ParamAttrsVector Attrs; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6211 | if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6212 | ParamAttrsWithIndex PAWI; |
| 6213 | PAWI.index = 0; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6214 | PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6215 | Attrs.push_back(PAWI); |
| 6216 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6217 | // Check the arguments |
| 6218 | ValueList Args; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6219 | if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments? |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6220 | // Make sure no arguments is a good thing! |
| 6221 | if (Ty->getNumParams() != 0) |
| 6222 | GEN_ERROR("No arguments passed to a function that " |
| 6223 | "expects arguments"); |
| 6224 | } else { // Has arguments? |
| 6225 | // Loop through FunctionType's arguments and ensure they are specified |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6226 | // correctly. Also, gather any parameter attributes. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6227 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6228 | FunctionType::param_iterator E = Ty->param_end(); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6229 | 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] | 6230 | unsigned index = 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6231 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6232 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6233 | if (ArgI->Val->getType() != *I) |
| 6234 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
| 6235 | (*I)->getDescription() + "'"); |
| 6236 | Args.push_back(ArgI->Val); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6237 | if (ArgI->Attrs != ParamAttr::None) { |
| 6238 | ParamAttrsWithIndex PAWI; |
| 6239 | PAWI.index = index; |
| 6240 | PAWI.attrs = ArgI->Attrs; |
| 6241 | Attrs.push_back(PAWI); |
| 6242 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6243 | } |
| 6244 | if (Ty->isVarArg()) { |
| 6245 | if (I == E) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6246 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6247 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6248 | if (ArgI->Attrs != ParamAttr::None) { |
| 6249 | ParamAttrsWithIndex PAWI; |
| 6250 | PAWI.index = index; |
| 6251 | PAWI.attrs = ArgI->Attrs; |
| 6252 | Attrs.push_back(PAWI); |
| 6253 | } |
| 6254 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6255 | } else if (I != E || ArgI != ArgE) |
| 6256 | GEN_ERROR("Invalid number of parameters detected"); |
| 6257 | } |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6258 | |
| 6259 | // Finish off the ParamAttrs and check them |
Duncan Sands | 637ec55 | 2007-11-28 17:07:01 +0000 | [diff] [blame] | 6260 | const ParamAttrsList *PAL = 0; |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6261 | if (!Attrs.empty()) |
| 6262 | PAL = ParamAttrsList::get(Attrs); |
| 6263 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6264 | // Create the call node |
David Greene | 9145dd2 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 6265 | CallInst *CI = new CallInst(V, Args.begin(), Args.end()); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6266 | CI->setTailCall((yyvsp[(1) - (8)].BoolVal)); |
| 6267 | CI->setCallingConv((yyvsp[(2) - (8)].UIntVal)); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6268 | CI->setParamAttrs(PAL); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6269 | (yyval.InstVal) = CI; |
| 6270 | delete (yyvsp[(6) - (8)].ParamList); |
| 6271 | delete (yyvsp[(3) - (8)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6272 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6273 | ;} |
| 6274 | break; |
| 6275 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6276 | case 311: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6277 | #line 3087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6278 | { |
| 6279 | (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6280 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6281 | ;} |
| 6282 | break; |
| 6283 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6284 | case 312: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6285 | #line 3092 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6286 | { |
| 6287 | (yyval.BoolVal) = true; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6288 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6289 | ;} |
| 6290 | break; |
| 6291 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6292 | case 313: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6293 | #line 3096 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6294 | { |
| 6295 | (yyval.BoolVal) = false; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6296 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6297 | ;} |
| 6298 | break; |
| 6299 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6300 | case 314: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6301 | #line 3103 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6302 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6303 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6304 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6305 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6306 | delete (yyvsp[(2) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6307 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6308 | ;} |
| 6309 | break; |
| 6310 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6311 | case 315: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6312 | #line 3110 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6313 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6314 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6315 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
| 6316 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6317 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6318 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6319 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6320 | ;} |
| 6321 | break; |
| 6322 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6323 | case 316: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6324 | #line 3118 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6325 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6326 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6327 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6328 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6329 | delete (yyvsp[(2) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6330 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6331 | ;} |
| 6332 | break; |
| 6333 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6334 | case 317: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6335 | #line 3125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6336 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6337 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6338 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
| 6339 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6340 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6341 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6342 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6343 | ;} |
| 6344 | break; |
| 6345 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6346 | case 318: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6347 | #line 3133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6348 | { |
| 6349 | if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6350 | GEN_ERROR("Trying to free nonpointer type " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6351 | (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + ""); |
| 6352 | (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6353 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6354 | ;} |
| 6355 | break; |
| 6356 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6357 | case 319: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6358 | #line 3141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6359 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6360 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6361 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6362 | if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6363 | GEN_ERROR("Can't load from nonpointer type: " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6364 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6365 | if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6366 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6367 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6368 | Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6369 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6370 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal)); |
| 6371 | delete (yyvsp[(3) - (5)].TypeVal); |
| 6372 | ;} |
| 6373 | break; |
| 6374 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6375 | case 320: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6376 | #line 3155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6377 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6378 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6379 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
| 6380 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6381 | if (!PT) |
| 6382 | GEN_ERROR("Can't store to a nonpointer type: " + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6383 | (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6384 | const Type *ElTy = PT->getElementType(); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6385 | if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType()) |
| 6386 | GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6387 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 6388 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6389 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6390 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6391 | (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
| 6392 | delete (yyvsp[(5) - (7)].TypeVal); |
| 6393 | ;} |
| 6394 | break; |
| 6395 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6396 | case 321: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6397 | #line 3172 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6398 | { |
Devang Patel | b52f9e7 | 2008-02-22 19:31:30 +0000 | [diff] [blame] | 6399 | Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); |
Devang Patel | eb29334 | 2008-02-20 19:13:10 +0000 | [diff] [blame] | 6400 | if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6401 | GEN_ERROR("Invalid getresult operands"); |
Devang Patel | eb29334 | 2008-02-20 19:13:10 +0000 | [diff] [blame] | 6402 | (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val)); |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6403 | CHECK_FOR_ERROR |
| 6404 | ;} |
| 6405 | break; |
| 6406 | |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6407 | case 322: |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6408 | #line 3179 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6409 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6410 | if (!UpRefs.empty()) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6411 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 6412 | if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6413 | GEN_ERROR("getelementptr insn requires pointer operand"); |
| 6414 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6415 | 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] | 6416 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6417 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 6418 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6419 | CHECK_FOR_ERROR |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6420 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); |
| 6421 | delete (yyvsp[(2) - (4)].TypeVal); |
| 6422 | delete (yyvsp[(4) - (4)].ValueList); |
| 6423 | ;} |
| 6424 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6425 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6426 | |
| 6427 | /* Line 1267 of yacc.c. */ |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6428 | #line 6429 "llvmAsmParser.tab.c" |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6429 | default: break; |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6430 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6431 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 6432 | |
| 6433 | YYPOPSTACK (yylen); |
| 6434 | yylen = 0; |
| 6435 | YY_STACK_PRINT (yyss, yyssp); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6436 | |
| 6437 | *++yyvsp = yyval; |
| 6438 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6439 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6440 | /* Now `shift' the result of the reduction. Determine what state |
| 6441 | that goes to, based on the state we popped back to and the rule |
| 6442 | number reduced by. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6443 | |
| 6444 | yyn = yyr1[yyn]; |
| 6445 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6446 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 6447 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6448 | yystate = yytable[yystate]; |
| 6449 | else |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6450 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6451 | |
| 6452 | goto yynewstate; |
| 6453 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6454 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6455 | /*------------------------------------. |
| 6456 | | yyerrlab -- here on detecting error | |
| 6457 | `------------------------------------*/ |
| 6458 | yyerrlab: |
| 6459 | /* If not already recovering from an error, report this error. */ |
| 6460 | if (!yyerrstatus) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6461 | { |
| 6462 | ++yynerrs; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6463 | #if ! YYERROR_VERBOSE |
| 6464 | yyerror (YY_("syntax error")); |
| 6465 | #else |
| 6466 | { |
| 6467 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 6468 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 6469 | { |
| 6470 | YYSIZE_T yyalloc = 2 * yysize; |
| 6471 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 6472 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 6473 | if (yymsg != yymsgbuf) |
| 6474 | YYSTACK_FREE (yymsg); |
| 6475 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 6476 | if (yymsg) |
| 6477 | yymsg_alloc = yyalloc; |
| 6478 | else |
| 6479 | { |
| 6480 | yymsg = yymsgbuf; |
| 6481 | yymsg_alloc = sizeof yymsgbuf; |
| 6482 | } |
| 6483 | } |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6484 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6485 | if (0 < yysize && yysize <= yymsg_alloc) |
| 6486 | { |
| 6487 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 6488 | yyerror (yymsg); |
| 6489 | } |
| 6490 | else |
| 6491 | { |
| 6492 | yyerror (YY_("syntax error")); |
| 6493 | if (yysize != 0) |
| 6494 | goto yyexhaustedlab; |
| 6495 | } |
| 6496 | } |
| 6497 | #endif |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6498 | } |
| 6499 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6500 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6501 | |
| 6502 | if (yyerrstatus == 3) |
| 6503 | { |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6504 | /* If just tried and failed to reuse look-ahead token after an |
| 6505 | error, discard it. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6506 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6507 | if (yychar <= YYEOF) |
| 6508 | { |
| 6509 | /* Return failure if at end of input. */ |
| 6510 | if (yychar == YYEOF) |
| 6511 | YYABORT; |
| 6512 | } |
| 6513 | else |
| 6514 | { |
| 6515 | yydestruct ("Error: discarding", |
| 6516 | yytoken, &yylval); |
| 6517 | yychar = YYEMPTY; |
| 6518 | } |
| 6519 | } |
| 6520 | |
| 6521 | /* Else will try to reuse look-ahead token after shifting the error |
| 6522 | token. */ |
| 6523 | goto yyerrlab1; |
| 6524 | |
| 6525 | |
| 6526 | /*---------------------------------------------------. |
| 6527 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 6528 | `---------------------------------------------------*/ |
| 6529 | yyerrorlab: |
| 6530 | |
| 6531 | /* Pacify compilers like GCC when the user code never invokes |
| 6532 | YYERROR and the label yyerrorlab therefore never appears in user |
| 6533 | code. */ |
| 6534 | if (/*CONSTCOND*/ 0) |
| 6535 | goto yyerrorlab; |
| 6536 | |
| 6537 | /* Do not reclaim the symbols of the rule which action triggered |
| 6538 | this YYERROR. */ |
| 6539 | YYPOPSTACK (yylen); |
| 6540 | yylen = 0; |
| 6541 | YY_STACK_PRINT (yyss, yyssp); |
| 6542 | yystate = *yyssp; |
| 6543 | goto yyerrlab1; |
| 6544 | |
| 6545 | |
| 6546 | /*-------------------------------------------------------------. |
| 6547 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 6548 | `-------------------------------------------------------------*/ |
| 6549 | yyerrlab1: |
| 6550 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 6551 | |
| 6552 | for (;;) |
| 6553 | { |
| 6554 | yyn = yypact[yystate]; |
| 6555 | if (yyn != YYPACT_NINF) |
| 6556 | { |
| 6557 | yyn += YYTERROR; |
| 6558 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 6559 | { |
| 6560 | yyn = yytable[yyn]; |
| 6561 | if (0 < yyn) |
| 6562 | break; |
| 6563 | } |
| 6564 | } |
| 6565 | |
| 6566 | /* Pop the current state because it cannot handle the error token. */ |
| 6567 | if (yyssp == yyss) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6568 | YYABORT; |
| 6569 | |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6570 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6571 | yydestruct ("Error: popping", |
| 6572 | yystos[yystate], yyvsp); |
| 6573 | YYPOPSTACK (1); |
| 6574 | yystate = *yyssp; |
| 6575 | YY_STACK_PRINT (yyss, yyssp); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6576 | } |
| 6577 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6578 | if (yyn == YYFINAL) |
| 6579 | YYACCEPT; |
| 6580 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6581 | *++yyvsp = yylval; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6582 | |
| 6583 | |
| 6584 | /* Shift the error token. */ |
| 6585 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | aa8ae28 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6586 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6587 | yystate = yyn; |
| 6588 | goto yynewstate; |
| 6589 | |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 6590 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6591 | /*-------------------------------------. |
| 6592 | | yyacceptlab -- YYACCEPT comes here. | |
| 6593 | `-------------------------------------*/ |
| 6594 | yyacceptlab: |
| 6595 | yyresult = 0; |
| 6596 | goto yyreturn; |
| 6597 | |
| 6598 | /*-----------------------------------. |
| 6599 | | yyabortlab -- YYABORT comes here. | |
| 6600 | `-----------------------------------*/ |
| 6601 | yyabortlab: |
| 6602 | yyresult = 1; |
| 6603 | goto yyreturn; |
| 6604 | |
| 6605 | #ifndef yyoverflow |
| 6606 | /*-------------------------------------------------. |
| 6607 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 6608 | `-------------------------------------------------*/ |
| 6609 | yyexhaustedlab: |
| 6610 | yyerror (YY_("memory exhausted")); |
| 6611 | yyresult = 2; |
| 6612 | /* Fall through. */ |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 6613 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6614 | |
| 6615 | yyreturn: |
| 6616 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 6617 | yydestruct ("Cleanup: discarding lookahead", |
| 6618 | yytoken, &yylval); |
| 6619 | /* Do not reclaim the symbols of the rule which action triggered |
| 6620 | this YYABORT or YYACCEPT. */ |
| 6621 | YYPOPSTACK (yylen); |
| 6622 | YY_STACK_PRINT (yyss, yyssp); |
| 6623 | while (yyssp != yyss) |
| 6624 | { |
| 6625 | yydestruct ("Cleanup: popping", |
| 6626 | yystos[*yyssp], yyvsp); |
| 6627 | YYPOPSTACK (1); |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 6628 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6629 | #ifndef yyoverflow |
| 6630 | if (yyss != yyssa) |
| 6631 | YYSTACK_FREE (yyss); |
| 6632 | #endif |
| 6633 | #if YYERROR_VERBOSE |
| 6634 | if (yymsg != yymsgbuf) |
| 6635 | YYSTACK_FREE (yymsg); |
| 6636 | #endif |
| 6637 | /* Make sure YYID is used. */ |
| 6638 | return YYID (yyresult); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6639 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6640 | |
| 6641 | |
Dale Johannesen | 9873882 | 2008-02-22 22:17:59 +0000 | [diff] [blame] | 6642 | #line 3196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6643 | |
| 6644 | |
| 6645 | // common code from the two 'RunVMAsmParser' functions |
| 6646 | static Module* RunParser(Module * M) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6647 | CurModule.CurrentModule = M; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6648 | // Check to make sure the parser succeeded |
| 6649 | if (yyparse()) { |
| 6650 | if (ParserResult) |
| 6651 | delete ParserResult; |
| 6652 | return 0; |
| 6653 | } |
| 6654 | |
| 6655 | // Emit an error if there are any unresolved types left. |
| 6656 | if (!CurModule.LateResolveTypes.empty()) { |
| 6657 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 6658 | if (DID.Type == ValID::LocalName) { |
| 6659 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 6660 | } else { |
| 6661 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 6662 | } |
| 6663 | if (ParserResult) |
| 6664 | delete ParserResult; |
| 6665 | return 0; |
| 6666 | } |
| 6667 | |
| 6668 | // Emit an error if there are any unresolved values left. |
| 6669 | if (!CurModule.LateResolveValues.empty()) { |
| 6670 | Value *V = CurModule.LateResolveValues.back(); |
| 6671 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 6672 | CurModule.PlaceHolderInfo.find(V); |
| 6673 | |
| 6674 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 6675 | ValID &DID = I->second.first; |
| 6676 | if (DID.Type == ValID::LocalName) { |
| 6677 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 6678 | } else { |
| 6679 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 6680 | } |
| 6681 | if (ParserResult) |
| 6682 | delete ParserResult; |
| 6683 | return 0; |
| 6684 | } |
| 6685 | } |
| 6686 | |
| 6687 | // Check to make sure that parsing produced a result |
| 6688 | if (!ParserResult) |
| 6689 | return 0; |
| 6690 | |
| 6691 | // Reset ParserResult variable while saving its value for the result. |
| 6692 | Module *Result = ParserResult; |
| 6693 | ParserResult = 0; |
| 6694 | |
| 6695 | return Result; |
| 6696 | } |
| 6697 | |
| 6698 | void llvm::GenerateError(const std::string &message, int LineNo) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6699 | if (LineNo == -1) LineNo = LLLgetLineNo(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6700 | // TODO: column number in exception |
| 6701 | if (TheParseError) |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6702 | TheParseError->setError(LLLgetFilename(), message, LineNo); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6703 | TriggerError = 1; |
| 6704 | } |
| 6705 | |
| 6706 | int yyerror(const char *ErrorMsg) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6707 | std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6708 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6709 | if (yychar != YYEMPTY && yychar != 0) { |
| 6710 | errMsg += " while reading token: '"; |
| 6711 | errMsg += std::string(LLLgetTokenStart(), |
| 6712 | LLLgetTokenStart()+LLLgetTokenLength()) + "'"; |
| 6713 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6714 | GenerateError(errMsg); |
| 6715 | return 0; |
| 6716 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6717 | |