Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 2.1. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 10 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ |
| 20 | |
| 21 | /* As a special exception, when this file is copied by Bison into a |
| 22 | Bison output file, you may use that output file without restriction. |
| 23 | This special exception was added by the Free Software Foundation |
| 24 | in version 1.24 of Bison. */ |
| 25 | |
| 26 | /* Written by Richard Stallman by simplifying the original so called |
| 27 | ``semantic'' parser. */ |
| 28 | |
| 29 | /* All symbols defined below should begin with yy or YY, to avoid |
| 30 | infringing on user name space. This should be done even for local |
| 31 | variables, as they might otherwise be expanded by user macros. |
| 32 | There are some unavoidable exceptions within include files to |
| 33 | define necessary library symbols; they are noted "INFRINGES ON |
| 34 | USER NAME SPACE" below. */ |
| 35 | |
| 36 | /* Identify Bison output. */ |
| 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Bison version. */ |
| 40 | #define YYBISON_VERSION "2.1" |
| 41 | |
| 42 | /* Skeleton name. */ |
| 43 | #define YYSKELETON_NAME "yacc.c" |
| 44 | |
| 45 | /* Pure parsers. */ |
| 46 | #define YYPURE 0 |
| 47 | |
| 48 | /* Using locations. */ |
| 49 | #define YYLSP_NEEDED 0 |
| 50 | |
| 51 | /* Substitute the variable and function names. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 52 | #define yyparse llvmAsmparse |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 53 | #define yylex llvmAsmlex |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 54 | #define yyerror llvmAsmerror |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 55 | #define yylval llvmAsmlval |
| 56 | #define yychar llvmAsmchar |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 57 | #define yydebug llvmAsmdebug |
| 58 | #define yynerrs llvmAsmnerrs |
| 59 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 60 | |
| 61 | /* Tokens. */ |
| 62 | #ifndef YYTOKENTYPE |
| 63 | # define YYTOKENTYPE |
| 64 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 65 | know about them. */ |
| 66 | enum yytokentype { |
| 67 | ESINT64VAL = 258, |
| 68 | EUINT64VAL = 259, |
| 69 | ESAPINTVAL = 260, |
| 70 | EUAPINTVAL = 261, |
| 71 | LOCALVAL_ID = 262, |
| 72 | GLOBALVAL_ID = 263, |
| 73 | FPVAL = 264, |
| 74 | VOID = 265, |
| 75 | INTTYPE = 266, |
| 76 | FLOAT = 267, |
| 77 | DOUBLE = 268, |
| 78 | LABEL = 269, |
| 79 | TYPE = 270, |
| 80 | LOCALVAR = 271, |
| 81 | GLOBALVAR = 272, |
| 82 | LABELSTR = 273, |
| 83 | STRINGCONSTANT = 274, |
| 84 | ATSTRINGCONSTANT = 275, |
| 85 | PCTSTRINGCONSTANT = 276, |
| 86 | ZEROINITIALIZER = 277, |
| 87 | TRUETOK = 278, |
| 88 | FALSETOK = 279, |
| 89 | BEGINTOK = 280, |
| 90 | ENDTOK = 281, |
| 91 | DECLARE = 282, |
| 92 | DEFINE = 283, |
| 93 | GLOBAL = 284, |
| 94 | CONSTANT = 285, |
| 95 | SECTION = 286, |
| 96 | ALIAS = 287, |
| 97 | VOLATILE = 288, |
| 98 | THREAD_LOCAL = 289, |
| 99 | TO = 290, |
| 100 | DOTDOTDOT = 291, |
| 101 | NULL_TOK = 292, |
| 102 | UNDEF = 293, |
| 103 | INTERNAL = 294, |
| 104 | LINKONCE = 295, |
| 105 | WEAK = 296, |
| 106 | APPENDING = 297, |
| 107 | DLLIMPORT = 298, |
| 108 | DLLEXPORT = 299, |
| 109 | EXTERN_WEAK = 300, |
| 110 | OPAQUE = 301, |
| 111 | EXTERNAL = 302, |
| 112 | TARGET = 303, |
| 113 | TRIPLE = 304, |
| 114 | ALIGN = 305, |
| 115 | DEPLIBS = 306, |
| 116 | CALL = 307, |
| 117 | TAIL = 308, |
| 118 | ASM_TOK = 309, |
| 119 | MODULE = 310, |
| 120 | SIDEEFFECT = 311, |
| 121 | CC_TOK = 312, |
| 122 | CCC_TOK = 313, |
| 123 | FASTCC_TOK = 314, |
| 124 | COLDCC_TOK = 315, |
| 125 | X86_STDCALLCC_TOK = 316, |
| 126 | X86_FASTCALLCC_TOK = 317, |
| 127 | DATALAYOUT = 318, |
| 128 | RET = 319, |
| 129 | BR = 320, |
| 130 | SWITCH = 321, |
| 131 | INVOKE = 322, |
| 132 | UNWIND = 323, |
| 133 | UNREACHABLE = 324, |
| 134 | ADD = 325, |
| 135 | SUB = 326, |
| 136 | MUL = 327, |
| 137 | UDIV = 328, |
| 138 | SDIV = 329, |
| 139 | FDIV = 330, |
| 140 | UREM = 331, |
| 141 | SREM = 332, |
| 142 | FREM = 333, |
| 143 | AND = 334, |
| 144 | OR = 335, |
| 145 | XOR = 336, |
| 146 | SHL = 337, |
| 147 | LSHR = 338, |
| 148 | ASHR = 339, |
| 149 | ICMP = 340, |
| 150 | FCMP = 341, |
| 151 | EQ = 342, |
| 152 | NE = 343, |
| 153 | SLT = 344, |
| 154 | SGT = 345, |
| 155 | SLE = 346, |
| 156 | SGE = 347, |
| 157 | ULT = 348, |
| 158 | UGT = 349, |
| 159 | ULE = 350, |
| 160 | UGE = 351, |
| 161 | OEQ = 352, |
| 162 | ONE = 353, |
| 163 | OLT = 354, |
| 164 | OGT = 355, |
| 165 | OLE = 356, |
| 166 | OGE = 357, |
| 167 | ORD = 358, |
| 168 | UNO = 359, |
| 169 | UEQ = 360, |
| 170 | UNE = 361, |
| 171 | MALLOC = 362, |
| 172 | ALLOCA = 363, |
| 173 | FREE = 364, |
| 174 | LOAD = 365, |
| 175 | STORE = 366, |
| 176 | GETELEMENTPTR = 367, |
| 177 | TRUNC = 368, |
| 178 | ZEXT = 369, |
| 179 | SEXT = 370, |
| 180 | FPTRUNC = 371, |
| 181 | FPEXT = 372, |
| 182 | BITCAST = 373, |
| 183 | UITOFP = 374, |
| 184 | SITOFP = 375, |
| 185 | FPTOUI = 376, |
| 186 | FPTOSI = 377, |
| 187 | INTTOPTR = 378, |
| 188 | PTRTOINT = 379, |
| 189 | PHI_TOK = 380, |
| 190 | SELECT = 381, |
| 191 | VAARG = 382, |
| 192 | EXTRACTELEMENT = 383, |
| 193 | INSERTELEMENT = 384, |
| 194 | SHUFFLEVECTOR = 385, |
| 195 | SIGNEXT = 386, |
| 196 | ZEROEXT = 387, |
| 197 | NORETURN = 388, |
| 198 | INREG = 389, |
| 199 | SRET = 390, |
| 200 | NOUNWIND = 391, |
| 201 | NOALIAS = 392, |
| 202 | BYVAL = 393, |
| 203 | NEST = 394, |
| 204 | DEFAULT = 395, |
| 205 | HIDDEN = 396, |
| 206 | PROTECTED = 397 |
| 207 | }; |
| 208 | #endif |
| 209 | /* Tokens. */ |
| 210 | #define ESINT64VAL 258 |
| 211 | #define EUINT64VAL 259 |
| 212 | #define ESAPINTVAL 260 |
| 213 | #define EUAPINTVAL 261 |
| 214 | #define LOCALVAL_ID 262 |
| 215 | #define GLOBALVAL_ID 263 |
| 216 | #define FPVAL 264 |
| 217 | #define VOID 265 |
| 218 | #define INTTYPE 266 |
| 219 | #define FLOAT 267 |
| 220 | #define DOUBLE 268 |
| 221 | #define LABEL 269 |
| 222 | #define TYPE 270 |
| 223 | #define LOCALVAR 271 |
| 224 | #define GLOBALVAR 272 |
| 225 | #define LABELSTR 273 |
| 226 | #define STRINGCONSTANT 274 |
| 227 | #define ATSTRINGCONSTANT 275 |
| 228 | #define PCTSTRINGCONSTANT 276 |
| 229 | #define ZEROINITIALIZER 277 |
| 230 | #define TRUETOK 278 |
| 231 | #define FALSETOK 279 |
| 232 | #define BEGINTOK 280 |
| 233 | #define ENDTOK 281 |
| 234 | #define DECLARE 282 |
| 235 | #define DEFINE 283 |
| 236 | #define GLOBAL 284 |
| 237 | #define CONSTANT 285 |
| 238 | #define SECTION 286 |
| 239 | #define ALIAS 287 |
| 240 | #define VOLATILE 288 |
| 241 | #define THREAD_LOCAL 289 |
| 242 | #define TO 290 |
| 243 | #define DOTDOTDOT 291 |
| 244 | #define NULL_TOK 292 |
| 245 | #define UNDEF 293 |
| 246 | #define INTERNAL 294 |
| 247 | #define LINKONCE 295 |
| 248 | #define WEAK 296 |
| 249 | #define APPENDING 297 |
| 250 | #define DLLIMPORT 298 |
| 251 | #define DLLEXPORT 299 |
| 252 | #define EXTERN_WEAK 300 |
| 253 | #define OPAQUE 301 |
| 254 | #define EXTERNAL 302 |
| 255 | #define TARGET 303 |
| 256 | #define TRIPLE 304 |
| 257 | #define ALIGN 305 |
| 258 | #define DEPLIBS 306 |
| 259 | #define CALL 307 |
| 260 | #define TAIL 308 |
| 261 | #define ASM_TOK 309 |
| 262 | #define MODULE 310 |
| 263 | #define SIDEEFFECT 311 |
| 264 | #define CC_TOK 312 |
| 265 | #define CCC_TOK 313 |
| 266 | #define FASTCC_TOK 314 |
| 267 | #define COLDCC_TOK 315 |
| 268 | #define X86_STDCALLCC_TOK 316 |
| 269 | #define X86_FASTCALLCC_TOK 317 |
| 270 | #define DATALAYOUT 318 |
| 271 | #define RET 319 |
| 272 | #define BR 320 |
| 273 | #define SWITCH 321 |
| 274 | #define INVOKE 322 |
| 275 | #define UNWIND 323 |
| 276 | #define UNREACHABLE 324 |
| 277 | #define ADD 325 |
| 278 | #define SUB 326 |
| 279 | #define MUL 327 |
| 280 | #define UDIV 328 |
| 281 | #define SDIV 329 |
| 282 | #define FDIV 330 |
| 283 | #define UREM 331 |
| 284 | #define SREM 332 |
| 285 | #define FREM 333 |
| 286 | #define AND 334 |
| 287 | #define OR 335 |
| 288 | #define XOR 336 |
| 289 | #define SHL 337 |
| 290 | #define LSHR 338 |
| 291 | #define ASHR 339 |
| 292 | #define ICMP 340 |
| 293 | #define FCMP 341 |
| 294 | #define EQ 342 |
| 295 | #define NE 343 |
| 296 | #define SLT 344 |
| 297 | #define SGT 345 |
| 298 | #define SLE 346 |
| 299 | #define SGE 347 |
| 300 | #define ULT 348 |
| 301 | #define UGT 349 |
| 302 | #define ULE 350 |
| 303 | #define UGE 351 |
| 304 | #define OEQ 352 |
| 305 | #define ONE 353 |
| 306 | #define OLT 354 |
| 307 | #define OGT 355 |
| 308 | #define OLE 356 |
| 309 | #define OGE 357 |
| 310 | #define ORD 358 |
| 311 | #define UNO 359 |
| 312 | #define UEQ 360 |
| 313 | #define UNE 361 |
| 314 | #define MALLOC 362 |
| 315 | #define ALLOCA 363 |
| 316 | #define FREE 364 |
| 317 | #define LOAD 365 |
| 318 | #define STORE 366 |
| 319 | #define GETELEMENTPTR 367 |
| 320 | #define TRUNC 368 |
| 321 | #define ZEXT 369 |
| 322 | #define SEXT 370 |
| 323 | #define FPTRUNC 371 |
| 324 | #define FPEXT 372 |
| 325 | #define BITCAST 373 |
| 326 | #define UITOFP 374 |
| 327 | #define SITOFP 375 |
| 328 | #define FPTOUI 376 |
| 329 | #define FPTOSI 377 |
| 330 | #define INTTOPTR 378 |
| 331 | #define PTRTOINT 379 |
| 332 | #define PHI_TOK 380 |
| 333 | #define SELECT 381 |
| 334 | #define VAARG 382 |
| 335 | #define EXTRACTELEMENT 383 |
| 336 | #define INSERTELEMENT 384 |
| 337 | #define SHUFFLEVECTOR 385 |
| 338 | #define SIGNEXT 386 |
| 339 | #define ZEROEXT 387 |
| 340 | #define NORETURN 388 |
| 341 | #define INREG 389 |
| 342 | #define SRET 390 |
| 343 | #define NOUNWIND 391 |
| 344 | #define NOALIAS 392 |
| 345 | #define BYVAL 393 |
| 346 | #define NEST 394 |
| 347 | #define DEFAULT 395 |
| 348 | #define HIDDEN 396 |
| 349 | #define PROTECTED 397 |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | /* Copy the first part of user declarations. */ |
| 355 | #line 14 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 356 | |
| 357 | #include "ParserInternals.h" |
| 358 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 359 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 360 | #include "llvm/Instructions.h" |
| 361 | #include "llvm/Module.h" |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 362 | #include "llvm/ValueSymbolTable.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 363 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 364 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 365 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 366 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 367 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 368 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 369 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 370 | #include <list> |
Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 371 | #include <map> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 372 | #include <utility> |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 373 | #ifndef NDEBUG |
| 374 | #define YYDEBUG 1 |
| 375 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 376 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 377 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 378 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 379 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 380 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 381 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 382 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 383 | // GenerateError are made from inside productions and they must simulate the |
| 384 | // previous exception behavior by exiting the production immediately. We have |
| 385 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 386 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 387 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 388 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 389 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 390 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 391 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 392 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 393 | int yylex(); // declaration" of xxx warnings. |
| 394 | int yyparse(); |
| 395 | |
| 396 | namespace llvm { |
| 397 | std::string CurFilename; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 398 | #if YYDEBUG |
| 399 | static cl::opt<bool> |
| 400 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), |
| 401 | cl::Hidden, cl::init(false)); |
| 402 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 403 | } |
| 404 | using namespace llvm; |
| 405 | |
| 406 | static Module *ParserResult; |
| 407 | |
| 408 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 409 | // relating to upreferences in the input stream. |
| 410 | // |
| 411 | //#define DEBUG_UPREFS 1 |
| 412 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 413 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 414 | #else |
| 415 | #define UR_OUT(X) |
| 416 | #endif |
| 417 | |
| 418 | #define YYERROR_VERBOSE 1 |
| 419 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 420 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 421 | |
| 422 | |
| 423 | // This contains info used when building the body of a function. It is |
| 424 | // destroyed when the function is completed. |
| 425 | // |
| 426 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 427 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 428 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 429 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 430 | |
| 431 | static struct PerModuleInfo { |
| 432 | Module *CurrentModule; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 433 | ValueList Values; // Module level numbered definitions |
| 434 | ValueList LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 435 | std::vector<PATypeHolder> Types; |
| 436 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 437 | |
| 438 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 439 | /// how they were referenced and on which line of the input they came from so |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 440 | /// that we can resolve them later and print error messages as appropriate. |
| 441 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 442 | |
| 443 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 444 | // references to global values. Global values may be referenced before they |
| 445 | // are defined, and if so, the temporary object that they represent is held |
| 446 | // here. This is used for forward references of GlobalValues. |
| 447 | // |
| 448 | typedef std::map<std::pair<const PointerType *, |
| 449 | ValID>, GlobalValue*> GlobalRefsType; |
| 450 | GlobalRefsType GlobalRefs; |
| 451 | |
| 452 | void ModuleDone() { |
| 453 | // If we could not resolve some functions at function compilation time |
| 454 | // (calls to functions before they are defined), resolve them now... Types |
| 455 | // are resolved when the constant pool has been completely parsed. |
| 456 | // |
| 457 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 458 | if (TriggerError) |
| 459 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 460 | |
| 461 | // Check to make sure that all global value forward references have been |
| 462 | // resolved! |
| 463 | // |
| 464 | if (!GlobalRefs.empty()) { |
| 465 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 466 | |
| 467 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 468 | I != E; ++I) { |
| 469 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 470 | I->first.second.getName() + "\n"; |
| 471 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 472 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 473 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | Values.clear(); // Clear out function local definitions |
| 477 | Types.clear(); |
| 478 | CurrentModule = 0; |
| 479 | } |
| 480 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 481 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 482 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 483 | // If not, just return null. |
| 484 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 485 | // Check to see if there is a forward reference to this global variable... |
| 486 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 487 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 488 | GlobalValue *Ret = 0; |
| 489 | if (I != GlobalRefs.end()) { |
| 490 | Ret = I->second; |
| 491 | GlobalRefs.erase(I); |
| 492 | } |
| 493 | return Ret; |
| 494 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 495 | |
| 496 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 497 | // If it isn't abstract, its resolved |
| 498 | const Type* Ty = PATy->get(); |
| 499 | if (!Ty->isAbstract()) |
| 500 | return false; |
| 501 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 502 | // we don't need to traverse that leg of the type. |
| 503 | std::vector<const Type*> WorkList, SeenList; |
| 504 | WorkList.push_back(Ty); |
| 505 | while (!WorkList.empty()) { |
| 506 | const Type* Ty = WorkList.back(); |
| 507 | SeenList.push_back(Ty); |
| 508 | WorkList.pop_back(); |
| 509 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 510 | // Check to see if this is an unresolved type |
| 511 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 512 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 513 | for ( ; I != E; ++I) { |
| 514 | if (I->second.get() == OpTy) |
| 515 | return true; |
| 516 | } |
| 517 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 518 | const Type* TheTy = SeqTy->getElementType(); |
| 519 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 520 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 521 | E = SeenList.end(); |
| 522 | for ( ; I != E; ++I) |
| 523 | if (*I == TheTy) |
| 524 | break; |
| 525 | if (I == E) |
| 526 | WorkList.push_back(TheTy); |
| 527 | } |
| 528 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 529 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 530 | const Type* TheTy = StrTy->getElementType(i); |
| 531 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 532 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 533 | E = SeenList.end(); |
| 534 | for ( ; I != E; ++I) |
| 535 | if (*I == TheTy) |
| 536 | break; |
| 537 | if (I == E) |
| 538 | WorkList.push_back(TheTy); |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | return false; |
| 544 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 545 | } CurModule; |
| 546 | |
| 547 | static struct PerFunctionInfo { |
| 548 | Function *CurrentFunction; // Pointer to current function being created |
| 549 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 550 | ValueList Values; // Keep track of #'d definitions |
| 551 | unsigned NextValNum; |
| 552 | ValueList LateResolveValues; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 553 | bool isDeclare; // Is this function a forward declararation? |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 554 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 555 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 556 | |
| 557 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 558 | /// track of them here. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 559 | std::map<ValID, BasicBlock*> BBForwardRefs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 560 | |
| 561 | inline PerFunctionInfo() { |
| 562 | CurrentFunction = 0; |
| 563 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 564 | Linkage = GlobalValue::ExternalLinkage; |
| 565 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | inline void FunctionStart(Function *M) { |
| 569 | CurrentFunction = M; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 570 | NextValNum = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | void FunctionDone() { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 574 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 575 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 576 | GenerateError("Undefined reference to label " + |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 577 | BBForwardRefs.begin()->second->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 578 | return; |
| 579 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 580 | |
| 581 | // Resolve all forward references now. |
| 582 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 583 | |
| 584 | Values.clear(); // Clear out function local definitions |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 585 | BBForwardRefs.clear(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 586 | CurrentFunction = 0; |
| 587 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 588 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 589 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 590 | } |
| 591 | } CurFun; // Info for the current function... |
| 592 | |
| 593 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 594 | |
| 595 | |
| 596 | //===----------------------------------------------------------------------===// |
| 597 | // Code to handle definitions of all the types |
| 598 | //===----------------------------------------------------------------------===// |
| 599 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 600 | static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
| 601 | // Things that have names or are void typed don't get slot numbers |
| 602 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
| 603 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 604 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 605 | // In the case of function values, we have to allow for the forward reference |
| 606 | // of basic blocks, which are included in the numbering. Consequently, we keep |
| 607 | // track of the next insertion location with NextValNum. When a BB gets |
| 608 | // inserted, it could change the size of the CurFun.Values vector. |
| 609 | if (&ValueTab == &CurFun.Values) { |
| 610 | if (ValueTab.size() <= CurFun.NextValNum) |
| 611 | ValueTab.resize(CurFun.NextValNum+1); |
| 612 | ValueTab[CurFun.NextValNum++] = V; |
| 613 | return; |
| 614 | } |
| 615 | // For all other lists, its okay to just tack it on the back of the vector. |
| 616 | ValueTab.push_back(V); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 620 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 621 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 622 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 623 | if (D.Num < CurModule.Types.size()) |
| 624 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 625 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 626 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 627 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 628 | D.destroy(); // Free old strdup'd memory... |
| 629 | return N; |
| 630 | } |
| 631 | break; |
| 632 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 633 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 634 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 635 | } |
| 636 | |
| 637 | // If we reached here, we referenced either a symbol that we don't know about |
| 638 | // or an id number that hasn't been read yet. We may be referencing something |
| 639 | // forward, so just create an entry to be resolved later and get to it... |
| 640 | // |
| 641 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 642 | |
| 643 | |
| 644 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 645 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 646 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 647 | return 0; |
| 648 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 649 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 650 | return 0; |
| 651 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 652 | } |
| 653 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 654 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 655 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 656 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 657 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 658 | Type *Typ = OpaqueType::get(); |
| 659 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 660 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 661 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 662 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 663 | // getExistingVal - Look up the value specified by the provided type and |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 664 | // the provided ValID. If the value exists and has already been defined, return |
| 665 | // it. Otherwise return null. |
| 666 | // |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 667 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 668 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 669 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 670 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 671 | return 0; |
| 672 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 673 | |
| 674 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 675 | case ValID::LocalID: { // Is it a numbered definition? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 676 | // Check that the number is within bounds. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 677 | if (D.Num >= CurFun.Values.size()) |
| 678 | return 0; |
| 679 | Value *Result = CurFun.Values[D.Num]; |
| 680 | if (Ty != Result->getType()) { |
| 681 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
| 682 | Result->getType()->getDescription() + "' does not match " |
| 683 | "expected type, '" + Ty->getDescription() + "'"); |
| 684 | return 0; |
| 685 | } |
| 686 | return Result; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 687 | } |
| 688 | case ValID::GlobalID: { // Is it a numbered definition? |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 689 | if (D.Num >= CurModule.Values.size()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 690 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 691 | Value *Result = CurModule.Values[D.Num]; |
| 692 | if (Ty != Result->getType()) { |
| 693 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
| 694 | Result->getType()->getDescription() + "' does not match " |
| 695 | "expected type, '" + Ty->getDescription() + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 696 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 697 | } |
| 698 | return Result; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 699 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 700 | |
| 701 | case ValID::LocalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 702 | if (!inFunctionScope()) |
| 703 | return 0; |
| 704 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 705 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 706 | if (N == 0) |
| 707 | return 0; |
| 708 | if (N->getType() != Ty) |
| 709 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 710 | |
| 711 | D.destroy(); // Free old strdup'd memory... |
| 712 | return N; |
| 713 | } |
| 714 | case ValID::GlobalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 715 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 716 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 717 | if (N == 0) |
| 718 | return 0; |
| 719 | if (N->getType() != Ty) |
| 720 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 721 | |
| 722 | D.destroy(); // Free old strdup'd memory... |
| 723 | return N; |
| 724 | } |
| 725 | |
| 726 | // Check to make sure that "Ty" is an integral type, and that our |
| 727 | // value will fit into the specified type... |
| 728 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 729 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 730 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 731 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 732 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 733 | return 0; |
| 734 | } |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 735 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 736 | |
| 737 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 738 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 739 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 740 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 741 | "' is invalid or out of range"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 742 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 743 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 744 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 745 | } |
| 746 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 747 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 748 | } |
| 749 | |
| 750 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 751 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 752 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 753 | return 0; |
| 754 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 755 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 756 | |
| 757 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 758 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 759 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 760 | return 0; |
| 761 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 762 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 763 | |
| 764 | case ValID::ConstUndefVal: // Is it an undef value? |
| 765 | return UndefValue::get(Ty); |
| 766 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 767 | case ValID::ConstZeroVal: // Is it a zero value? |
| 768 | return Constant::getNullValue(Ty); |
| 769 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 770 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 771 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 772 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 773 | return 0; |
| 774 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 775 | return D.ConstantValue; |
| 776 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 777 | case ValID::InlineAsmVal: { // Inline asm expression |
| 778 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 779 | const FunctionType *FTy = |
| 780 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 781 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 782 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 783 | return 0; |
| 784 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 785 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 786 | D.IAD->HasSideEffects); |
| 787 | D.destroy(); // Free InlineAsmDescriptor. |
| 788 | return IA; |
| 789 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 790 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 791 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 792 | return 0; |
| 793 | } // End of switch |
| 794 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 795 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 796 | return 0; |
| 797 | } |
| 798 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 799 | // getVal - This function is identical to getExistingVal, except that if a |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 800 | // value is not already defined, it "improvises" by creating a placeholder var |
| 801 | // that looks and acts just like the requested variable. When the value is |
| 802 | // defined later, all uses of the placeholder variable are replaced with the |
| 803 | // real thing. |
| 804 | // |
| 805 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 806 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 807 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 808 | return 0; |
| 809 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 810 | |
| 811 | // See if the value has already been defined. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 812 | Value *V = getExistingVal(Ty, ID); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 813 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 814 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 815 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 816 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 817 | GenerateError("Invalid use of a composite type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 818 | return 0; |
| 819 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 820 | |
| 821 | // If we reached here, we referenced either a symbol that we don't know about |
| 822 | // or an id number that hasn't been read yet. We may be referencing something |
| 823 | // forward, so just create an entry to be resolved later and get to it... |
| 824 | // |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 825 | switch (ID.Type) { |
| 826 | case ValID::GlobalName: |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 827 | case ValID::GlobalID: { |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 828 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 829 | if (!PTy) { |
| 830 | GenerateError("Invalid type for reference to global" ); |
| 831 | return 0; |
| 832 | } |
| 833 | const Type* ElTy = PTy->getElementType(); |
| 834 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
| 835 | V = new Function(FTy, GlobalValue::ExternalLinkage); |
| 836 | else |
| 837 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage); |
| 838 | break; |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 839 | } |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 840 | default: |
| 841 | V = new Argument(Ty); |
| 842 | } |
| 843 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 844 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 845 | // to recycle these things?? |
| 846 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 847 | llvmAsmlineno))); |
| 848 | |
| 849 | if (inFunctionScope()) |
| 850 | InsertValue(V, CurFun.LateResolveValues); |
| 851 | else |
| 852 | InsertValue(V, CurModule.LateResolveValues); |
| 853 | return V; |
| 854 | } |
| 855 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 856 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 857 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
| 858 | static BasicBlock *defineBBVal(const ValID &ID) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 859 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 860 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 861 | BasicBlock *BB = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 862 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 863 | // First, see if this was forward referenced |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 864 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 865 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 866 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 867 | BB = BBI->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 868 | // The forward declaration could have been inserted anywhere in the |
| 869 | // function: insert it into the correct place now. |
| 870 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 871 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 872 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 873 | // We're about to erase the entry, save the key so we can clean it up. |
| 874 | ValID Tmp = BBI->first; |
| 875 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 876 | // Erase the forward ref from the map as its no longer "forward" |
| 877 | CurFun.BBForwardRefs.erase(ID); |
| 878 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 879 | // The key has been removed from the map but so we don't want to leave |
| 880 | // strdup'd memory around so destroy it too. |
| 881 | Tmp.destroy(); |
| 882 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 883 | // If its a numbered definition, bump the number and set the BB value. |
| 884 | if (ID.Type == ValID::LocalID) { |
| 885 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 886 | InsertValue(BB); |
| 887 | } |
| 888 | |
| 889 | ID.destroy(); |
| 890 | return BB; |
| 891 | } |
| 892 | |
| 893 | // We haven't seen this BB before and its first mention is a definition. |
| 894 | // Just create it and return it. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 895 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 896 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 897 | if (ID.Type == ValID::LocalID) { |
| 898 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 899 | InsertValue(BB); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 900 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 901 | |
| 902 | ID.destroy(); // Free strdup'd memory |
| 903 | return BB; |
| 904 | } |
| 905 | |
| 906 | /// getBBVal - get an existing BB value or create a forward reference for it. |
| 907 | /// |
| 908 | static BasicBlock *getBBVal(const ValID &ID) { |
| 909 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 910 | |
| 911 | BasicBlock *BB = 0; |
| 912 | |
| 913 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 914 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 915 | BB = BBI->second; |
| 916 | } if (ID.Type == ValID::LocalName) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 917 | std::string Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 918 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
| 919 | if (N) |
| 920 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 921 | BB = cast<BasicBlock>(N); |
| 922 | else |
| 923 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 924 | N->getType()->getDescription() + "'"); |
| 925 | } else if (ID.Type == ValID::LocalID) { |
| 926 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 927 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 928 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 929 | else |
| 930 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 931 | "' is actually of type '"+ |
| 932 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 933 | } |
| 934 | } else { |
| 935 | GenerateError("Illegal label reference " + ID.getName()); |
| 936 | return 0; |
| 937 | } |
| 938 | |
| 939 | // If its already been defined, return it now. |
| 940 | if (BB) { |
| 941 | ID.destroy(); // Free strdup'd memory. |
| 942 | return BB; |
| 943 | } |
| 944 | |
| 945 | // Otherwise, this block has not been seen before, create it. |
| 946 | std::string Name; |
| 947 | if (ID.Type == ValID::LocalName) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 948 | Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 949 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 950 | |
| 951 | // Insert it in the forward refs map. |
| 952 | CurFun.BBForwardRefs[ID] = BB; |
| 953 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 954 | return BB; |
| 955 | } |
| 956 | |
| 957 | |
| 958 | //===----------------------------------------------------------------------===// |
| 959 | // Code to handle forward references in instructions |
| 960 | //===----------------------------------------------------------------------===// |
| 961 | // |
| 962 | // This code handles the late binding needed with statements that reference |
| 963 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 964 | // a loop body. |
| 965 | // |
| 966 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 967 | // and back patchs after we are done. |
| 968 | // |
| 969 | |
| 970 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 971 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 972 | // defs now... |
| 973 | // |
| 974 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 975 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 976 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 977 | while (!LateResolvers.empty()) { |
| 978 | Value *V = LateResolvers.back(); |
| 979 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 980 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 981 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 982 | CurModule.PlaceHolderInfo.find(V); |
| 983 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 984 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 985 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 986 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 987 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 988 | if (TriggerError) |
| 989 | return; |
| 990 | if (TheRealValue) { |
| 991 | V->replaceAllUsesWith(TheRealValue); |
| 992 | delete V; |
| 993 | CurModule.PlaceHolderInfo.erase(PHI); |
| 994 | } else if (FutureLateResolvers) { |
| 995 | // Functions have their unresolved items forwarded to the module late |
| 996 | // resolver table |
| 997 | InsertValue(V, *FutureLateResolvers); |
| 998 | } else { |
| 999 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 1000 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 1001 | "' of type '" + V->getType()->getDescription() + "'", |
| 1002 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1003 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1004 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1005 | GenerateError("Reference to an invalid definition: #" + |
| 1006 | itostr(DID.Num) + " of type '" + |
| 1007 | V->getType()->getDescription() + "'", |
| 1008 | PHI->second.second); |
| 1009 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1010 | } |
| 1011 | } |
| 1012 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1013 | LateResolvers.clear(); |
| 1014 | } |
| 1015 | |
| 1016 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 1017 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 1018 | // refering to the number can be resolved. Do this now. |
| 1019 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1020 | static void ResolveTypeTo(std::string *Name, const Type *ToTy) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1021 | ValID D; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1022 | if (Name) |
| 1023 | D = ValID::createLocalName(*Name); |
| 1024 | else |
| 1025 | D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1026 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1027 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1028 | CurModule.LateResolveTypes.find(D); |
| 1029 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1030 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1031 | CurModule.LateResolveTypes.erase(I); |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | // setValueName - Set the specified value to the name given. The name may be |
| 1036 | // null potentially, in which case this is a noop. The string passed in is |
| 1037 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1038 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1039 | static void setValueName(Value *V, std::string *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1040 | if (!NameStr) return; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1041 | std::string Name(*NameStr); // Copy string |
| 1042 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1043 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1044 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1045 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1046 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1047 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1048 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1049 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1050 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1051 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1052 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1053 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1054 | return; |
| 1055 | } |
| 1056 | |
| 1057 | // Set the name. |
| 1058 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1059 | } |
| 1060 | |
| 1061 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1062 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1063 | static GlobalVariable * |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1064 | ParseGlobalVariable(std::string *NameStr, |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1065 | GlobalValue::LinkageTypes Linkage, |
| 1066 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1067 | bool isConstantGlobal, const Type *Ty, |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1068 | Constant *Initializer, bool IsThreadLocal) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1069 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1070 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1071 | return 0; |
| 1072 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1073 | |
| 1074 | const PointerType *PTy = PointerType::get(Ty); |
| 1075 | |
| 1076 | std::string Name; |
| 1077 | if (NameStr) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1078 | Name = *NameStr; // Copy string |
| 1079 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1080 | } |
| 1081 | |
| 1082 | // See if this global value was forward referenced. If so, recycle the |
| 1083 | // object. |
| 1084 | ValID ID; |
| 1085 | if (!Name.empty()) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1086 | ID = ValID::createGlobalName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1087 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1088 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1089 | } |
| 1090 | |
| 1091 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1092 | // Move the global to the end of the list, from whereever it was |
| 1093 | // previously inserted. |
| 1094 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1095 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1096 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1097 | GV->setInitializer(Initializer); |
| 1098 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1099 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1100 | GV->setConstant(isConstantGlobal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1101 | GV->setThreadLocal(IsThreadLocal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1102 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1103 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1104 | } |
| 1105 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1106 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1107 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1108 | // if the global we're parsing has an initializer (is a definition) and |
| 1109 | // has external linkage. |
| 1110 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1111 | // If there is already a global with external linkage with this name |
| 1112 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1113 | // If we allow this GVar to get created, it will be renamed in the |
| 1114 | // symbol table because it conflicts with an existing GVar. We can't |
| 1115 | // allow redefinition of GVars whose linking indicates that their name |
| 1116 | // must stay the same. Issue the error. |
| 1117 | GenerateError("Redefinition of global variable named '" + Name + |
| 1118 | "' of type '" + Ty->getDescription() + "'"); |
| 1119 | return 0; |
| 1120 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1121 | } |
| 1122 | |
| 1123 | // Otherwise there is no existing GV to use, create one now. |
| 1124 | GlobalVariable *GV = |
| 1125 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1126 | CurModule.CurrentModule, IsThreadLocal); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1127 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1128 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1129 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1130 | } |
| 1131 | |
| 1132 | // setTypeName - Set the specified type to the name given. The name may be |
| 1133 | // null potentially, in which case this is a noop. The string passed in is |
| 1134 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1135 | // |
| 1136 | // This function returns true if the type has already been defined, but is |
| 1137 | // allowed to be redefined in the specified context. If the name is a new name |
| 1138 | // for the type plane, it is inserted and false is returned. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1139 | static bool setTypeName(const Type *T, std::string *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1140 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1141 | if (NameStr == 0) return false; |
| 1142 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1143 | std::string Name(*NameStr); // Copy string |
| 1144 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1145 | |
| 1146 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1147 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1148 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1149 | return false; |
| 1150 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1151 | |
| 1152 | // Set the type name, checking for conflicts as we do so. |
| 1153 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1154 | |
| 1155 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1156 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1157 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1158 | |
| 1159 | // There is only one case where this is allowed: when we are refining an |
| 1160 | // opaque type. In this case, Existing will be an opaque type. |
| 1161 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1162 | // We ARE replacing an opaque type! |
| 1163 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1164 | return true; |
| 1165 | } |
| 1166 | |
| 1167 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1168 | // the redefinition is identical to the original. This will be so if |
| 1169 | // Existing and T point to the same Type object. In this one case we |
| 1170 | // allow the equivalent redefinition. |
| 1171 | if (Existing == T) return true; // Yes, it's equal. |
| 1172 | |
| 1173 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1174 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1175 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1176 | } |
| 1177 | |
| 1178 | return false; |
| 1179 | } |
| 1180 | |
| 1181 | //===----------------------------------------------------------------------===// |
| 1182 | // Code for handling upreferences in type names... |
| 1183 | // |
| 1184 | |
| 1185 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1186 | // |
| 1187 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1188 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1189 | E) != Ty->subtype_end(); |
| 1190 | } |
| 1191 | |
| 1192 | namespace { |
| 1193 | struct UpRefRecord { |
| 1194 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1195 | // this type is resolved. |
| 1196 | unsigned NestingLevel; |
| 1197 | |
| 1198 | // LastContainedTy - This is the type at the current binding level for the |
| 1199 | // type. Every time we reduce the nesting level, this gets updated. |
| 1200 | const Type *LastContainedTy; |
| 1201 | |
| 1202 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1203 | // represented with. |
| 1204 | OpaqueType *UpRefTy; |
| 1205 | |
| 1206 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1207 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1208 | }; |
| 1209 | } |
| 1210 | |
| 1211 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1212 | static std::vector<UpRefRecord> UpRefs; |
| 1213 | |
| 1214 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1215 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1216 | /// currently active types. For each type, if the up reference is contained in |
| 1217 | /// the newly completed type, we decrement the level count. When the level |
| 1218 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1219 | /// thus we can complete the cycle. |
| 1220 | /// |
| 1221 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1222 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1223 | // nothing to resolve here. |
| 1224 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1225 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1226 | PATypeHolder Ty(ty); |
| 1227 | UR_OUT("Type '" << Ty->getDescription() << |
| 1228 | "' newly formed. Resolving upreferences.\n" << |
| 1229 | UpRefs.size() << " upreferences active!\n"); |
| 1230 | |
| 1231 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1232 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1233 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1234 | // this variable. |
| 1235 | OpaqueType *TypeToResolve = 0; |
| 1236 | |
| 1237 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1238 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1239 | << UpRefs[i].second->getDescription() << ") = " |
| 1240 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1241 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1242 | // Decrement level of upreference |
| 1243 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1244 | UpRefs[i].LastContainedTy = Ty; |
| 1245 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1246 | if (Level == 0) { // Upreference should be resolved! |
| 1247 | if (!TypeToResolve) { |
| 1248 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1249 | } else { |
| 1250 | UR_OUT(" * Resolving upreference for " |
| 1251 | << UpRefs[i].second->getDescription() << "\n"; |
| 1252 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1253 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1254 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1255 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1256 | } |
| 1257 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1258 | --i; // Do not skip the next element... |
| 1259 | } |
| 1260 | } |
| 1261 | } |
| 1262 | |
| 1263 | if (TypeToResolve) { |
| 1264 | UR_OUT(" * Resolving upreference for " |
| 1265 | << UpRefs[i].second->getDescription() << "\n"; |
| 1266 | std::string OldName = TypeToResolve->getDescription()); |
| 1267 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1268 | } |
| 1269 | |
| 1270 | return Ty; |
| 1271 | } |
| 1272 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1273 | //===----------------------------------------------------------------------===// |
| 1274 | // RunVMAsmParser - Define an interface to this parser |
| 1275 | //===----------------------------------------------------------------------===// |
| 1276 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1277 | static Module* RunParser(Module * M); |
| 1278 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1279 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1280 | set_scan_file(F); |
| 1281 | |
| 1282 | CurFilename = Filename; |
| 1283 | return RunParser(new Module(CurFilename)); |
| 1284 | } |
| 1285 | |
| 1286 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1287 | set_scan_string(AsmString); |
| 1288 | |
| 1289 | CurFilename = "from_memory"; |
| 1290 | if (M == NULL) { |
| 1291 | return RunParser(new Module (CurFilename)); |
| 1292 | } else { |
| 1293 | return RunParser(M); |
| 1294 | } |
| 1295 | } |
| 1296 | |
| 1297 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1298 | |
| 1299 | /* Enabling traces. */ |
| 1300 | #ifndef YYDEBUG |
| 1301 | # define YYDEBUG 0 |
| 1302 | #endif |
| 1303 | |
| 1304 | /* Enabling verbose error messages. */ |
| 1305 | #ifdef YYERROR_VERBOSE |
| 1306 | # undef YYERROR_VERBOSE |
| 1307 | # define YYERROR_VERBOSE 1 |
| 1308 | #else |
| 1309 | # define YYERROR_VERBOSE 0 |
| 1310 | #endif |
| 1311 | |
| 1312 | /* Enabling the token table. */ |
| 1313 | #ifndef YYTOKEN_TABLE |
| 1314 | # define YYTOKEN_TABLE 0 |
| 1315 | #endif |
| 1316 | |
| 1317 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
| 1318 | #line 957 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 1319 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1320 | llvm::Module *ModuleVal; |
| 1321 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1322 | llvm::BasicBlock *BasicBlockVal; |
| 1323 | llvm::TerminatorInst *TermInstVal; |
| 1324 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1325 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1326 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1327 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1328 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1329 | llvm::PATypeHolder *TypeVal; |
| 1330 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1331 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1332 | llvm::ArgListType *ArgList; |
| 1333 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1334 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1335 | llvm::ValueRefList *ValueRefList; |
| 1336 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1337 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1338 | std::list<std::pair<llvm::Value*, |
| 1339 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1340 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1341 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1342 | |
| 1343 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1344 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 1345 | uint16_t ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1346 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1347 | int64_t SInt64Val; |
| 1348 | uint64_t UInt64Val; |
| 1349 | int SIntVal; |
| 1350 | unsigned UIntVal; |
| 1351 | double FPVal; |
| 1352 | bool BoolVal; |
| 1353 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1354 | std::string *StrVal; // This memory must be deleted |
| 1355 | llvm::ValID ValIDVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1356 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1357 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1358 | llvm::Instruction::TermOps TermOpVal; |
| 1359 | llvm::Instruction::MemoryOps MemOpVal; |
| 1360 | llvm::Instruction::CastOps CastOpVal; |
| 1361 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1362 | llvm::ICmpInst::Predicate IPredicate; |
| 1363 | llvm::FCmpInst::Predicate FPredicate; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 1364 | } YYSTYPE; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1365 | /* Line 196 of yacc.c. */ |
| 1366 | #line 1367 "llvmAsmParser.tab.c" |
| 1367 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1368 | # define YYSTYPE_IS_DECLARED 1 |
| 1369 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1370 | #endif |
| 1371 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1372 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1373 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1374 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1375 | |
| 1376 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1377 | /* Line 219 of yacc.c. */ |
| 1378 | #line 1379 "llvmAsmParser.tab.c" |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 1379 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1380 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1381 | # define YYSIZE_T __SIZE_TYPE__ |
| 1382 | #endif |
| 1383 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1384 | # define YYSIZE_T size_t |
| 1385 | #endif |
| 1386 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1387 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1388 | # define YYSIZE_T size_t |
| 1389 | #endif |
| 1390 | #if ! defined (YYSIZE_T) |
| 1391 | # define YYSIZE_T unsigned int |
| 1392 | #endif |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 1393 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1394 | #ifndef YY_ |
| 1395 | # if YYENABLE_NLS |
| 1396 | # if ENABLE_NLS |
| 1397 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1398 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1399 | # endif |
| 1400 | # endif |
| 1401 | # ifndef YY_ |
| 1402 | # define YY_(msgid) msgid |
| 1403 | # endif |
| 1404 | #endif |
| 1405 | |
| 1406 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1407 | |
| 1408 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1409 | |
| 1410 | # ifdef YYSTACK_USE_ALLOCA |
| 1411 | # if YYSTACK_USE_ALLOCA |
| 1412 | # ifdef __GNUC__ |
| 1413 | # define YYSTACK_ALLOC __builtin_alloca |
| 1414 | # else |
| 1415 | # define YYSTACK_ALLOC alloca |
| 1416 | # if defined (__STDC__) || defined (__cplusplus) |
| 1417 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1418 | # define YYINCLUDED_STDLIB_H |
| 1419 | # endif |
| 1420 | # endif |
| 1421 | # endif |
| 1422 | # endif |
| 1423 | |
| 1424 | # ifdef YYSTACK_ALLOC |
| 1425 | /* Pacify GCC's `empty if-body' warning. */ |
| 1426 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1427 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1428 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1429 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1430 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1431 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1432 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1433 | # endif |
| 1434 | # else |
| 1435 | # define YYSTACK_ALLOC YYMALLOC |
| 1436 | # define YYSTACK_FREE YYFREE |
| 1437 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1438 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1439 | # endif |
| 1440 | # ifdef __cplusplus |
| 1441 | extern "C" { |
| 1442 | # endif |
| 1443 | # ifndef YYMALLOC |
| 1444 | # define YYMALLOC malloc |
| 1445 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1446 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1447 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1448 | # endif |
| 1449 | # endif |
| 1450 | # ifndef YYFREE |
| 1451 | # define YYFREE free |
| 1452 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1453 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1454 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1455 | # endif |
| 1456 | # endif |
| 1457 | # ifdef __cplusplus |
| 1458 | } |
| 1459 | # endif |
| 1460 | # endif |
| 1461 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1462 | |
| 1463 | |
| 1464 | #if (! defined (yyoverflow) \ |
| 1465 | && (! defined (__cplusplus) \ |
| 1466 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1467 | |
| 1468 | /* A type that is properly aligned for any stack member. */ |
| 1469 | union yyalloc |
| 1470 | { |
| 1471 | short int yyss; |
| 1472 | YYSTYPE yyvs; |
| 1473 | }; |
| 1474 | |
| 1475 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1476 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1477 | |
| 1478 | /* The size of an array large to enough to hold all stacks, each with |
| 1479 | N elements. */ |
| 1480 | # define YYSTACK_BYTES(N) \ |
| 1481 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1482 | + YYSTACK_GAP_MAXIMUM) |
| 1483 | |
| 1484 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1485 | not overlap. */ |
| 1486 | # ifndef YYCOPY |
| 1487 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1488 | # define YYCOPY(To, From, Count) \ |
| 1489 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1490 | # else |
| 1491 | # define YYCOPY(To, From, Count) \ |
| 1492 | do \ |
| 1493 | { \ |
| 1494 | YYSIZE_T yyi; \ |
| 1495 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1496 | (To)[yyi] = (From)[yyi]; \ |
| 1497 | } \ |
| 1498 | while (0) |
| 1499 | # endif |
| 1500 | # endif |
| 1501 | |
| 1502 | /* Relocate STACK from its old location to the new one. The |
| 1503 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1504 | elements in the stack, and YYPTR gives the new location of the |
| 1505 | stack. Advance YYPTR to a properly aligned location for the next |
| 1506 | stack. */ |
| 1507 | # define YYSTACK_RELOCATE(Stack) \ |
| 1508 | do \ |
| 1509 | { \ |
| 1510 | YYSIZE_T yynewbytes; \ |
| 1511 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1512 | Stack = &yyptr->Stack; \ |
| 1513 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1514 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1515 | } \ |
| 1516 | while (0) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 1517 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1518 | #endif |
| 1519 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1520 | #if defined (__STDC__) || defined (__cplusplus) |
| 1521 | typedef signed char yysigned_char; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1522 | #else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1523 | typedef short int yysigned_char; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1524 | #endif |
| 1525 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1526 | /* YYFINAL -- State number of the termination state. */ |
| 1527 | #define YYFINAL 43 |
| 1528 | /* YYLAST -- Last index in YYTABLE. */ |
| 1529 | #define YYLAST 1553 |
| 1530 | |
| 1531 | /* YYNTOKENS -- Number of terminals. */ |
| 1532 | #define YYNTOKENS 157 |
| 1533 | /* YYNNTS -- Number of nonterminals. */ |
| 1534 | #define YYNNTS 82 |
| 1535 | /* YYNRULES -- Number of rules. */ |
| 1536 | #define YYNRULES 304 |
| 1537 | /* YYNRULES -- Number of states. */ |
| 1538 | #define YYNSTATES 588 |
| 1539 | |
| 1540 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1541 | #define YYUNDEFTOK 2 |
| 1542 | #define YYMAXUTOK 397 |
| 1543 | |
| 1544 | #define YYTRANSLATE(YYX) \ |
| 1545 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1546 | |
| 1547 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1548 | static const unsigned char yytranslate[] = |
| 1549 | { |
| 1550 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1551 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1552 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1553 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1554 | 147, 148, 145, 2, 144, 2, 2, 2, 2, 2, |
| 1555 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1556 | 152, 143, 153, 2, 2, 2, 2, 2, 2, 2, |
| 1557 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1558 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1559 | 2, 149, 146, 151, 2, 2, 2, 2, 2, 156, |
| 1560 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1561 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1562 | 150, 2, 2, 154, 2, 155, 2, 2, 2, 2, |
| 1563 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1564 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1565 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1566 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1567 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1568 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1569 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1570 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1571 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1572 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1573 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1574 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1575 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1576 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1577 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1578 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1579 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1580 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1581 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1582 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1583 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1584 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1585 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1586 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1587 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1588 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1589 | 135, 136, 137, 138, 139, 140, 141, 142 |
| 1590 | }; |
| 1591 | |
| 1592 | #if YYDEBUG |
| 1593 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1594 | YYRHS. */ |
| 1595 | static const unsigned short int yyprhs[] = |
| 1596 | { |
| 1597 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1598 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1599 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1600 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1601 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1602 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1603 | 119, 121, 123, 124, 127, 128, 130, 132, 134, 135, |
| 1604 | 138, 140, 142, 144, 146, 148, 150, 152, 154, 155, |
| 1605 | 157, 159, 161, 162, 164, 166, 167, 169, 171, 173, |
| 1606 | 175, 176, 178, 180, 181, 183, 185, 187, 189, 191, |
| 1607 | 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, |
| 1608 | 213, 216, 218, 220, 222, 224, 225, 228, 229, 232, |
| 1609 | 233, 237, 240, 241, 243, 244, 248, 250, 253, 255, |
| 1610 | 257, 259, 261, 263, 265, 268, 270, 273, 279, 285, |
| 1611 | 291, 297, 301, 304, 310, 315, 318, 320, 322, 324, |
| 1612 | 328, 330, 334, 336, 337, 339, 343, 348, 352, 356, |
| 1613 | 361, 366, 370, 377, 383, 386, 389, 392, 395, 398, |
| 1614 | 401, 404, 407, 410, 413, 416, 419, 426, 432, 441, |
| 1615 | 448, 455, 463, 471, 478, 487, 496, 500, 502, 504, |
| 1616 | 506, 508, 509, 512, 519, 521, 522, 524, 527, 528, |
| 1617 | 532, 533, 537, 541, 545, 549, 550, 558, 559, 568, |
| 1618 | 569, 578, 584, 587, 591, 593, 597, 601, 605, 609, |
| 1619 | 611, 612, 618, 622, 624, 628, 630, 631, 641, 643, |
| 1620 | 645, 650, 652, 654, 657, 661, 662, 664, 666, 668, |
| 1621 | 670, 672, 674, 676, 678, 680, 684, 686, 692, 694, |
| 1622 | 696, 698, 700, 702, 704, 707, 710, 713, 717, 720, |
| 1623 | 721, 723, 726, 729, 733, 743, 753, 762, 777, 779, |
| 1624 | 781, 788, 794, 797, 804, 812, 816, 822, 823, 824, |
| 1625 | 828, 831, 833, 839, 845, 852, 859, 864, 871, 876, |
| 1626 | 881, 888, 895, 898, 907, 909, 911, 912, 916, 923, |
| 1627 | 927, 934, 937, 943, 951 |
| 1628 | }; |
| 1629 | |
| 1630 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1631 | static const short int yyrhs[] = |
| 1632 | { |
| 1633 | 201, 0, -1, 70, -1, 71, -1, 72, -1, 73, |
| 1634 | -1, 74, -1, 75, -1, 76, -1, 77, -1, 78, |
| 1635 | -1, 82, -1, 83, -1, 84, -1, 79, -1, 80, |
| 1636 | -1, 81, -1, 113, -1, 114, -1, 115, -1, 116, |
| 1637 | -1, 117, -1, 118, -1, 119, -1, 120, -1, 121, |
| 1638 | -1, 122, -1, 123, -1, 124, -1, 87, -1, 88, |
| 1639 | -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, |
| 1640 | -1, 94, -1, 95, -1, 96, -1, 97, -1, 98, |
| 1641 | -1, 99, -1, 100, -1, 101, -1, 102, -1, 103, |
| 1642 | -1, 104, -1, 105, -1, 106, -1, 93, -1, 94, |
| 1643 | -1, 95, -1, 96, -1, 23, -1, 24, -1, 11, |
| 1644 | -1, 12, -1, 13, -1, 16, -1, 19, -1, 21, |
| 1645 | -1, 165, -1, -1, 165, 143, -1, -1, 17, -1, |
| 1646 | 20, -1, 170, -1, -1, 168, 143, -1, 39, -1, |
| 1647 | 41, -1, 40, -1, 42, -1, 44, -1, 43, -1, |
| 1648 | 45, -1, 47, -1, -1, 140, -1, 141, -1, 142, |
| 1649 | -1, -1, 43, -1, 45, -1, -1, 39, -1, 40, |
| 1650 | -1, 41, -1, 44, -1, -1, 41, -1, 39, -1, |
| 1651 | -1, 58, -1, 59, -1, 60, -1, 61, -1, 62, |
| 1652 | -1, 57, 4, -1, 132, -1, 114, -1, 131, -1, |
| 1653 | 115, -1, 134, -1, 135, -1, 137, -1, 138, -1, |
| 1654 | 139, -1, -1, 179, 178, -1, 133, -1, 136, -1, |
| 1655 | 132, -1, 131, -1, -1, 181, 180, -1, -1, 50, |
| 1656 | 4, -1, -1, 144, 50, 4, -1, 31, 19, -1, |
| 1657 | -1, 184, -1, -1, 144, 187, 186, -1, 184, -1, |
| 1658 | 50, 4, -1, 11, -1, 12, -1, 13, -1, 14, |
| 1659 | -1, 46, -1, 188, -1, 189, 145, -1, 223, -1, |
| 1660 | 146, 4, -1, 189, 147, 193, 148, 181, -1, 10, |
| 1661 | 147, 193, 148, 181, -1, 149, 4, 150, 189, 151, |
| 1662 | -1, 152, 4, 150, 189, 153, -1, 154, 194, 155, |
| 1663 | -1, 154, 155, -1, 152, 154, 194, 155, 153, -1, |
| 1664 | 152, 154, 155, 153, -1, 189, 179, -1, 189, -1, |
| 1665 | 10, -1, 190, -1, 192, 144, 190, -1, 192, -1, |
| 1666 | 192, 144, 36, -1, 36, -1, -1, 189, -1, 194, |
| 1667 | 144, 189, -1, 189, 149, 197, 151, -1, 189, 149, |
| 1668 | 151, -1, 189, 156, 19, -1, 189, 152, 197, 153, |
| 1669 | -1, 189, 154, 197, 155, -1, 189, 154, 155, -1, |
| 1670 | 189, 152, 154, 197, 155, 153, -1, 189, 152, 154, |
| 1671 | 155, 153, -1, 189, 37, -1, 189, 38, -1, 189, |
| 1672 | 223, -1, 189, 196, -1, 189, 22, -1, 163, 3, |
| 1673 | -1, 163, 5, -1, 163, 4, -1, 163, 6, -1, |
| 1674 | 11, 23, -1, 11, 24, -1, 164, 9, -1, 160, |
| 1675 | 147, 195, 35, 189, 148, -1, 112, 147, 195, 234, |
| 1676 | 148, -1, 126, 147, 195, 144, 195, 144, 195, 148, |
| 1677 | -1, 158, 147, 195, 144, 195, 148, -1, 159, 147, |
| 1678 | 195, 144, 195, 148, -1, 85, 161, 147, 195, 144, |
| 1679 | 195, 148, -1, 86, 162, 147, 195, 144, 195, 148, |
| 1680 | -1, 128, 147, 195, 144, 195, 148, -1, 129, 147, |
| 1681 | 195, 144, 195, 144, 195, 148, -1, 130, 147, 195, |
| 1682 | 144, 195, 144, 195, 148, -1, 197, 144, 195, -1, |
| 1683 | 195, -1, 29, -1, 30, -1, 34, -1, -1, 191, |
| 1684 | 223, -1, 118, 147, 200, 35, 189, 148, -1, 202, |
| 1685 | -1, -1, 203, -1, 202, 203, -1, -1, 28, 204, |
| 1686 | 219, -1, -1, 27, 205, 220, -1, 55, 54, 209, |
| 1687 | -1, 167, 15, 189, -1, 167, 15, 10, -1, -1, |
| 1688 | 169, 173, 199, 198, 195, 206, 186, -1, -1, 169, |
| 1689 | 171, 173, 199, 198, 195, 207, 186, -1, -1, 169, |
| 1690 | 172, 173, 199, 198, 189, 208, 186, -1, 169, 173, |
| 1691 | 32, 176, 200, -1, 48, 210, -1, 51, 143, 211, |
| 1692 | -1, 19, -1, 49, 143, 19, -1, 63, 143, 19, |
| 1693 | -1, 149, 212, 151, -1, 212, 144, 19, -1, 19, |
| 1694 | -1, -1, 213, 144, 189, 179, 166, -1, 189, 179, |
| 1695 | 166, -1, 213, -1, 213, 144, 36, -1, 36, -1, |
| 1696 | -1, 177, 191, 168, 147, 214, 148, 181, 185, 182, |
| 1697 | -1, 25, -1, 154, -1, 175, 173, 215, 216, -1, |
| 1698 | 26, -1, 155, -1, 226, 218, -1, 174, 173, 215, |
| 1699 | -1, -1, 56, -1, 3, -1, 4, -1, 9, -1, |
| 1700 | 23, -1, 24, -1, 37, -1, 38, -1, 22, -1, |
| 1701 | 152, 197, 153, -1, 196, -1, 54, 221, 19, 144, |
| 1702 | 19, -1, 7, -1, 8, -1, 165, -1, 168, -1, |
| 1703 | 223, -1, 222, -1, 189, 224, -1, 226, 227, -1, |
| 1704 | 217, 227, -1, 228, 167, 229, -1, 228, 231, -1, |
| 1705 | -1, 18, -1, 64, 225, -1, 64, 10, -1, 65, |
| 1706 | 14, 224, -1, 65, 11, 224, 144, 14, 224, 144, |
| 1707 | 14, 224, -1, 66, 163, 224, 144, 14, 224, 149, |
| 1708 | 230, 151, -1, 66, 163, 224, 144, 14, 224, 149, |
| 1709 | 151, -1, 67, 177, 191, 224, 147, 233, 148, 181, |
| 1710 | 35, 14, 224, 68, 14, 224, -1, 68, -1, 69, |
| 1711 | -1, 230, 163, 222, 144, 14, 224, -1, 163, 222, |
| 1712 | 144, 14, 224, -1, 167, 236, -1, 189, 149, 224, |
| 1713 | 144, 224, 151, -1, 232, 144, 149, 224, 144, 224, |
| 1714 | 151, -1, 189, 224, 179, -1, 233, 144, 189, 224, |
| 1715 | 179, -1, -1, -1, 234, 144, 225, -1, 53, 52, |
| 1716 | -1, 52, -1, 158, 189, 224, 144, 224, -1, 159, |
| 1717 | 189, 224, 144, 224, -1, 85, 161, 189, 224, 144, |
| 1718 | 224, -1, 86, 162, 189, 224, 144, 224, -1, 160, |
| 1719 | 225, 35, 189, -1, 126, 225, 144, 225, 144, 225, |
| 1720 | -1, 127, 225, 144, 189, -1, 128, 225, 144, 225, |
| 1721 | -1, 129, 225, 144, 225, 144, 225, -1, 130, 225, |
| 1722 | 144, 225, 144, 225, -1, 125, 232, -1, 235, 177, |
| 1723 | 191, 224, 147, 233, 148, 181, -1, 238, -1, 33, |
| 1724 | -1, -1, 107, 189, 183, -1, 107, 189, 144, 11, |
| 1725 | 224, 183, -1, 108, 189, 183, -1, 108, 189, 144, |
| 1726 | 11, 224, 183, -1, 109, 225, -1, 237, 110, 189, |
| 1727 | 224, 183, -1, 237, 111, 225, 144, 189, 224, 183, |
| 1728 | -1, 112, 189, 224, 234, -1 |
| 1729 | }; |
| 1730 | |
| 1731 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1732 | static const unsigned short int yyrline[] = |
| 1733 | { |
| 1734 | 0, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, |
| 1735 | 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1118, 1118, 1118, |
| 1736 | 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1122, |
| 1737 | 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1130, |
| 1738 | 1130, 1131, 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1135, |
| 1739 | 1135, 1136, 1136, 1137, 1138, 1143, 1144, 1144, 1146, 1146, |
| 1740 | 1146, 1147, 1147, 1151, 1155, 1160, 1160, 1162, 1163, 1168, |
| 1741 | 1174, 1175, 1176, 1177, 1178, 1182, 1183, 1184, 1188, 1189, |
| 1742 | 1190, 1191, 1195, 1196, 1197, 1201, 1202, 1203, 1204, 1205, |
| 1743 | 1209, 1210, 1211, 1214, 1215, 1216, 1217, 1218, 1219, 1220, |
| 1744 | 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1238, |
| 1745 | 1239, 1244, 1245, 1246, 1247, 1250, 1251, 1258, 1259, 1265, |
| 1746 | 1266, 1274, 1282, 1283, 1288, 1289, 1290, 1295, 1308, 1308, |
| 1747 | 1308, 1308, 1311, 1315, 1319, 1326, 1331, 1339, 1369, 1400, |
| 1748 | 1405, 1417, 1427, 1431, 1441, 1448, 1455, 1462, 1467, 1472, |
| 1749 | 1479, 1480, 1487, 1494, 1502, 1508, 1520, 1548, 1564, 1591, |
| 1750 | 1619, 1645, 1665, 1691, 1711, 1723, 1730, 1796, 1806, 1816, |
| 1751 | 1822, 1832, 1838, 1848, 1853, 1858, 1866, 1878, 1900, 1908, |
| 1752 | 1914, 1925, 1930, 1935, 1941, 1947, 1956, 1960, 1968, 1968, |
| 1753 | 1971, 1971, 1974, 1985, 2006, 2011, 2019, 2020, 2024, 2024, |
| 1754 | 2028, 2028, 2031, 2034, 2058, 2069, 2069, 2080, 2079, 2089, |
| 1755 | 2088, 2099, 2118, 2121, 2127, 2137, 2141, 2146, 2148, 2153, |
| 1756 | 2158, 2167, 2177, 2188, 2192, 2201, 2210, 2215, 2336, 2336, |
| 1757 | 2338, 2347, 2347, 2349, 2354, 2366, 2370, 2375, 2379, 2383, |
| 1758 | 2387, 2391, 2395, 2399, 2403, 2407, 2432, 2436, 2446, 2450, |
| 1759 | 2454, 2459, 2466, 2466, 2472, 2481, 2485, 2494, 2503, 2512, |
| 1760 | 2516, 2523, 2527, 2531, 2536, 2546, 2565, 2574, 2654, 2658, |
| 1761 | 2665, 2676, 2689, 2699, 2710, 2720, 2729, 2738, 2741, 2742, |
| 1762 | 2749, 2753, 2758, 2779, 2796, 2810, 2824, 2836, 2844, 2851, |
| 1763 | 2857, 2863, 2869, 2884, 2969, 2974, 2978, 2985, 2992, 3000, |
| 1764 | 3007, 3015, 3023, 3037, 3054 |
| 1765 | }; |
| 1766 | #endif |
| 1767 | |
| 1768 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1769 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1770 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1771 | static const char *const yytname[] = |
| 1772 | { |
| 1773 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1774 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1775 | "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR", |
| 1776 | "STRINGCONSTANT", "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", |
| 1777 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1778 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "ALIAS", |
| 1779 | "VOLATILE", "THREAD_LOCAL", "TO", "DOTDOTDOT", "NULL_TOK", "UNDEF", |
| 1780 | "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", |
| 1781 | "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", |
| 1782 | "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", |
| 1783 | "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", |
| 1784 | "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", |
| 1785 | "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", |
| 1786 | "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", |
| 1787 | "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", |
| 1788 | "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", |
| 1789 | "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", |
| 1790 | "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", |
| 1791 | "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", |
| 1792 | "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", |
| 1793 | "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", |
| 1794 | "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "DEFAULT", "HIDDEN", "PROTECTED", |
| 1795 | "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", |
| 1796 | "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", |
| 1797 | "CastOps", "IPredicates", "FPredicates", "IntType", "FPType", |
| 1798 | "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName", |
| 1799 | "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", |
| 1800 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1801 | "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr", |
| 1802 | "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", |
| 1803 | "SectionString", "OptSection", "GlobalVarAttributes", |
| 1804 | "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", |
| 1805 | "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", |
| 1806 | "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", |
| 1807 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1808 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1809 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1810 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1811 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", |
| 1812 | "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", |
| 1813 | "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal", |
| 1814 | "OptVolatile", "MemoryInst", 0 |
| 1815 | }; |
| 1816 | #endif |
| 1817 | |
| 1818 | # ifdef YYPRINT |
| 1819 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1820 | token YYLEX-NUM. */ |
| 1821 | static const unsigned short int yytoknum[] = |
| 1822 | { |
| 1823 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1824 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1825 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1826 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1827 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1828 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1829 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1830 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1831 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1832 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1833 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1834 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1835 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1836 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1837 | 395, 396, 397, 61, 44, 42, 92, 40, 41, 91, |
| 1838 | 120, 93, 60, 62, 123, 125, 99 |
| 1839 | }; |
| 1840 | # endif |
| 1841 | |
| 1842 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1843 | static const unsigned char yyr1[] = |
| 1844 | { |
| 1845 | 0, 157, 158, 158, 158, 158, 158, 158, 158, 158, |
| 1846 | 158, 159, 159, 159, 159, 159, 159, 160, 160, 160, |
| 1847 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 161, |
| 1848 | 161, 161, 161, 161, 161, 161, 161, 161, 161, 162, |
| 1849 | 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, |
| 1850 | 162, 162, 162, 162, 162, 163, 164, 164, 165, 165, |
| 1851 | 165, 166, 166, 167, 167, 168, 168, 169, 169, 170, |
| 1852 | 171, 171, 171, 171, 171, 172, 172, 172, 173, 173, |
| 1853 | 173, 173, 174, 174, 174, 175, 175, 175, 175, 175, |
| 1854 | 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, |
| 1855 | 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, |
| 1856 | 179, 180, 180, 180, 180, 181, 181, 182, 182, 183, |
| 1857 | 183, 184, 185, 185, 186, 186, 187, 187, 188, 188, |
| 1858 | 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, |
| 1859 | 189, 189, 189, 189, 189, 190, 191, 191, 192, 192, |
| 1860 | 193, 193, 193, 193, 194, 194, 195, 195, 195, 195, |
| 1861 | 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, |
| 1862 | 195, 195, 195, 195, 195, 195, 196, 196, 196, 196, |
| 1863 | 196, 196, 196, 196, 196, 196, 197, 197, 198, 198, |
| 1864 | 199, 199, 200, 200, 201, 201, 202, 202, 204, 203, |
| 1865 | 205, 203, 203, 203, 203, 206, 203, 207, 203, 208, |
| 1866 | 203, 203, 203, 203, 209, 210, 210, 211, 212, 212, |
| 1867 | 212, 213, 213, 214, 214, 214, 214, 215, 216, 216, |
| 1868 | 217, 218, 218, 219, 220, 221, 221, 222, 222, 222, |
| 1869 | 222, 222, 222, 222, 222, 222, 222, 222, 223, 223, |
| 1870 | 223, 223, 224, 224, 225, 226, 226, 227, 228, 228, |
| 1871 | 228, 229, 229, 229, 229, 229, 229, 229, 229, 229, |
| 1872 | 230, 230, 231, 232, 232, 233, 233, 233, 234, 234, |
| 1873 | 235, 235, 236, 236, 236, 236, 236, 236, 236, 236, |
| 1874 | 236, 236, 236, 236, 236, 237, 237, 238, 238, 238, |
| 1875 | 238, 238, 238, 238, 238 |
| 1876 | }; |
| 1877 | |
| 1878 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1879 | static const unsigned char yyr2[] = |
| 1880 | { |
| 1881 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1882 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1883 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1884 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1885 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1886 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1887 | 1, 1, 0, 2, 0, 1, 1, 1, 0, 2, |
| 1888 | 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, |
| 1889 | 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, |
| 1890 | 0, 1, 1, 0, 1, 1, 1, 1, 1, 2, |
| 1891 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, |
| 1892 | 2, 1, 1, 1, 1, 0, 2, 0, 2, 0, |
| 1893 | 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, |
| 1894 | 1, 1, 1, 1, 2, 1, 2, 5, 5, 5, |
| 1895 | 5, 3, 2, 5, 4, 2, 1, 1, 1, 3, |
| 1896 | 1, 3, 1, 0, 1, 3, 4, 3, 3, 4, |
| 1897 | 4, 3, 6, 5, 2, 2, 2, 2, 2, 2, |
| 1898 | 2, 2, 2, 2, 2, 2, 6, 5, 8, 6, |
| 1899 | 6, 7, 7, 6, 8, 8, 3, 1, 1, 1, |
| 1900 | 1, 0, 2, 6, 1, 0, 1, 2, 0, 3, |
| 1901 | 0, 3, 3, 3, 3, 0, 7, 0, 8, 0, |
| 1902 | 8, 5, 2, 3, 1, 3, 3, 3, 3, 1, |
| 1903 | 0, 5, 3, 1, 3, 1, 0, 9, 1, 1, |
| 1904 | 4, 1, 1, 2, 3, 0, 1, 1, 1, 1, |
| 1905 | 1, 1, 1, 1, 1, 3, 1, 5, 1, 1, |
| 1906 | 1, 1, 1, 1, 2, 2, 2, 3, 2, 0, |
| 1907 | 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, |
| 1908 | 6, 5, 2, 6, 7, 3, 5, 0, 0, 3, |
| 1909 | 2, 1, 5, 5, 6, 6, 4, 6, 4, 4, |
| 1910 | 6, 6, 2, 8, 1, 1, 0, 3, 6, 3, |
| 1911 | 6, 2, 5, 7, 4 |
| 1912 | }; |
| 1913 | |
| 1914 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1915 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1916 | means the default is an error. */ |
| 1917 | static const unsigned short int yydefact[] = |
| 1918 | { |
| 1919 | 68, 58, 65, 59, 66, 60, 200, 198, 0, 0, |
| 1920 | 0, 0, 0, 0, 78, 67, 0, 68, 196, 82, |
| 1921 | 85, 0, 0, 212, 0, 0, 63, 0, 69, 70, |
| 1922 | 72, 71, 73, 75, 74, 76, 77, 79, 80, 81, |
| 1923 | 78, 78, 191, 1, 197, 83, 84, 78, 201, 86, |
| 1924 | 87, 88, 89, 78, 259, 199, 259, 0, 0, 220, |
| 1925 | 213, 214, 202, 248, 249, 204, 128, 129, 130, 131, |
| 1926 | 132, 0, 0, 0, 0, 250, 251, 133, 203, 135, |
| 1927 | 191, 191, 90, 190, 0, 93, 93, 260, 256, 64, |
| 1928 | 231, 232, 233, 255, 215, 216, 219, 0, 153, 136, |
| 1929 | 0, 0, 0, 0, 142, 154, 0, 134, 153, 0, |
| 1930 | 0, 92, 91, 0, 188, 189, 0, 0, 94, 95, |
| 1931 | 96, 97, 98, 0, 234, 0, 296, 258, 0, 217, |
| 1932 | 152, 109, 148, 150, 0, 0, 0, 0, 0, 0, |
| 1933 | 141, 0, 0, 0, 147, 0, 146, 0, 211, 128, |
| 1934 | 129, 130, 0, 0, 0, 205, 99, 0, 228, 229, |
| 1935 | 230, 295, 281, 0, 0, 0, 0, 93, 268, 269, |
| 1936 | 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, |
| 1937 | 15, 16, 11, 12, 13, 0, 0, 0, 0, 0, |
| 1938 | 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
| 1939 | 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, |
| 1940 | 0, 0, 257, 93, 272, 0, 294, 218, 145, 0, |
| 1941 | 115, 0, 0, 144, 0, 155, 115, 207, 209, 0, |
| 1942 | 192, 173, 174, 169, 171, 170, 172, 175, 168, 164, |
| 1943 | 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1944 | 0, 0, 0, 0, 0, 167, 166, 124, 0, 280, |
| 1945 | 262, 0, 261, 0, 0, 55, 0, 0, 29, 30, |
| 1946 | 31, 32, 33, 34, 35, 36, 37, 38, 0, 53, |
| 1947 | 54, 49, 50, 51, 52, 39, 40, 41, 42, 43, |
| 1948 | 44, 45, 46, 47, 48, 0, 119, 119, 301, 0, |
| 1949 | 0, 292, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1950 | 0, 0, 0, 101, 103, 102, 100, 104, 105, 106, |
| 1951 | 107, 108, 110, 151, 149, 138, 139, 140, 143, 137, |
| 1952 | 124, 124, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1953 | 157, 187, 0, 0, 0, 161, 0, 158, 0, 0, |
| 1954 | 0, 0, 206, 226, 237, 238, 239, 244, 240, 241, |
| 1955 | 242, 243, 235, 0, 246, 253, 252, 254, 0, 263, |
| 1956 | 0, 0, 0, 0, 0, 297, 0, 299, 278, 0, |
| 1957 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1958 | 0, 0, 114, 113, 111, 112, 116, 208, 210, 0, |
| 1959 | 0, 0, 278, 0, 0, 0, 0, 0, 156, 142, |
| 1960 | 154, 0, 159, 160, 0, 0, 0, 0, 0, 126, |
| 1961 | 124, 225, 109, 223, 0, 236, 0, 0, 0, 0, |
| 1962 | 0, 0, 0, 0, 0, 0, 304, 0, 0, 0, |
| 1963 | 288, 289, 0, 0, 0, 0, 286, 0, 119, 0, |
| 1964 | 0, 0, 0, 0, 0, 0, 0, 0, 186, 163, |
| 1965 | 0, 0, 0, 0, 121, 127, 125, 62, 0, 115, |
| 1966 | 0, 245, 0, 0, 277, 0, 0, 119, 120, 119, |
| 1967 | 0, 0, 0, 0, 0, 0, 282, 283, 277, 0, |
| 1968 | 302, 0, 193, 0, 0, 177, 0, 0, 0, 0, |
| 1969 | 162, 0, 0, 0, 61, 222, 224, 109, 122, 0, |
| 1970 | 0, 0, 0, 0, 284, 285, 298, 300, 279, 0, |
| 1971 | 0, 287, 290, 291, 0, 119, 0, 0, 0, 183, |
| 1972 | 0, 0, 179, 180, 176, 62, 123, 117, 247, 0, |
| 1973 | 0, 109, 0, 115, 273, 0, 115, 303, 181, 182, |
| 1974 | 0, 0, 0, 221, 0, 227, 0, 266, 0, 0, |
| 1975 | 275, 0, 0, 274, 293, 178, 184, 185, 118, 264, |
| 1976 | 0, 265, 0, 109, 0, 0, 0, 276, 0, 0, |
| 1977 | 0, 0, 271, 0, 0, 270, 0, 267 |
| 1978 | }; |
| 1979 | |
| 1980 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1981 | static const short int yydefgoto[] = |
| 1982 | { |
| 1983 | -1, 252, 253, 254, 278, 295, 152, 153, 75, 505, |
| 1984 | 12, 76, 14, 15, 40, 41, 42, 47, 53, 113, |
| 1985 | 123, 322, 218, 396, 325, 555, 375, 419, 537, 352, |
| 1986 | 420, 77, 154, 132, 147, 133, 134, 106, 341, 364, |
| 1987 | 342, 116, 84, 148, 16, 17, 18, 20, 19, 257, |
| 1988 | 330, 331, 62, 23, 60, 97, 423, 424, 124, 160, |
| 1989 | 54, 92, 55, 48, 426, 365, 79, 367, 262, 56, |
| 1990 | 88, 89, 212, 559, 127, 301, 513, 436, 213, 214, |
| 1991 | 215, 216 |
| 1992 | }; |
| 1993 | |
| 1994 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1995 | STATE-NUM. */ |
| 1996 | #define YYPACT_NINF -522 |
| 1997 | static const short int yypact[] = |
| 1998 | { |
| 1999 | 40, -522, -522, -522, -522, -522, -522, -522, -24, -105, |
| 2000 | -4, -80, 60, -32, 461, -522, 134, 1386, -522, 153, |
| 2001 | 150, 1, 15, -522, 16, 130, -522, 1208, -522, -522, |
| 2002 | -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, |
| 2003 | 126, 126, 239, -522, -522, -522, -522, 126, -522, -522, |
| 2004 | -522, -522, -522, 126, 158, -522, -7, 168, 183, 194, |
| 2005 | -522, -522, -522, -522, -522, 45, -522, -522, -522, -522, |
| 2006 | -522, 212, 226, 6, 198, -522, -522, -522, 127, -522, |
| 2007 | 204, 204, 248, -522, 218, 113, 113, -522, -522, 135, |
| 2008 | -522, -522, -522, -522, -522, -522, -522, -44, 1006, -522, |
| 2009 | 101, 107, 371, 45, -522, 127, -103, -522, 1006, 218, |
| 2010 | 218, -522, -522, 1043, -522, -522, 1223, 259, -522, -522, |
| 2011 | -522, -522, -522, 1274, -522, -13, 1423, -522, 269, -522, |
| 2012 | -522, 127, -522, 162, 146, 1305, 1305, 144, -101, 1305, |
| 2013 | -522, 159, 1223, 1305, 45, 161, 127, 85, -522, 41, |
| 2014 | 301, 302, 250, 304, 782, -522, -522, 79, -522, -522, |
| 2015 | -522, -522, -522, 263, 1320, 193, 305, 113, -522, -522, |
| 2016 | -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, |
| 2017 | -522, -522, -522, -522, -522, 133, 456, 1305, 1305, 1305, |
| 2018 | 1305, -522, -522, -522, -522, -522, -522, -522, -522, -522, |
| 2019 | -522, -522, -522, 1305, 1305, 1305, 1305, 1305, 1305, 1305, |
| 2020 | 1305, 1305, -522, 113, -522, 165, -522, -522, 519, 1060, |
| 2021 | -522, -18, -33, -522, 166, 127, -522, -522, 127, 1043, |
| 2022 | -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, |
| 2023 | -522, 133, 456, 171, 174, 175, 177, 178, 1111, 1371, |
| 2024 | 579, 307, 181, 182, 184, -522, -522, 186, 187, -522, |
| 2025 | 45, 623, -522, 757, 757, -522, 757, 1274, -522, -522, |
| 2026 | -522, -522, -522, -522, -522, -522, -522, -522, 1305, -522, |
| 2027 | -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, |
| 2028 | -522, -522, -522, -522, -522, 1305, 98, 114, -522, 623, |
| 2029 | -64, 195, 196, 201, 202, 210, 216, 623, 623, 303, |
| 2030 | 1274, 1305, 1305, -522, -522, -522, -522, -522, -522, -522, |
| 2031 | -522, -522, -522, -522, -522, 104, -522, -522, -522, 104, |
| 2032 | 186, 186, 313, 190, 214, 1223, 1223, 1223, 1223, 1223, |
| 2033 | -522, -522, -36, 962, -111, -522, -78, -522, 1223, 1223, |
| 2034 | 1223, 3, -522, 1126, -522, -522, -522, -522, -522, -522, |
| 2035 | -522, -522, 308, 1223, -522, -522, -522, -522, 219, -522, |
| 2036 | 221, 757, 623, 623, 20, -522, 21, -522, -522, 757, |
| 2037 | 225, 1305, 1305, 1305, 1305, 1305, 224, 227, 1305, 757, |
| 2038 | 623, 231, -522, -522, -522, -522, -522, -522, -522, 1305, |
| 2039 | 1223, 1223, -522, 233, 242, 245, 249, 1223, -522, 217, |
| 2040 | 782, -65, -522, -522, 256, 257, 359, 386, 402, -522, |
| 2041 | 186, -522, 127, 265, 264, -522, 394, -75, 400, 401, |
| 2042 | 271, 275, 276, 757, 418, 757, 282, 285, 757, 289, |
| 2043 | 127, -522, 290, 296, 757, 757, 127, 294, 300, 1305, |
| 2044 | -29, 306, 309, -50, 1223, 1223, 1223, 1223, -522, -522, |
| 2045 | 292, 1223, 1223, 1305, -522, -522, -522, 293, 1157, -522, |
| 2046 | 311, -522, 757, 757, 1305, 757, 757, 300, -522, 300, |
| 2047 | 1305, 757, 312, 1305, 1305, 1305, -522, -522, 1305, 397, |
| 2048 | -522, 623, -522, 1223, 1223, -522, 316, 315, 317, 320, |
| 2049 | -522, 318, 321, 117, -522, -522, -522, 127, -1, 430, |
| 2050 | 324, 322, 623, -8, -522, -522, -522, -522, -522, 314, |
| 2051 | 757, -522, -522, -522, -5, 300, 329, 330, 1223, -522, |
| 2052 | 1223, 1223, -522, -522, -522, 293, -522, 431, -522, 437, |
| 2053 | 2, -522, 1305, -522, -522, 332, -522, -522, -522, -522, |
| 2054 | 336, 337, 338, -522, 448, -522, 757, -522, 917, 4, |
| 2055 | 519, 623, 14, -522, 104, -522, -522, -522, -522, -522, |
| 2056 | 343, -522, 917, -522, 474, 475, 346, 519, 757, 757, |
| 2057 | 477, 426, -522, 757, 481, -522, 757, -522 |
| 2058 | }; |
| 2059 | |
| 2060 | /* YYPGOTO[NTERM-NUM]. */ |
| 2061 | static const short int yypgoto[] = |
| 2062 | { |
| 2063 | -522, 370, 372, 373, 266, 255, -164, -522, 0, -25, |
| 2064 | 420, 9, -522, -522, -522, -522, 33, -522, -522, -522, |
| 2065 | -151, -522, -404, -522, -223, -522, -291, 5, -522, -295, |
| 2066 | -522, -522, -26, 295, -115, -522, 403, 410, -58, -150, |
| 2067 | -221, 173, 222, 286, -522, -522, 501, -522, -522, -522, |
| 2068 | -522, -522, -522, -522, -522, -522, -522, -522, 433, -522, |
| 2069 | -522, -522, -522, -522, -522, -521, -140, 103, -184, -522, |
| 2070 | 465, -522, -522, -522, -522, -522, 34, 122, -522, -522, |
| 2071 | -522, -522 |
| 2072 | }; |
| 2073 | |
| 2074 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2075 | positive, shift that token. If negative, reduce the rule which |
| 2076 | number is the opposite. If zero, do what YYDEFACT says. |
| 2077 | If YYTABLE_NINF, syntax error. */ |
| 2078 | #define YYTABLE_NINF -196 |
| 2079 | static const short int yytable[] = |
| 2080 | { |
| 2081 | 11, 78, 266, 329, 255, 298, 377, 230, 157, 13, |
| 2082 | 101, 87, 158, 265, 256, 265, 267, 11, 467, 90, |
| 2083 | 302, 303, 304, 305, 306, 21, 13, 309, 344, 346, |
| 2084 | 417, 433, 435, 407, 417, 397, 398, 570, 24, 22, |
| 2085 | -195, 139, 412, 139, -55, -55, -55, -55, 105, 574, |
| 2086 | 25, 576, 140, 418, 224, -64, 1, 2, 155, 3, |
| 2087 | 4, 5, 310, 26, 231, 232, 407, 6, 7, 407, |
| 2088 | 434, 434, 131, 80, 81, 27, 105, 413, 471, 407, |
| 2089 | 85, 107, 131, 108, 227, 379, 86, 146, 8, 11, |
| 2090 | 460, 9, 63, 64, 480, 10, 2, 146, 495, 4, |
| 2091 | 128, 1, 2, 535, 3, 4, 5, 129, 407, 221, |
| 2092 | 222, 28, 107, 225, 108, 408, 107, 228, 108, 492, |
| 2093 | 327, 366, 411, 366, 366, 466, 366, 107, 391, 108, |
| 2094 | 392, 393, 394, 326, 43, 395, 542, 560, 261, 542, |
| 2095 | 543, 159, 427, 546, 57, 392, 393, 394, 91, 61, |
| 2096 | 395, 1, 371, 557, 3, 571, 5, 490, 58, 366, |
| 2097 | 102, 296, 297, 261, 299, 59, 258, 366, 366, 577, |
| 2098 | 117, 118, 119, 120, 121, 122, 87, 300, 261, 261, |
| 2099 | 261, 261, 261, 307, 308, 261, 516, 94, 517, 49, |
| 2100 | 50, 51, 98, 131, 52, 389, 45, 439, 46, 441, |
| 2101 | 442, 443, 95, 146, 263, 63, 64, 264, 103, 66, |
| 2102 | 67, 68, 69, 96, 1, 2, 99, 3, 4, 5, |
| 2103 | 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, |
| 2104 | 100, 366, 366, 366, 547, 392, 393, 394, 83, 366, |
| 2105 | 395, 146, 374, 107, 70, 108, 508, 114, 115, 366, |
| 2106 | 366, 135, 372, 233, 234, 235, 236, 136, 376, 107, |
| 2107 | 255, 108, 107, 156, 108, 534, 37, 38, 39, 373, |
| 2108 | 256, 82, 107, 83, 108, 311, 312, 402, 403, 404, |
| 2109 | 405, 406, 142, 143, 146, 390, 261, 111, 217, 112, |
| 2110 | 414, 415, 416, 366, 220, 366, 518, 223, 366, 521, |
| 2111 | 522, 523, 109, 110, 366, 366, 219, 226, 229, 1, |
| 2112 | -56, -57, 3, 237, 5, 259, 265, 410, 335, 328, |
| 2113 | 562, 336, 337, 564, 338, 339, 347, 422, 348, 349, |
| 2114 | 351, 350, 366, 366, 353, 366, 366, 400, 388, 380, |
| 2115 | 381, 366, 451, 452, 71, 382, 383, 72, 399, 458, |
| 2116 | 73, 366, 74, 104, 384, 261, 440, 261, 261, 261, |
| 2117 | 385, 401, 446, 428, 425, 429, 368, 369, 444, 370, |
| 2118 | 459, 445, 366, 450, 438, 449, 558, 454, 63, 64, |
| 2119 | 366, 103, 66, 67, 68, 69, 455, 1, 2, 456, |
| 2120 | 3, 4, 5, 457, 463, 572, 496, 497, 498, 499, |
| 2121 | 461, 462, 378, 501, 502, 464, 465, 313, 314, 468, |
| 2122 | 386, 387, 469, 470, 472, 473, 366, 70, 474, 475, |
| 2123 | 476, 366, 478, 491, 315, 316, 480, 317, 318, 481, |
| 2124 | 319, 320, 321, 483, 484, 526, 527, 503, 366, 366, |
| 2125 | 485, 488, 507, 366, 489, 500, 366, 434, 512, 538, |
| 2126 | 493, 556, 568, 494, 261, 509, 520, 261, 261, 261, |
| 2127 | 528, 530, 512, 529, 531, 544, 532, 504, 539, 533, |
| 2128 | 550, 540, 551, 552, 430, 431, 432, 548, 549, 279, |
| 2129 | 280, 554, 437, 563, 565, 566, 567, 575, 578, 579, |
| 2130 | 580, 583, 447, 448, 584, 586, 209, 334, 210, 211, |
| 2131 | 29, 30, 31, 32, 33, 34, 35, 333, 36, 126, |
| 2132 | 553, 141, 138, 536, 324, 332, 561, 71, 44, 125, |
| 2133 | 72, 93, 524, 73, 453, 74, 137, 0, 0, 0, |
| 2134 | 0, 0, 0, 0, 0, 504, 477, 0, 479, 0, |
| 2135 | 0, 482, 0, 0, 0, 0, 0, 486, 487, 281, |
| 2136 | 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, |
| 2137 | 292, 293, 294, 0, 0, 0, 0, 0, 0, 0, |
| 2138 | 0, 0, 0, 0, 0, 510, 511, 0, 514, 515, |
| 2139 | 0, 0, 0, 0, 519, 0, 63, 64, 0, 103, |
| 2140 | 149, 150, 151, 69, 525, 1, 2, 0, 3, 4, |
| 2141 | 5, 37, 38, 39, 0, 0, 0, 0, 0, 0, |
| 2142 | 0, 0, 0, 0, 0, 541, 0, 0, 0, 0, |
| 2143 | 0, 0, 0, 545, 0, 70, 354, 355, 0, 0, |
| 2144 | 63, 64, 356, 313, 314, 0, 0, 0, 0, 1, |
| 2145 | 2, 0, 3, 4, 5, 357, 358, 359, 0, 0, |
| 2146 | 315, 316, 0, 317, 318, 0, 319, 320, 321, 569, |
| 2147 | 360, 361, 0, 0, 573, 0, 0, 0, 0, 0, |
| 2148 | 0, 0, 0, 0, 0, 0, 0, 362, 0, 0, |
| 2149 | 0, 581, 582, 0, 0, 0, 585, 0, 0, 587, |
| 2150 | 0, 0, 0, 170, 171, 172, 173, 174, 175, 176, |
| 2151 | 177, 178, 179, 180, 181, 182, 183, 184, 241, 242, |
| 2152 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2153 | 0, 0, 0, 0, 0, 71, 0, 0, 72, 0, |
| 2154 | 0, 73, 0, 74, 345, 243, 191, 192, 193, 194, |
| 2155 | 195, 196, 197, 198, 199, 200, 201, 202, 0, 244, |
| 2156 | 0, 245, 246, 247, 0, 0, 0, 0, 0, 0, |
| 2157 | 354, 355, 0, 0, 63, 64, 356, 0, 107, 0, |
| 2158 | 108, 0, 0, 1, 2, 363, 3, 4, 5, 357, |
| 2159 | 358, 359, 0, 0, 0, 0, 0, 0, 0, 63, |
| 2160 | 64, 0, 0, 0, 360, 361, 0, 0, 1, 2, |
| 2161 | 0, 3, 4, 5, 238, 0, 0, 0, 0, 0, |
| 2162 | 0, 362, 0, 0, 0, 0, 0, 0, 0, 239, |
| 2163 | 240, 0, 0, 0, 0, 0, 0, 170, 171, 172, |
| 2164 | 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, |
| 2165 | 183, 184, 241, 242, 0, 0, 0, 0, 0, 0, |
| 2166 | 0, 0, 170, 171, 172, 173, 174, 175, 176, 177, |
| 2167 | 178, 179, 180, 181, 182, 183, 184, 241, 242, 243, |
| 2168 | 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, |
| 2169 | 201, 202, 0, 244, 0, 245, 246, 247, 0, 0, |
| 2170 | 0, 0, 0, 0, 243, 191, 192, 193, 194, 195, |
| 2171 | 196, 197, 198, 199, 200, 201, 202, 0, 244, 363, |
| 2172 | 245, 246, 247, 0, 0, 0, 0, 0, 0, 0, |
| 2173 | 354, 355, 0, 0, 0, 0, 356, 107, 0, 108, |
| 2174 | 0, 248, 0, 0, 249, 0, 250, 0, 251, 357, |
| 2175 | 358, 359, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2176 | 0, 0, 0, 0, 360, 361, 0, 0, 0, 0, |
| 2177 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, |
| 2178 | 64, 362, 103, 149, 150, 151, 69, 0, 1, 2, |
| 2179 | 0, 3, 4, 5, 0, 0, 0, 170, 171, 172, |
| 2180 | 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, |
| 2181 | 183, 184, 241, 242, 0, 0, 0, 0, 70, 0, |
| 2182 | 0, 0, 0, 63, 64, 0, 103, 66, 67, 68, |
| 2183 | 69, 0, 1, 2, 0, 3, 4, 5, 0, 243, |
| 2184 | 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, |
| 2185 | 201, 202, 130, 244, 0, 245, 246, 247, 0, 0, |
| 2186 | 63, 64, 70, 144, 66, 67, 68, 69, 0, 1, |
| 2187 | 2, 0, 3, 4, 5, 0, 0, 63, 64, 363, |
| 2188 | 103, 66, 67, 68, 69, 0, 1, 2, 0, 3, |
| 2189 | 4, 5, 0, 0, 0, 0, 0, 0, 0, 70, |
| 2190 | 0, 0, 0, 0, 0, 0, 323, 0, 0, 0, |
| 2191 | 0, 0, 0, 0, 0, 0, 70, 0, 71, 0, |
| 2192 | 0, 72, 0, 0, 73, 0, 74, 409, 63, 64, |
| 2193 | 0, 103, 149, 150, 151, 69, 0, 1, 2, 0, |
| 2194 | 3, 4, 5, 63, 64, 0, 103, 66, 67, 68, |
| 2195 | 69, 0, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2196 | 0, 0, 71, 0, 0, 72, 0, 70, 73, 0, |
| 2197 | 74, 145, 421, 0, 63, 64, 0, 103, 66, 67, |
| 2198 | 68, 69, 70, 1, 2, 0, 3, 4, 5, 0, |
| 2199 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, |
| 2200 | 0, 0, 72, 506, 0, 73, 0, 74, 0, 0, |
| 2201 | 0, 0, 0, 70, 0, 0, 71, 0, 0, 72, |
| 2202 | 0, 0, 73, 0, 74, 63, 64, 0, 65, 66, |
| 2203 | 67, 68, 69, 0, 1, 2, 0, 3, 4, 5, |
| 2204 | 63, 64, 0, 103, 149, 150, 151, 69, 0, 1, |
| 2205 | 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, |
| 2206 | 0, 0, 0, 0, 70, 0, 0, 71, 0, 0, |
| 2207 | 72, 0, 340, 73, 0, 74, 0, 0, 0, 70, |
| 2208 | 0, 0, 71, 0, 0, 72, 0, 0, 73, 0, |
| 2209 | 74, 63, 64, 0, 144, 66, 67, 68, 69, 0, |
| 2210 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2211 | 0, 0, 0, 71, 0, 0, 72, 0, 0, 73, |
| 2212 | 0, 74, 63, 64, 0, 103, 66, 67, 68, 69, |
| 2213 | 70, 1, 2, 0, 3, 4, 5, 63, 64, 0, |
| 2214 | 260, 66, 67, 68, 69, 0, 1, 2, 0, 3, |
| 2215 | 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2216 | 0, 70, 0, 0, 71, 0, 0, 72, 0, 0, |
| 2217 | 73, 0, 74, 0, 0, 0, 70, 0, 0, 71, |
| 2218 | 0, 0, 72, 0, 0, 73, 0, 74, 63, 64, |
| 2219 | 0, 103, 149, 150, 151, 69, -194, 1, 2, 0, |
| 2220 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
| 2221 | 0, -64, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2222 | 0, 0, 0, 6, 7, 0, 0, 70, 0, 0, |
| 2223 | 71, 0, 0, 72, 0, 0, 73, 0, 74, 0, |
| 2224 | 0, 0, 0, 0, 8, 0, 0, 9, 0, 0, |
| 2225 | 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2226 | 0, 71, 0, 0, 72, 0, 161, 73, 0, 74, |
| 2227 | 0, 0, 0, 0, 0, 0, 71, 0, 0, 72, |
| 2228 | 0, 0, 73, 0, 74, 162, 163, 0, 0, 0, |
| 2229 | 0, 0, 0, 0, 0, 0, 0, 164, 165, 166, |
| 2230 | 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, |
| 2231 | 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, |
| 2232 | 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, |
| 2233 | 72, 0, 0, 73, 0, 343, 0, 0, 0, 0, |
| 2234 | 187, 188, 189, 0, 0, 190, 191, 192, 193, 194, |
| 2235 | 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, |
| 2236 | 205, 206, 207, 208 |
| 2237 | }; |
| 2238 | |
| 2239 | static const short int yycheck[] = |
| 2240 | { |
| 2241 | 0, 27, 166, 226, 154, 189, 297, 147, 123, 0, |
| 2242 | 4, 18, 25, 11, 154, 11, 167, 17, 422, 26, |
| 2243 | 204, 205, 206, 207, 208, 49, 17, 211, 249, 250, |
| 2244 | 31, 11, 11, 144, 31, 330, 331, 558, 143, 63, |
| 2245 | 0, 144, 153, 144, 3, 4, 5, 6, 74, 35, |
| 2246 | 54, 572, 155, 50, 155, 15, 16, 17, 116, 19, |
| 2247 | 20, 21, 213, 143, 23, 24, 144, 27, 28, 144, |
| 2248 | 50, 50, 98, 40, 41, 15, 102, 155, 153, 144, |
| 2249 | 47, 145, 108, 147, 142, 149, 53, 113, 48, 89, |
| 2250 | 155, 51, 7, 8, 144, 55, 17, 123, 148, 20, |
| 2251 | 144, 16, 17, 507, 19, 20, 21, 151, 144, 135, |
| 2252 | 136, 143, 145, 139, 147, 151, 145, 143, 147, 148, |
| 2253 | 153, 261, 343, 263, 264, 420, 266, 145, 312, 147, |
| 2254 | 131, 132, 133, 151, 0, 136, 144, 541, 164, 144, |
| 2255 | 148, 154, 363, 148, 143, 131, 132, 133, 155, 19, |
| 2256 | 136, 16, 267, 151, 19, 151, 21, 448, 143, 299, |
| 2257 | 154, 187, 188, 189, 190, 149, 157, 307, 308, 573, |
| 2258 | 57, 58, 59, 60, 61, 62, 18, 203, 204, 205, |
| 2259 | 206, 207, 208, 209, 210, 211, 477, 19, 479, 39, |
| 2260 | 40, 41, 147, 219, 44, 310, 43, 381, 45, 383, |
| 2261 | 384, 385, 19, 229, 11, 7, 8, 14, 10, 11, |
| 2262 | 12, 13, 14, 19, 16, 17, 4, 19, 20, 21, |
| 2263 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 2264 | 4, 371, 372, 373, 525, 131, 132, 133, 34, 379, |
| 2265 | 136, 267, 144, 145, 46, 147, 469, 29, 30, 389, |
| 2266 | 390, 150, 278, 3, 4, 5, 6, 150, 144, 145, |
| 2267 | 410, 147, 145, 4, 147, 148, 140, 141, 142, 295, |
| 2268 | 410, 32, 145, 34, 147, 110, 111, 335, 336, 337, |
| 2269 | 338, 339, 109, 110, 310, 311, 312, 39, 19, 41, |
| 2270 | 348, 349, 350, 433, 148, 435, 480, 153, 438, 483, |
| 2271 | 484, 485, 80, 81, 444, 445, 144, 148, 147, 16, |
| 2272 | 9, 9, 19, 9, 21, 52, 11, 343, 147, 153, |
| 2273 | 543, 147, 147, 546, 147, 147, 19, 353, 147, 147, |
| 2274 | 144, 147, 472, 473, 147, 475, 476, 147, 35, 144, |
| 2275 | 144, 481, 400, 401, 146, 144, 144, 149, 35, 407, |
| 2276 | 152, 491, 154, 155, 144, 381, 382, 383, 384, 385, |
| 2277 | 144, 147, 388, 144, 56, 144, 263, 264, 144, 266, |
| 2278 | 153, 144, 512, 399, 149, 144, 540, 144, 7, 8, |
| 2279 | 520, 10, 11, 12, 13, 14, 144, 16, 17, 144, |
| 2280 | 19, 20, 21, 144, 35, 559, 454, 455, 456, 457, |
| 2281 | 144, 144, 299, 461, 462, 19, 4, 114, 115, 144, |
| 2282 | 307, 308, 148, 19, 14, 14, 556, 46, 147, 144, |
| 2283 | 144, 561, 4, 449, 131, 132, 144, 134, 135, 144, |
| 2284 | 137, 138, 139, 144, 144, 493, 494, 463, 578, 579, |
| 2285 | 144, 147, 468, 583, 144, 153, 586, 50, 474, 19, |
| 2286 | 144, 14, 4, 144, 480, 144, 144, 483, 484, 485, |
| 2287 | 144, 144, 488, 148, 144, 151, 148, 467, 144, 148, |
| 2288 | 528, 149, 530, 531, 371, 372, 373, 148, 148, 23, |
| 2289 | 24, 50, 379, 151, 148, 148, 148, 144, 14, 14, |
| 2290 | 144, 14, 389, 390, 68, 14, 126, 242, 126, 126, |
| 2291 | 39, 40, 41, 42, 43, 44, 45, 241, 47, 89, |
| 2292 | 535, 108, 102, 508, 219, 229, 542, 146, 17, 86, |
| 2293 | 149, 56, 488, 152, 402, 154, 155, -1, -1, -1, |
| 2294 | -1, -1, -1, -1, -1, 535, 433, -1, 435, -1, |
| 2295 | -1, 438, -1, -1, -1, -1, -1, 444, 445, 93, |
| 2296 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
| 2297 | 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, |
| 2298 | -1, -1, -1, -1, -1, 472, 473, -1, 475, 476, |
| 2299 | -1, -1, -1, -1, 481, -1, 7, 8, -1, 10, |
| 2300 | 11, 12, 13, 14, 491, 16, 17, -1, 19, 20, |
| 2301 | 21, 140, 141, 142, -1, -1, -1, -1, -1, -1, |
| 2302 | -1, -1, -1, -1, -1, 512, -1, -1, -1, -1, |
| 2303 | -1, -1, -1, 520, -1, 46, 3, 4, -1, -1, |
| 2304 | 7, 8, 9, 114, 115, -1, -1, -1, -1, 16, |
| 2305 | 17, -1, 19, 20, 21, 22, 23, 24, -1, -1, |
| 2306 | 131, 132, -1, 134, 135, -1, 137, 138, 139, 556, |
| 2307 | 37, 38, -1, -1, 561, -1, -1, -1, -1, -1, |
| 2308 | -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, |
| 2309 | -1, 578, 579, -1, -1, -1, 583, -1, -1, 586, |
| 2310 | -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, |
| 2311 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2312 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2313 | -1, -1, -1, -1, -1, 146, -1, -1, 149, -1, |
| 2314 | -1, 152, -1, 154, 155, 112, 113, 114, 115, 116, |
| 2315 | 117, 118, 119, 120, 121, 122, 123, 124, -1, 126, |
| 2316 | -1, 128, 129, 130, -1, -1, -1, -1, -1, -1, |
| 2317 | 3, 4, -1, -1, 7, 8, 9, -1, 145, -1, |
| 2318 | 147, -1, -1, 16, 17, 152, 19, 20, 21, 22, |
| 2319 | 23, 24, -1, -1, -1, -1, -1, -1, -1, 7, |
| 2320 | 8, -1, -1, -1, 37, 38, -1, -1, 16, 17, |
| 2321 | -1, 19, 20, 21, 22, -1, -1, -1, -1, -1, |
| 2322 | -1, 54, -1, -1, -1, -1, -1, -1, -1, 37, |
| 2323 | 38, -1, -1, -1, -1, -1, -1, 70, 71, 72, |
| 2324 | 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, |
| 2325 | 83, 84, 85, 86, -1, -1, -1, -1, -1, -1, |
| 2326 | -1, -1, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2327 | 78, 79, 80, 81, 82, 83, 84, 85, 86, 112, |
| 2328 | 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, |
| 2329 | 123, 124, -1, 126, -1, 128, 129, 130, -1, -1, |
| 2330 | -1, -1, -1, -1, 112, 113, 114, 115, 116, 117, |
| 2331 | 118, 119, 120, 121, 122, 123, 124, -1, 126, 152, |
| 2332 | 128, 129, 130, -1, -1, -1, -1, -1, -1, -1, |
| 2333 | 3, 4, -1, -1, -1, -1, 9, 145, -1, 147, |
| 2334 | -1, 149, -1, -1, 152, -1, 154, -1, 156, 22, |
| 2335 | 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2336 | -1, -1, -1, -1, 37, 38, -1, -1, -1, -1, |
| 2337 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, |
| 2338 | 8, 54, 10, 11, 12, 13, 14, -1, 16, 17, |
| 2339 | -1, 19, 20, 21, -1, -1, -1, 70, 71, 72, |
| 2340 | 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, |
| 2341 | 83, 84, 85, 86, -1, -1, -1, -1, 46, -1, |
| 2342 | -1, -1, -1, 7, 8, -1, 10, 11, 12, 13, |
| 2343 | 14, -1, 16, 17, -1, 19, 20, 21, -1, 112, |
| 2344 | 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, |
| 2345 | 123, 124, 36, 126, -1, 128, 129, 130, -1, -1, |
| 2346 | 7, 8, 46, 10, 11, 12, 13, 14, -1, 16, |
| 2347 | 17, -1, 19, 20, 21, -1, -1, 7, 8, 152, |
| 2348 | 10, 11, 12, 13, 14, -1, 16, 17, -1, 19, |
| 2349 | 20, 21, -1, -1, -1, -1, -1, -1, -1, 46, |
| 2350 | -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, |
| 2351 | -1, -1, -1, -1, -1, -1, 46, -1, 146, -1, |
| 2352 | -1, 149, -1, -1, 152, -1, 154, 155, 7, 8, |
| 2353 | -1, 10, 11, 12, 13, 14, -1, 16, 17, -1, |
| 2354 | 19, 20, 21, 7, 8, -1, 10, 11, 12, 13, |
| 2355 | 14, -1, 16, 17, -1, 19, 20, 21, -1, -1, |
| 2356 | -1, -1, 146, -1, -1, 149, -1, 46, 152, -1, |
| 2357 | 154, 118, 36, -1, 7, 8, -1, 10, 11, 12, |
| 2358 | 13, 14, 46, 16, 17, -1, 19, 20, 21, -1, |
| 2359 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 146, |
| 2360 | -1, -1, 149, 36, -1, 152, -1, 154, -1, -1, |
| 2361 | -1, -1, -1, 46, -1, -1, 146, -1, -1, 149, |
| 2362 | -1, -1, 152, -1, 154, 7, 8, -1, 10, 11, |
| 2363 | 12, 13, 14, -1, 16, 17, -1, 19, 20, 21, |
| 2364 | 7, 8, -1, 10, 11, 12, 13, 14, -1, 16, |
| 2365 | 17, -1, 19, 20, 21, -1, -1, -1, -1, -1, |
| 2366 | -1, -1, -1, -1, 46, -1, -1, 146, -1, -1, |
| 2367 | 149, -1, 151, 152, -1, 154, -1, -1, -1, 46, |
| 2368 | -1, -1, 146, -1, -1, 149, -1, -1, 152, -1, |
| 2369 | 154, 7, 8, -1, 10, 11, 12, 13, 14, -1, |
| 2370 | 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, |
| 2371 | -1, -1, -1, 146, -1, -1, 149, -1, -1, 152, |
| 2372 | -1, 154, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2373 | 46, 16, 17, -1, 19, 20, 21, 7, 8, -1, |
| 2374 | 10, 11, 12, 13, 14, -1, 16, 17, -1, 19, |
| 2375 | 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2376 | -1, 46, -1, -1, 146, -1, -1, 149, -1, -1, |
| 2377 | 152, -1, 154, -1, -1, -1, 46, -1, -1, 146, |
| 2378 | -1, -1, 149, -1, -1, 152, -1, 154, 7, 8, |
| 2379 | -1, 10, 11, 12, 13, 14, 0, 16, 17, -1, |
| 2380 | 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, |
| 2381 | -1, 15, 16, 17, -1, 19, 20, 21, -1, -1, |
| 2382 | -1, -1, -1, 27, 28, -1, -1, 46, -1, -1, |
| 2383 | 146, -1, -1, 149, -1, -1, 152, -1, 154, -1, |
| 2384 | -1, -1, -1, -1, 48, -1, -1, 51, -1, -1, |
| 2385 | -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2386 | -1, 146, -1, -1, 149, -1, 33, 152, -1, 154, |
| 2387 | -1, -1, -1, -1, -1, -1, 146, -1, -1, 149, |
| 2388 | -1, -1, 152, -1, 154, 52, 53, -1, -1, -1, |
| 2389 | -1, -1, -1, -1, -1, -1, -1, 64, 65, 66, |
| 2390 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2391 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2392 | -1, -1, -1, -1, -1, -1, -1, 146, -1, -1, |
| 2393 | 149, -1, -1, 152, -1, 154, -1, -1, -1, -1, |
| 2394 | 107, 108, 109, -1, -1, 112, 113, 114, 115, 116, |
| 2395 | 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 2396 | 127, 128, 129, 130 |
| 2397 | }; |
| 2398 | |
| 2399 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2400 | symbol of state STATE-NUM. */ |
| 2401 | static const unsigned char yystos[] = |
| 2402 | { |
| 2403 | 0, 16, 17, 19, 20, 21, 27, 28, 48, 51, |
| 2404 | 55, 165, 167, 168, 169, 170, 201, 202, 203, 205, |
| 2405 | 204, 49, 63, 210, 143, 54, 143, 15, 143, 39, |
| 2406 | 40, 41, 42, 43, 44, 45, 47, 140, 141, 142, |
| 2407 | 171, 172, 173, 0, 203, 43, 45, 174, 220, 39, |
| 2408 | 40, 41, 44, 175, 217, 219, 226, 143, 143, 149, |
| 2409 | 211, 19, 209, 7, 8, 10, 11, 12, 13, 14, |
| 2410 | 46, 146, 149, 152, 154, 165, 168, 188, 189, 223, |
| 2411 | 173, 173, 32, 34, 199, 173, 173, 18, 227, 228, |
| 2412 | 26, 155, 218, 227, 19, 19, 19, 212, 147, 4, |
| 2413 | 4, 4, 154, 10, 155, 189, 194, 145, 147, 199, |
| 2414 | 199, 39, 41, 176, 29, 30, 198, 57, 58, 59, |
| 2415 | 60, 61, 62, 177, 215, 215, 167, 231, 144, 151, |
| 2416 | 36, 189, 190, 192, 193, 150, 150, 155, 194, 144, |
| 2417 | 155, 193, 198, 198, 10, 118, 189, 191, 200, 11, |
| 2418 | 12, 13, 163, 164, 189, 195, 4, 191, 25, 154, |
| 2419 | 216, 33, 52, 53, 64, 65, 66, 67, 68, 69, |
| 2420 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2421 | 80, 81, 82, 83, 84, 85, 86, 107, 108, 109, |
| 2422 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
| 2423 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 158, |
| 2424 | 159, 160, 229, 235, 236, 237, 238, 19, 179, 144, |
| 2425 | 148, 189, 189, 153, 155, 189, 148, 195, 189, 147, |
| 2426 | 223, 23, 24, 3, 4, 5, 6, 9, 22, 37, |
| 2427 | 38, 85, 86, 112, 126, 128, 129, 130, 149, 152, |
| 2428 | 154, 156, 158, 159, 160, 196, 223, 206, 168, 52, |
| 2429 | 10, 189, 225, 11, 14, 11, 163, 177, 87, 88, |
| 2430 | 89, 90, 91, 92, 93, 94, 95, 96, 161, 23, |
| 2431 | 24, 93, 94, 95, 96, 97, 98, 99, 100, 101, |
| 2432 | 102, 103, 104, 105, 106, 162, 189, 189, 225, 189, |
| 2433 | 189, 232, 225, 225, 225, 225, 225, 189, 189, 225, |
| 2434 | 177, 110, 111, 114, 115, 131, 132, 134, 135, 137, |
| 2435 | 138, 139, 178, 36, 190, 181, 151, 153, 153, 181, |
| 2436 | 207, 208, 200, 161, 162, 147, 147, 147, 147, 147, |
| 2437 | 151, 195, 197, 154, 197, 155, 197, 19, 147, 147, |
| 2438 | 147, 144, 186, 147, 3, 4, 9, 22, 23, 24, |
| 2439 | 37, 38, 54, 152, 196, 222, 223, 224, 224, 224, |
| 2440 | 224, 191, 189, 189, 144, 183, 144, 183, 224, 149, |
| 2441 | 144, 144, 144, 144, 144, 144, 224, 224, 35, 191, |
| 2442 | 189, 225, 131, 132, 133, 136, 180, 186, 186, 35, |
| 2443 | 147, 147, 195, 195, 195, 195, 195, 144, 151, 155, |
| 2444 | 189, 197, 153, 155, 195, 195, 195, 31, 50, 184, |
| 2445 | 187, 36, 189, 213, 214, 56, 221, 197, 144, 144, |
| 2446 | 224, 224, 224, 11, 50, 11, 234, 224, 149, 225, |
| 2447 | 189, 225, 225, 225, 144, 144, 189, 224, 224, 144, |
| 2448 | 189, 195, 195, 234, 144, 144, 144, 144, 195, 153, |
| 2449 | 155, 144, 144, 35, 19, 4, 186, 179, 144, 148, |
| 2450 | 19, 153, 14, 14, 147, 144, 144, 224, 4, 224, |
| 2451 | 144, 144, 224, 144, 144, 144, 224, 224, 147, 144, |
| 2452 | 183, 189, 148, 144, 144, 148, 195, 195, 195, 195, |
| 2453 | 153, 195, 195, 189, 165, 166, 36, 189, 181, 144, |
| 2454 | 224, 224, 189, 233, 224, 224, 183, 183, 225, 224, |
| 2455 | 144, 225, 225, 225, 233, 224, 195, 195, 144, 148, |
| 2456 | 144, 144, 148, 148, 148, 179, 184, 185, 19, 144, |
| 2457 | 149, 224, 144, 148, 151, 224, 148, 183, 148, 148, |
| 2458 | 195, 195, 195, 166, 50, 182, 14, 151, 163, 230, |
| 2459 | 179, 189, 181, 151, 181, 148, 148, 148, 4, 224, |
| 2460 | 222, 151, 163, 224, 35, 144, 222, 179, 14, 14, |
| 2461 | 144, 224, 224, 14, 68, 224, 14, 224 |
| 2462 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2463 | |
| 2464 | #define yyerrok (yyerrstatus = 0) |
| 2465 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2466 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2467 | #define YYEOF 0 |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2468 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2469 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2470 | #define YYABORT goto yyabortlab |
| 2471 | #define YYERROR goto yyerrorlab |
| 2472 | |
| 2473 | |
| 2474 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2475 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2476 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2477 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2478 | #define YYFAIL goto yyerrlab |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2479 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2480 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2481 | |
| 2482 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2483 | do \ |
| 2484 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2485 | { \ |
| 2486 | yychar = (Token); \ |
| 2487 | yylval = (Value); \ |
| 2488 | yytoken = YYTRANSLATE (yychar); \ |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2489 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2490 | goto yybackup; \ |
| 2491 | } \ |
| 2492 | else \ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2493 | { \ |
| 2494 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2495 | YYERROR; \ |
| 2496 | } \ |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2497 | while (0) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2498 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2499 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2500 | #define YYTERROR 1 |
| 2501 | #define YYERRCODE 256 |
| 2502 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2503 | |
| 2504 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2505 | If N is 0, then set CURRENT to the empty location which ends |
| 2506 | the previous symbol: RHS[0] (always defined). */ |
| 2507 | |
| 2508 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2509 | #ifndef YYLLOC_DEFAULT |
| 2510 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2511 | do \ |
| 2512 | if (N) \ |
| 2513 | { \ |
| 2514 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2515 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2516 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2517 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2518 | } \ |
| 2519 | else \ |
| 2520 | { \ |
| 2521 | (Current).first_line = (Current).last_line = \ |
| 2522 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2523 | (Current).first_column = (Current).last_column = \ |
| 2524 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2525 | } \ |
| 2526 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2527 | #endif |
| 2528 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2529 | |
| 2530 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2531 | This macro was not mandated originally: define only if we know |
| 2532 | we won't break user code: when these are the locations we know. */ |
| 2533 | |
| 2534 | #ifndef YY_LOCATION_PRINT |
| 2535 | # if YYLTYPE_IS_TRIVIAL |
| 2536 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2537 | fprintf (File, "%d.%d-%d.%d", \ |
| 2538 | (Loc).first_line, (Loc).first_column, \ |
| 2539 | (Loc).last_line, (Loc).last_column) |
| 2540 | # else |
| 2541 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2542 | # endif |
| 2543 | #endif |
| 2544 | |
| 2545 | |
| 2546 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2547 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2548 | #ifdef YYLEX_PARAM |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2549 | # define YYLEX yylex (YYLEX_PARAM) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2550 | #else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2551 | # define YYLEX yylex () |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2552 | #endif |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2553 | |
| 2554 | /* Enable debugging if requested. */ |
| 2555 | #if YYDEBUG |
| 2556 | |
| 2557 | # ifndef YYFPRINTF |
| 2558 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2559 | # define YYFPRINTF fprintf |
| 2560 | # endif |
| 2561 | |
| 2562 | # define YYDPRINTF(Args) \ |
| 2563 | do { \ |
| 2564 | if (yydebug) \ |
| 2565 | YYFPRINTF Args; \ |
| 2566 | } while (0) |
| 2567 | |
| 2568 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2569 | do { \ |
| 2570 | if (yydebug) \ |
| 2571 | { \ |
| 2572 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2573 | yysymprint (stderr, \ |
| 2574 | Type, Value); \ |
| 2575 | YYFPRINTF (stderr, "\n"); \ |
| 2576 | } \ |
| 2577 | } while (0) |
| 2578 | |
| 2579 | /*------------------------------------------------------------------. |
| 2580 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2581 | | TOP (included). | |
| 2582 | `------------------------------------------------------------------*/ |
| 2583 | |
| 2584 | #if defined (__STDC__) || defined (__cplusplus) |
| 2585 | static void |
| 2586 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2587 | #else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2588 | static void |
| 2589 | yy_stack_print (bottom, top) |
| 2590 | short int *bottom; |
| 2591 | short int *top; |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2592 | #endif |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2593 | { |
| 2594 | YYFPRINTF (stderr, "Stack now"); |
| 2595 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2596 | YYFPRINTF (stderr, " %d", *bottom); |
| 2597 | YYFPRINTF (stderr, "\n"); |
| 2598 | } |
| 2599 | |
| 2600 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2601 | do { \ |
| 2602 | if (yydebug) \ |
| 2603 | yy_stack_print ((Bottom), (Top)); \ |
| 2604 | } while (0) |
| 2605 | |
| 2606 | |
| 2607 | /*------------------------------------------------. |
| 2608 | | Report that the YYRULE is going to be reduced. | |
| 2609 | `------------------------------------------------*/ |
| 2610 | |
| 2611 | #if defined (__STDC__) || defined (__cplusplus) |
| 2612 | static void |
| 2613 | yy_reduce_print (int yyrule) |
| 2614 | #else |
| 2615 | static void |
| 2616 | yy_reduce_print (yyrule) |
| 2617 | int yyrule; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2618 | #endif |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2619 | { |
| 2620 | int yyi; |
| 2621 | unsigned long int yylno = yyrline[yyrule]; |
| 2622 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2623 | yyrule - 1, yylno); |
| 2624 | /* Print the symbols being reduced, and their result. */ |
| 2625 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2626 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2627 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2628 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2629 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2630 | # define YY_REDUCE_PRINT(Rule) \ |
| 2631 | do { \ |
| 2632 | if (yydebug) \ |
| 2633 | yy_reduce_print (Rule); \ |
| 2634 | } while (0) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2635 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2636 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2637 | multiple parsers can coexist. */ |
| 2638 | int yydebug; |
| 2639 | #else /* !YYDEBUG */ |
| 2640 | # define YYDPRINTF(Args) |
| 2641 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2642 | # define YY_STACK_PRINT(Bottom, Top) |
| 2643 | # define YY_REDUCE_PRINT(Rule) |
| 2644 | #endif /* !YYDEBUG */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2645 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2646 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2647 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2648 | #ifndef YYINITDEPTH |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2649 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2650 | #endif |
| 2651 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2652 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2653 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2654 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2655 | Do not make this value too large; the results are undefined if |
| 2656 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2657 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2658 | |
| 2659 | #ifndef YYMAXDEPTH |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2660 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2661 | #endif |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2662 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2663 | |
| 2664 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2665 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2666 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2667 | # ifndef yystrlen |
| 2668 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2669 | # define yystrlen strlen |
| 2670 | # else |
| 2671 | /* Return the length of YYSTR. */ |
| 2672 | static YYSIZE_T |
| 2673 | # if defined (__STDC__) || defined (__cplusplus) |
| 2674 | yystrlen (const char *yystr) |
| 2675 | # else |
| 2676 | yystrlen (yystr) |
| 2677 | const char *yystr; |
| 2678 | # endif |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2679 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2680 | const char *yys = yystr; |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2681 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2682 | while (*yys++ != '\0') |
| 2683 | continue; |
| 2684 | |
| 2685 | return yys - yystr - 1; |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2686 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2687 | # endif |
| 2688 | # endif |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2689 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2690 | # ifndef yystpcpy |
| 2691 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2692 | # define yystpcpy stpcpy |
| 2693 | # else |
| 2694 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2695 | YYDEST. */ |
| 2696 | static char * |
| 2697 | # if defined (__STDC__) || defined (__cplusplus) |
| 2698 | yystpcpy (char *yydest, const char *yysrc) |
| 2699 | # else |
| 2700 | yystpcpy (yydest, yysrc) |
| 2701 | char *yydest; |
| 2702 | const char *yysrc; |
| 2703 | # endif |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2704 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2705 | char *yyd = yydest; |
| 2706 | const char *yys = yysrc; |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2707 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2708 | while ((*yyd++ = *yys++) != '\0') |
| 2709 | continue; |
| 2710 | |
| 2711 | return yyd - 1; |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2712 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2713 | # endif |
| 2714 | # endif |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2715 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2716 | # ifndef yytnamerr |
| 2717 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2718 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2719 | heuristic is that double-quoting is unnecessary unless the string |
| 2720 | contains an apostrophe, a comma, or backslash (other than |
| 2721 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2722 | null, do not copy; instead, return the length of what the result |
| 2723 | would have been. */ |
| 2724 | static YYSIZE_T |
| 2725 | yytnamerr (char *yyres, const char *yystr) |
| 2726 | { |
| 2727 | if (*yystr == '"') |
| 2728 | { |
| 2729 | size_t yyn = 0; |
| 2730 | char const *yyp = yystr; |
| 2731 | |
| 2732 | for (;;) |
| 2733 | switch (*++yyp) |
| 2734 | { |
| 2735 | case '\'': |
| 2736 | case ',': |
| 2737 | goto do_not_strip_quotes; |
| 2738 | |
| 2739 | case '\\': |
| 2740 | if (*++yyp != '\\') |
| 2741 | goto do_not_strip_quotes; |
| 2742 | /* Fall through. */ |
| 2743 | default: |
| 2744 | if (yyres) |
| 2745 | yyres[yyn] = *yyp; |
| 2746 | yyn++; |
| 2747 | break; |
| 2748 | |
| 2749 | case '"': |
| 2750 | if (yyres) |
| 2751 | yyres[yyn] = '\0'; |
| 2752 | return yyn; |
| 2753 | } |
| 2754 | do_not_strip_quotes: ; |
| 2755 | } |
| 2756 | |
| 2757 | if (! yyres) |
| 2758 | return yystrlen (yystr); |
| 2759 | |
| 2760 | return yystpcpy (yyres, yystr) - yyres; |
| 2761 | } |
| 2762 | # endif |
| 2763 | |
| 2764 | #endif /* YYERROR_VERBOSE */ |
| 2765 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2766 | |
| 2767 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2768 | #if YYDEBUG |
| 2769 | /*--------------------------------. |
| 2770 | | Print this symbol on YYOUTPUT. | |
| 2771 | `--------------------------------*/ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2772 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2773 | #if defined (__STDC__) || defined (__cplusplus) |
| 2774 | static void |
| 2775 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2776 | #else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2777 | static void |
| 2778 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2779 | FILE *yyoutput; |
| 2780 | int yytype; |
| 2781 | YYSTYPE *yyvaluep; |
| 2782 | #endif |
| 2783 | { |
| 2784 | /* Pacify ``unused variable'' warnings. */ |
| 2785 | (void) yyvaluep; |
| 2786 | |
| 2787 | if (yytype < YYNTOKENS) |
| 2788 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2789 | else |
| 2790 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2791 | |
| 2792 | |
| 2793 | # ifdef YYPRINT |
| 2794 | if (yytype < YYNTOKENS) |
| 2795 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2796 | # endif |
| 2797 | switch (yytype) |
| 2798 | { |
| 2799 | default: |
| 2800 | break; |
| 2801 | } |
| 2802 | YYFPRINTF (yyoutput, ")"); |
| 2803 | } |
| 2804 | |
| 2805 | #endif /* ! YYDEBUG */ |
| 2806 | /*-----------------------------------------------. |
| 2807 | | Release the memory associated to this symbol. | |
| 2808 | `-----------------------------------------------*/ |
| 2809 | |
| 2810 | #if defined (__STDC__) || defined (__cplusplus) |
| 2811 | static void |
| 2812 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2813 | #else |
| 2814 | static void |
| 2815 | yydestruct (yymsg, yytype, yyvaluep) |
| 2816 | const char *yymsg; |
| 2817 | int yytype; |
| 2818 | YYSTYPE *yyvaluep; |
| 2819 | #endif |
| 2820 | { |
| 2821 | /* Pacify ``unused variable'' warnings. */ |
| 2822 | (void) yyvaluep; |
| 2823 | |
| 2824 | if (!yymsg) |
| 2825 | yymsg = "Deleting"; |
| 2826 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2827 | |
| 2828 | switch (yytype) |
| 2829 | { |
| 2830 | |
| 2831 | default: |
| 2832 | break; |
| 2833 | } |
| 2834 | } |
| 2835 | |
| 2836 | |
| 2837 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2838 | |
| 2839 | #ifdef YYPARSE_PARAM |
| 2840 | # if defined (__STDC__) || defined (__cplusplus) |
| 2841 | int yyparse (void *YYPARSE_PARAM); |
| 2842 | # else |
| 2843 | int yyparse (); |
| 2844 | # endif |
| 2845 | #else /* ! YYPARSE_PARAM */ |
| 2846 | #if defined (__STDC__) || defined (__cplusplus) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2847 | int yyparse (void); |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 2848 | #else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2849 | int yyparse (); |
| 2850 | #endif |
| 2851 | #endif /* ! YYPARSE_PARAM */ |
| 2852 | |
| 2853 | |
| 2854 | |
| 2855 | /* The look-ahead symbol. */ |
| 2856 | int yychar; |
| 2857 | |
| 2858 | /* The semantic value of the look-ahead symbol. */ |
| 2859 | YYSTYPE yylval; |
| 2860 | |
| 2861 | /* Number of syntax errors so far. */ |
| 2862 | int yynerrs; |
| 2863 | |
| 2864 | |
| 2865 | |
| 2866 | /*----------. |
| 2867 | | yyparse. | |
| 2868 | `----------*/ |
| 2869 | |
| 2870 | #ifdef YYPARSE_PARAM |
| 2871 | # if defined (__STDC__) || defined (__cplusplus) |
| 2872 | int yyparse (void *YYPARSE_PARAM) |
| 2873 | # else |
| 2874 | int yyparse (YYPARSE_PARAM) |
| 2875 | void *YYPARSE_PARAM; |
| 2876 | # endif |
| 2877 | #else /* ! YYPARSE_PARAM */ |
| 2878 | #if defined (__STDC__) || defined (__cplusplus) |
| 2879 | int |
| 2880 | yyparse (void) |
| 2881 | #else |
| 2882 | int |
| 2883 | yyparse () |
| 2884 | |
| 2885 | #endif |
| 2886 | #endif |
| 2887 | { |
| 2888 | |
| 2889 | int yystate; |
| 2890 | int yyn; |
| 2891 | int yyresult; |
| 2892 | /* Number of tokens to shift before error messages enabled. */ |
| 2893 | int yyerrstatus; |
| 2894 | /* Look-ahead token as an internal (translated) token number. */ |
| 2895 | int yytoken = 0; |
| 2896 | |
| 2897 | /* Three stacks and their tools: |
| 2898 | `yyss': related to states, |
| 2899 | `yyvs': related to semantic values, |
| 2900 | `yyls': related to locations. |
| 2901 | |
| 2902 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2903 | to reallocate them elsewhere. */ |
| 2904 | |
| 2905 | /* The state stack. */ |
| 2906 | short int yyssa[YYINITDEPTH]; |
| 2907 | short int *yyss = yyssa; |
| 2908 | short int *yyssp; |
| 2909 | |
| 2910 | /* The semantic value stack. */ |
| 2911 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2912 | YYSTYPE *yyvs = yyvsa; |
| 2913 | YYSTYPE *yyvsp; |
| 2914 | |
| 2915 | |
| 2916 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2917 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 77d0f97 | 2007-04-25 14:29:12 +0000 | [diff] [blame] | 2918 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2919 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2920 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2921 | /* The variables used to return semantic value and location from the |
| 2922 | action routines. */ |
| 2923 | YYSTYPE yyval; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2924 | |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2925 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2926 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2927 | rule. */ |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2928 | int yylen; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2929 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2930 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2931 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2932 | yystate = 0; |
| 2933 | yyerrstatus = 0; |
| 2934 | yynerrs = 0; |
| 2935 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2936 | |
| 2937 | /* Initialize stack pointers. |
| 2938 | Waste one element of value and location stack |
| 2939 | so that they stay on the same level as the state stack. |
| 2940 | The wasted elements are never initialized. */ |
| 2941 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2942 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2943 | yyvsp = yyvs; |
| 2944 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2945 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2946 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2947 | /*------------------------------------------------------------. |
| 2948 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2949 | `------------------------------------------------------------*/ |
| 2950 | yynewstate: |
| 2951 | /* In all cases, when you get here, the value and location stacks |
| 2952 | have just been pushed. so pushing a state here evens the stacks. |
| 2953 | */ |
| 2954 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2955 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2956 | yysetstate: |
| 2957 | *yyssp = yystate; |
| 2958 | |
| 2959 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2960 | { |
| 2961 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2962 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2963 | |
| 2964 | #ifdef yyoverflow |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2965 | { |
| 2966 | /* Give user a chance to reallocate the stack. Use copies of |
| 2967 | these so that the &'s don't force the real ones into |
| 2968 | memory. */ |
| 2969 | YYSTYPE *yyvs1 = yyvs; |
| 2970 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2971 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2972 | |
| 2973 | /* Each stack pointer address is followed by the size of the |
| 2974 | data in use in that stack, in bytes. This used to be a |
| 2975 | conditional around just the two extra args, but that might |
| 2976 | be undefined if yyoverflow is a macro. */ |
| 2977 | yyoverflow (YY_("memory exhausted"), |
| 2978 | &yyss1, yysize * sizeof (*yyssp), |
| 2979 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2980 | |
| 2981 | &yystacksize); |
| 2982 | |
| 2983 | yyss = yyss1; |
| 2984 | yyvs = yyvs1; |
| 2985 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2986 | #else /* no yyoverflow */ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2987 | # ifndef YYSTACK_RELOCATE |
| 2988 | goto yyexhaustedlab; |
| 2989 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2990 | /* Extend the stack our own way. */ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2991 | if (YYMAXDEPTH <= yystacksize) |
| 2992 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2993 | yystacksize *= 2; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2994 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2995 | yystacksize = YYMAXDEPTH; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 2996 | |
| 2997 | { |
| 2998 | short int *yyss1 = yyss; |
| 2999 | union yyalloc *yyptr = |
| 3000 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3001 | if (! yyptr) |
| 3002 | goto yyexhaustedlab; |
| 3003 | YYSTACK_RELOCATE (yyss); |
| 3004 | YYSTACK_RELOCATE (yyvs); |
| 3005 | |
| 3006 | # undef YYSTACK_RELOCATE |
| 3007 | if (yyss1 != yyssa) |
| 3008 | YYSTACK_FREE (yyss1); |
| 3009 | } |
| 3010 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3011 | #endif /* no yyoverflow */ |
| 3012 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3013 | yyssp = yyss + yysize - 1; |
| 3014 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3015 | |
| 3016 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3017 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3018 | (unsigned long int) yystacksize)); |
| 3019 | |
| 3020 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3021 | YYABORT; |
| 3022 | } |
| 3023 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3024 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3025 | |
| 3026 | goto yybackup; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3027 | |
| 3028 | /*-----------. |
| 3029 | | yybackup. | |
| 3030 | `-----------*/ |
| 3031 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3032 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3033 | /* Do appropriate processing given the current state. */ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3034 | /* Read a look-ahead token if we need one and don't already have one. */ |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3035 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3036 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3037 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 3038 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3039 | yyn = yypact[yystate]; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3040 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3041 | goto yydefault; |
| 3042 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3043 | /* Not known => get a look-ahead token if don't already have one. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3044 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3045 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3046 | if (yychar == YYEMPTY) |
| 3047 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3048 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3049 | yychar = YYLEX; |
| 3050 | } |
| 3051 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3052 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3053 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3054 | yychar = yytoken = YYEOF; |
| 3055 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3056 | } |
| 3057 | else |
| 3058 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3059 | yytoken = YYTRANSLATE (yychar); |
| 3060 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3061 | } |
| 3062 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3063 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3064 | detect an error, take that action. */ |
| 3065 | yyn += yytoken; |
| 3066 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3067 | goto yydefault; |
| 3068 | yyn = yytable[yyn]; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3069 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3070 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3071 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3072 | goto yyerrlab; |
| 3073 | yyn = -yyn; |
| 3074 | goto yyreduce; |
| 3075 | } |
| 3076 | |
| 3077 | if (yyn == YYFINAL) |
| 3078 | YYACCEPT; |
| 3079 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3080 | /* Shift the look-ahead token. */ |
| 3081 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3082 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3083 | /* Discard the token being shifted unless it is eof. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3084 | if (yychar != YYEOF) |
| 3085 | yychar = YYEMPTY; |
| 3086 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3087 | *++yyvsp = yylval; |
| 3088 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3089 | |
| 3090 | /* Count tokens shifted since error; after three, turn off error |
| 3091 | status. */ |
| 3092 | if (yyerrstatus) |
| 3093 | yyerrstatus--; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3094 | |
| 3095 | yystate = yyn; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3096 | goto yynewstate; |
| 3097 | |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 3098 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3099 | /*-----------------------------------------------------------. |
| 3100 | | yydefault -- do the default action for the current state. | |
| 3101 | `-----------------------------------------------------------*/ |
| 3102 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3103 | yyn = yydefact[yystate]; |
| 3104 | if (yyn == 0) |
| 3105 | goto yyerrlab; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3106 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3107 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3108 | |
| 3109 | /*-----------------------------. |
| 3110 | | yyreduce -- Do a reduction. | |
| 3111 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3112 | yyreduce: |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3113 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3114 | yylen = yyr2[yyn]; |
| 3115 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3116 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3117 | `$$ = $1'. |
| 3118 | |
| 3119 | Otherwise, the following line sets YYVAL to garbage. |
| 3120 | This behavior is undocumented and Bison |
| 3121 | users should not rely upon it. Assigning to YYVAL |
| 3122 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3123 | GCC warning that YYVAL may be used uninitialized. */ |
| 3124 | yyval = yyvsp[1-yylen]; |
| 3125 | |
| 3126 | |
| 3127 | YY_REDUCE_PRINT (yyn); |
| 3128 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3129 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3130 | case 29: |
| 3131 | #line 1122 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3132 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3133 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3134 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3135 | case 30: |
| 3136 | #line 1122 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3137 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3138 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3139 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3140 | case 31: |
| 3141 | #line 1123 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3142 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3143 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3144 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3145 | case 32: |
| 3146 | #line 1123 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3147 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3148 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3149 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3150 | case 33: |
| 3151 | #line 1124 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3152 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3153 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3154 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3155 | case 34: |
| 3156 | #line 1124 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3157 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3158 | break; |
| 3159 | |
| 3160 | case 35: |
| 3161 | #line 1125 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3162 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3163 | break; |
| 3164 | |
| 3165 | case 36: |
| 3166 | #line 1125 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3167 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3168 | break; |
| 3169 | |
| 3170 | case 37: |
| 3171 | #line 1126 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3172 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3173 | break; |
| 3174 | |
| 3175 | case 38: |
| 3176 | #line 1126 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3177 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3178 | break; |
| 3179 | |
| 3180 | case 39: |
| 3181 | #line 1130 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3182 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3183 | break; |
| 3184 | |
| 3185 | case 40: |
| 3186 | #line 1130 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3187 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3188 | break; |
| 3189 | |
| 3190 | case 41: |
| 3191 | #line 1131 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3192 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3193 | break; |
| 3194 | |
| 3195 | case 42: |
| 3196 | #line 1131 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3197 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3198 | break; |
| 3199 | |
| 3200 | case 43: |
| 3201 | #line 1132 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3202 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3203 | break; |
| 3204 | |
| 3205 | case 44: |
| 3206 | #line 1132 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3207 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3208 | break; |
| 3209 | |
| 3210 | case 45: |
| 3211 | #line 1133 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3212 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3213 | break; |
| 3214 | |
| 3215 | case 46: |
| 3216 | #line 1133 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3217 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3218 | break; |
| 3219 | |
| 3220 | case 47: |
| 3221 | #line 1134 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3222 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3223 | break; |
| 3224 | |
| 3225 | case 48: |
| 3226 | #line 1134 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3227 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3228 | break; |
| 3229 | |
| 3230 | case 49: |
| 3231 | #line 1135 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3232 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3233 | break; |
| 3234 | |
| 3235 | case 50: |
| 3236 | #line 1135 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3237 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3238 | break; |
| 3239 | |
| 3240 | case 51: |
| 3241 | #line 1136 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3242 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3243 | break; |
| 3244 | |
| 3245 | case 52: |
| 3246 | #line 1136 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3247 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3248 | break; |
| 3249 | |
| 3250 | case 53: |
| 3251 | #line 1137 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3252 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3253 | break; |
| 3254 | |
| 3255 | case 54: |
| 3256 | #line 1138 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3257 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3258 | break; |
| 3259 | |
| 3260 | case 62: |
| 3261 | #line 1147 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3262 | { (yyval.StrVal) = 0; ;} |
| 3263 | break; |
| 3264 | |
| 3265 | case 63: |
| 3266 | #line 1151 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3267 | { |
| 3268 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3269 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3270 | ;} |
| 3271 | break; |
| 3272 | |
| 3273 | case 64: |
| 3274 | #line 1155 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3275 | { |
| 3276 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3277 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3278 | ;} |
| 3279 | break; |
| 3280 | |
| 3281 | case 68: |
| 3282 | #line 1163 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3283 | { |
| 3284 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3285 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3286 | ;} |
| 3287 | break; |
| 3288 | |
| 3289 | case 69: |
| 3290 | #line 1168 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3291 | { |
| 3292 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3293 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3294 | ;} |
| 3295 | break; |
| 3296 | |
| 3297 | case 70: |
| 3298 | #line 1174 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3299 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3300 | break; |
| 3301 | |
| 3302 | case 71: |
| 3303 | #line 1175 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3304 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3305 | break; |
| 3306 | |
| 3307 | case 72: |
| 3308 | #line 1176 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3309 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3310 | break; |
| 3311 | |
| 3312 | case 73: |
| 3313 | #line 1177 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3314 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3315 | break; |
| 3316 | |
| 3317 | case 74: |
| 3318 | #line 1178 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3319 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3320 | break; |
| 3321 | |
| 3322 | case 75: |
| 3323 | #line 1182 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3324 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3325 | break; |
| 3326 | |
| 3327 | case 76: |
| 3328 | #line 1183 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3329 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3330 | break; |
| 3331 | |
| 3332 | case 77: |
| 3333 | #line 1184 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3334 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3335 | break; |
| 3336 | |
| 3337 | case 78: |
| 3338 | #line 1188 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3339 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3340 | break; |
| 3341 | |
| 3342 | case 79: |
| 3343 | #line 1189 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3344 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3345 | break; |
| 3346 | |
| 3347 | case 80: |
| 3348 | #line 1190 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3349 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3350 | break; |
| 3351 | |
| 3352 | case 81: |
| 3353 | #line 1191 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3354 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
| 3355 | break; |
| 3356 | |
| 3357 | case 82: |
| 3358 | #line 1195 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3359 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3360 | break; |
| 3361 | |
| 3362 | case 83: |
| 3363 | #line 1196 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3364 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3365 | break; |
| 3366 | |
| 3367 | case 84: |
| 3368 | #line 1197 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3369 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3370 | break; |
| 3371 | |
| 3372 | case 85: |
| 3373 | #line 1201 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3374 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3375 | break; |
| 3376 | |
| 3377 | case 86: |
| 3378 | #line 1202 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3379 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3380 | break; |
| 3381 | |
| 3382 | case 87: |
| 3383 | #line 1203 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3384 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3385 | break; |
| 3386 | |
| 3387 | case 88: |
| 3388 | #line 1204 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3389 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3390 | break; |
| 3391 | |
| 3392 | case 89: |
| 3393 | #line 1205 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3394 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3395 | break; |
| 3396 | |
| 3397 | case 90: |
| 3398 | #line 1209 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3399 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3400 | break; |
| 3401 | |
| 3402 | case 91: |
| 3403 | #line 1210 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3404 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3405 | break; |
| 3406 | |
| 3407 | case 92: |
| 3408 | #line 1211 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3409 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3410 | break; |
| 3411 | |
| 3412 | case 93: |
| 3413 | #line 1214 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3414 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3415 | break; |
| 3416 | |
| 3417 | case 94: |
| 3418 | #line 1215 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3419 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3420 | break; |
| 3421 | |
| 3422 | case 95: |
| 3423 | #line 1216 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3424 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3425 | break; |
| 3426 | |
| 3427 | case 96: |
| 3428 | #line 1217 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3429 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3430 | break; |
| 3431 | |
| 3432 | case 97: |
| 3433 | #line 1218 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3434 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3435 | break; |
| 3436 | |
| 3437 | case 98: |
| 3438 | #line 1219 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3439 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3440 | break; |
| 3441 | |
| 3442 | case 99: |
| 3443 | #line 1220 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3444 | { |
| 3445 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3446 | GEN_ERROR("Calling conv too large"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3447 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3448 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3449 | ;} |
| 3450 | break; |
| 3451 | |
| 3452 | case 100: |
| 3453 | #line 1227 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3454 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3455 | break; |
| 3456 | |
| 3457 | case 101: |
| 3458 | #line 1228 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3459 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3460 | break; |
| 3461 | |
| 3462 | case 102: |
| 3463 | #line 1229 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3464 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3465 | break; |
| 3466 | |
| 3467 | case 103: |
| 3468 | #line 1230 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3469 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3470 | break; |
| 3471 | |
| 3472 | case 104: |
| 3473 | #line 1231 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3474 | { (yyval.ParamAttrs) = ParamAttr::InReg; ;} |
| 3475 | break; |
| 3476 | |
| 3477 | case 105: |
| 3478 | #line 1232 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3479 | { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} |
| 3480 | break; |
| 3481 | |
| 3482 | case 106: |
| 3483 | #line 1233 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3484 | { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} |
| 3485 | break; |
| 3486 | |
| 3487 | case 107: |
| 3488 | #line 1234 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3489 | { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} |
| 3490 | break; |
| 3491 | |
| 3492 | case 108: |
| 3493 | #line 1235 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3494 | { (yyval.ParamAttrs) = ParamAttr::Nest; ;} |
| 3495 | break; |
| 3496 | |
| 3497 | case 109: |
| 3498 | #line 1238 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3499 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3500 | break; |
| 3501 | |
| 3502 | case 110: |
| 3503 | #line 1239 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3504 | { |
| 3505 | (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs); |
| 3506 | ;} |
| 3507 | break; |
| 3508 | |
| 3509 | case 111: |
| 3510 | #line 1244 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3511 | { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} |
| 3512 | break; |
| 3513 | |
| 3514 | case 112: |
| 3515 | #line 1245 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3516 | { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} |
| 3517 | break; |
| 3518 | |
| 3519 | case 113: |
| 3520 | #line 1246 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3521 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3522 | break; |
| 3523 | |
| 3524 | case 114: |
| 3525 | #line 1247 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3526 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3527 | break; |
| 3528 | |
| 3529 | case 115: |
| 3530 | #line 1250 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3531 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3532 | break; |
| 3533 | |
| 3534 | case 116: |
| 3535 | #line 1251 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3536 | { |
| 3537 | (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs); |
| 3538 | ;} |
| 3539 | break; |
| 3540 | |
| 3541 | case 117: |
| 3542 | #line 1258 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3543 | { (yyval.UIntVal) = 0; ;} |
| 3544 | break; |
| 3545 | |
| 3546 | case 118: |
| 3547 | #line 1259 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3548 | { |
| 3549 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3550 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3551 | GEN_ERROR("Alignment must be a power of two"); |
| 3552 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3553 | ;} |
| 3554 | break; |
| 3555 | |
| 3556 | case 119: |
| 3557 | #line 1265 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3558 | { (yyval.UIntVal) = 0; ;} |
| 3559 | break; |
| 3560 | |
| 3561 | case 120: |
| 3562 | #line 1266 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3563 | { |
| 3564 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3565 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3566 | GEN_ERROR("Alignment must be a power of two"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3567 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3568 | ;} |
| 3569 | break; |
| 3570 | |
| 3571 | case 121: |
| 3572 | #line 1274 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3573 | { |
| 3574 | for (unsigned i = 0, e = (yyvsp[0].StrVal)->length(); i != e; ++i) |
| 3575 | if ((*(yyvsp[0].StrVal))[i] == '"' || (*(yyvsp[0].StrVal))[i] == '\\') |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3576 | GEN_ERROR("Invalid character in section name"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3577 | (yyval.StrVal) = (yyvsp[0].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3578 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3579 | ;} |
| 3580 | break; |
| 3581 | |
| 3582 | case 122: |
| 3583 | #line 1282 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3584 | { (yyval.StrVal) = 0; ;} |
| 3585 | break; |
| 3586 | |
| 3587 | case 123: |
| 3588 | #line 1283 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3589 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3590 | break; |
| 3591 | |
| 3592 | case 124: |
| 3593 | #line 1288 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3594 | {;} |
| 3595 | break; |
| 3596 | |
| 3597 | case 125: |
| 3598 | #line 1289 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3599 | {;} |
| 3600 | break; |
| 3601 | |
| 3602 | case 126: |
| 3603 | #line 1290 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3604 | { |
| 3605 | CurGV->setSection(*(yyvsp[0].StrVal)); |
| 3606 | delete (yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3607 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3608 | ;} |
| 3609 | break; |
| 3610 | |
| 3611 | case 127: |
| 3612 | #line 1295 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3613 | { |
| 3614 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3615 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3616 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3617 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3618 | ;} |
| 3619 | break; |
| 3620 | |
| 3621 | case 132: |
| 3622 | #line 1311 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3623 | { |
| 3624 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3625 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3626 | ;} |
| 3627 | break; |
| 3628 | |
| 3629 | case 133: |
| 3630 | #line 1315 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3631 | { |
| 3632 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3633 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3634 | ;} |
| 3635 | break; |
| 3636 | |
| 3637 | case 134: |
| 3638 | #line 1319 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3639 | { // Pointer type? |
| 3640 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3641 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3642 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3643 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3644 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3645 | ;} |
| 3646 | break; |
| 3647 | |
| 3648 | case 135: |
| 3649 | #line 1326 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3650 | { // Named types are also simple types... |
| 3651 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3652 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3653 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 3654 | ;} |
| 3655 | break; |
| 3656 | |
| 3657 | case 136: |
| 3658 | #line 1331 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3659 | { // Type UpReference |
| 3660 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3661 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3662 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3663 | (yyval.TypeVal) = new PATypeHolder(OT); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3664 | UR_OUT("New Upreference!\n"); |
| 3665 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3666 | ;} |
| 3667 | break; |
| 3668 | |
| 3669 | case 137: |
| 3670 | #line 1339 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3671 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3672 | std::vector<const Type*> Params; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3673 | ParamAttrsVector Attrs; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3674 | if ((yyvsp[0].ParamAttrs) != ParamAttr::None) { |
| 3675 | ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3676 | Attrs.push_back(X); |
| 3677 | } |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3678 | unsigned index = 1; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3679 | TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3680 | for (; I != E; ++I, ++index) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3681 | const Type *Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3682 | Params.push_back(Ty); |
| 3683 | if (Ty != Type::VoidTy) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3684 | if (I->Attrs != ParamAttr::None) { |
| 3685 | ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; |
| 3686 | Attrs.push_back(X); |
| 3687 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3688 | } |
| 3689 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3690 | if (isVarArg) Params.pop_back(); |
| 3691 | |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3692 | ParamAttrsList *ActualAttrs = 0; |
| 3693 | if (!Attrs.empty()) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3694 | ActualAttrs = ParamAttrsList::get(Attrs); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3695 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, ActualAttrs); |
| 3696 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3697 | delete (yyvsp[-4].TypeVal); // Delete the return type handle |
| 3698 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3699 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3700 | ;} |
| 3701 | break; |
| 3702 | |
| 3703 | case 138: |
| 3704 | #line 1369 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3705 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3706 | std::vector<const Type*> Params; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3707 | ParamAttrsVector Attrs; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3708 | if ((yyvsp[0].ParamAttrs) != ParamAttr::None) { |
| 3709 | ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3710 | Attrs.push_back(X); |
| 3711 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3712 | TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3713 | unsigned index = 1; |
| 3714 | for ( ; I != E; ++I, ++index) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3715 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3716 | Params.push_back(Ty); |
| 3717 | if (Ty != Type::VoidTy) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3718 | if (I->Attrs != ParamAttr::None) { |
| 3719 | ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; |
| 3720 | Attrs.push_back(X); |
| 3721 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3722 | } |
| 3723 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3724 | if (isVarArg) Params.pop_back(); |
| 3725 | |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3726 | ParamAttrsList *ActualAttrs = 0; |
| 3727 | if (!Attrs.empty()) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3728 | ActualAttrs = ParamAttrsList::get(Attrs); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3729 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3730 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, ActualAttrs); |
| 3731 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3732 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3733 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3734 | ;} |
| 3735 | break; |
| 3736 | |
| 3737 | case 139: |
| 3738 | #line 1400 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3739 | { // Sized array type? |
| 3740 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3741 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3742 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3743 | ;} |
| 3744 | break; |
| 3745 | |
| 3746 | case 140: |
| 3747 | #line 1405 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3748 | { // Vector type? |
| 3749 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3750 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3751 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3752 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 3753 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3754 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3755 | GEN_ERROR("Vector length should be a power of 2"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3756 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3757 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3758 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3759 | ;} |
| 3760 | break; |
| 3761 | |
| 3762 | case 141: |
| 3763 | #line 1417 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3764 | { // Structure type? |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3765 | std::vector<const Type*> Elements; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3766 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3767 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3768 | Elements.push_back(*I); |
| 3769 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3770 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3771 | delete (yyvsp[-1].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3772 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3773 | ;} |
| 3774 | break; |
| 3775 | |
| 3776 | case 142: |
| 3777 | #line 1427 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3778 | { // Empty structure type? |
| 3779 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3780 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3781 | ;} |
| 3782 | break; |
| 3783 | |
| 3784 | case 143: |
| 3785 | #line 1431 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3786 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3787 | std::vector<const Type*> Elements; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3788 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 3789 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3790 | Elements.push_back(*I); |
| 3791 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3792 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3793 | delete (yyvsp[-2].TypeList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3794 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3795 | ;} |
| 3796 | break; |
| 3797 | |
| 3798 | case 144: |
| 3799 | #line 1441 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3800 | { // Empty structure type? |
| 3801 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3802 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3803 | ;} |
| 3804 | break; |
| 3805 | |
| 3806 | case 145: |
| 3807 | #line 1448 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3808 | { |
| 3809 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3810 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3811 | ;} |
| 3812 | break; |
| 3813 | |
| 3814 | case 146: |
| 3815 | #line 1455 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3816 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3817 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3818 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 3819 | if (!(*(yyvsp[0].TypeVal))->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3820 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3821 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
| 3822 | ;} |
| 3823 | break; |
| 3824 | |
| 3825 | case 147: |
| 3826 | #line 1462 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3827 | { |
| 3828 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 3829 | ;} |
| 3830 | break; |
| 3831 | |
| 3832 | case 148: |
| 3833 | #line 1467 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3834 | { |
| 3835 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3836 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3837 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3838 | ;} |
| 3839 | break; |
| 3840 | |
| 3841 | case 149: |
| 3842 | #line 1472 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3843 | { |
| 3844 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3845 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3846 | ;} |
| 3847 | break; |
| 3848 | |
| 3849 | case 151: |
| 3850 | #line 1480 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3851 | { |
| 3852 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 3853 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3854 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3855 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3856 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3857 | ;} |
| 3858 | break; |
| 3859 | |
| 3860 | case 152: |
| 3861 | #line 1487 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3862 | { |
| 3863 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3864 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 3865 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3866 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3867 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3868 | ;} |
| 3869 | break; |
| 3870 | |
| 3871 | case 153: |
| 3872 | #line 1494 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3873 | { |
| 3874 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3875 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3876 | ;} |
| 3877 | break; |
| 3878 | |
| 3879 | case 154: |
| 3880 | #line 1502 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3881 | { |
| 3882 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 3883 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); |
| 3884 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3885 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3886 | ;} |
| 3887 | break; |
| 3888 | |
| 3889 | case 155: |
| 3890 | #line 1508 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3891 | { |
| 3892 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); |
| 3893 | delete (yyvsp[0].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3894 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3895 | ;} |
| 3896 | break; |
| 3897 | |
| 3898 | case 156: |
| 3899 | #line 1520 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3900 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3901 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3902 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3903 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3904 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3905 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3906 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3907 | const Type *ETy = ATy->getElementType(); |
| 3908 | int NumElements = ATy->getNumElements(); |
| 3909 | |
| 3910 | // Verify that we have the correct size... |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3911 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3912 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3913 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3914 | itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3915 | |
| 3916 | // Verify all elements are correct type! |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3917 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3918 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3919 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3920 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3921 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3922 | } |
| 3923 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3924 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3925 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3926 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3927 | ;} |
| 3928 | break; |
| 3929 | |
| 3930 | case 157: |
| 3931 | #line 1548 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3932 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3933 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3934 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3935 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3936 | if (ATy == 0) |
| 3937 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3938 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3939 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3940 | int NumElements = ATy->getNumElements(); |
| 3941 | if (NumElements != -1 && NumElements != 0) |
| 3942 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3943 | " arguments, but has size of " + itostr(NumElements) +""); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3944 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3945 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3946 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3947 | ;} |
| 3948 | break; |
| 3949 | |
| 3950 | case 158: |
| 3951 | #line 1564 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3952 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3953 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3954 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3955 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3956 | if (ATy == 0) |
| 3957 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3958 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3959 | |
| 3960 | int NumElements = ATy->getNumElements(); |
| 3961 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3962 | if (NumElements != -1 && NumElements != int((yyvsp[0].StrVal)->length())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3963 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3964 | itostr((int)((yyvsp[0].StrVal)->length())) + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3965 | " when array has size " + itostr(NumElements) + ""); |
| 3966 | std::vector<Constant*> Vals; |
| 3967 | if (ETy == Type::Int8Ty) { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3968 | for (unsigned i = 0; i < (yyvsp[0].StrVal)->length(); ++i) |
| 3969 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[0].StrVal))[i])); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3970 | } else { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3971 | delete (yyvsp[0].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3972 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 3973 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3974 | delete (yyvsp[0].StrVal); |
| 3975 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3976 | delete (yyvsp[-2].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3977 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3978 | ;} |
| 3979 | break; |
| 3980 | |
| 3981 | case 159: |
| 3982 | #line 1591 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3983 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3984 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3985 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3986 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3987 | if (PTy == 0) |
| 3988 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3989 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3990 | const Type *ETy = PTy->getElementType(); |
| 3991 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3992 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3993 | // Verify that we have the correct size... |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3994 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3995 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 3996 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3997 | itostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3998 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3999 | // Verify all elements are correct type! |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4000 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4001 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4002 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4003 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4004 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4005 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4006 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4007 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector)); |
| 4008 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4009 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4010 | ;} |
| 4011 | break; |
| 4012 | |
| 4013 | case 160: |
| 4014 | #line 1619 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4015 | { |
| 4016 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4017 | if (STy == 0) |
| 4018 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4019 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4020 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4021 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4022 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4023 | |
| 4024 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4025 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
| 4026 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4027 | GEN_ERROR("Expected type '" + |
| 4028 | STy->getElementType(i)->getDescription() + |
| 4029 | "' for element #" + utostr(i) + |
| 4030 | " of structure initializer"); |
| 4031 | |
| 4032 | // Check to ensure that Type is not packed |
| 4033 | if (STy->isPacked()) |
| 4034 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4035 | STy->getDescription() + "'"); |
| 4036 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4037 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 4038 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4039 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4040 | ;} |
| 4041 | break; |
| 4042 | |
| 4043 | case 161: |
| 4044 | #line 1645 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4045 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4046 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4047 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4048 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4049 | if (STy == 0) |
| 4050 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4051 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4052 | |
| 4053 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4054 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4055 | |
| 4056 | // Check to ensure that Type is not packed |
| 4057 | if (STy->isPacked()) |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4058 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4059 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4060 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4061 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4062 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4063 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4064 | ;} |
| 4065 | break; |
| 4066 | |
| 4067 | case 162: |
| 4068 | #line 1665 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4069 | { |
| 4070 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4071 | if (STy == 0) |
| 4072 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4073 | (*(yyvsp[-5].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4074 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4075 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4076 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4077 | |
| 4078 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4079 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) |
| 4080 | if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4081 | GEN_ERROR("Expected type '" + |
| 4082 | STy->getElementType(i)->getDescription() + |
| 4083 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4084 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4085 | |
| 4086 | // Check to ensure that Type is packed |
| 4087 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4088 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4089 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4090 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4091 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector)); |
| 4092 | delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4093 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4094 | ;} |
| 4095 | break; |
| 4096 | |
| 4097 | case 163: |
| 4098 | #line 1691 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4099 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4100 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4101 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 4102 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4103 | if (STy == 0) |
| 4104 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4105 | (*(yyvsp[-4].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4106 | |
| 4107 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4108 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4109 | |
| 4110 | // Check to ensure that Type is packed |
| 4111 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4112 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4113 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4114 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4115 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4116 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4117 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4118 | ;} |
| 4119 | break; |
| 4120 | |
| 4121 | case 164: |
| 4122 | #line 1711 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4123 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4124 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4125 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4126 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4127 | if (PTy == 0) |
| 4128 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4129 | (*(yyvsp[-1].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4130 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4131 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4132 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4133 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4134 | ;} |
| 4135 | break; |
| 4136 | |
| 4137 | case 165: |
| 4138 | #line 1723 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4139 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4140 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4141 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4142 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 4143 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4144 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4145 | ;} |
| 4146 | break; |
| 4147 | |
| 4148 | case 166: |
| 4149 | #line 1730 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4150 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4151 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4152 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4153 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4154 | if (Ty == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4155 | GEN_ERROR("Global const reference must be a pointer type"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4156 | |
| 4157 | // ConstExprs can exist in the body of a function, thus creating |
| 4158 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4159 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4160 | // symbol table instead of the module symbol table for the global symbol, |
| 4161 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4162 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4163 | // |
| 4164 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4165 | CurFun.CurrentFunction = 0; |
| 4166 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4167 | Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4168 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4169 | |
| 4170 | CurFun.CurrentFunction = SavedCurFn; |
| 4171 | |
| 4172 | // If this is an initializer for a constant pointer, which is referencing a |
| 4173 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4174 | // in the future with the right type of variable. |
| 4175 | // |
| 4176 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4177 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4178 | const PointerType *PT = cast<PointerType>(Ty); |
| 4179 | |
| 4180 | // First check to see if the forward references value is already created! |
| 4181 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4182 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4183 | |
| 4184 | if (I != CurModule.GlobalRefs.end()) { |
| 4185 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4186 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4187 | } else { |
| 4188 | std::string Name; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4189 | if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName) |
| 4190 | Name = (yyvsp[0].ValIDVal).getName(); |
| 4191 | else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4192 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4193 | |
| 4194 | // Create the forward referenced global. |
| 4195 | GlobalValue *GV; |
| 4196 | if (const FunctionType *FTy = |
| 4197 | dyn_cast<FunctionType>(PT->getElementType())) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4198 | GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4199 | CurModule.CurrentModule); |
| 4200 | } else { |
| 4201 | GV = new GlobalVariable(PT->getElementType(), false, |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4202 | GlobalValue::ExternalWeakLinkage, 0, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4203 | Name, CurModule.CurrentModule); |
| 4204 | } |
| 4205 | |
| 4206 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4207 | CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4208 | V = GV; |
| 4209 | } |
| 4210 | } |
| 4211 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4212 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4213 | delete (yyvsp[-1].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4214 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4215 | ;} |
| 4216 | break; |
| 4217 | |
| 4218 | case 167: |
| 4219 | #line 1796 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4220 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4221 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4222 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4223 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4224 | GEN_ERROR("Mismatched types for constant expression: " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4225 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); |
| 4226 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 4227 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4228 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4229 | ;} |
| 4230 | break; |
| 4231 | |
| 4232 | case 168: |
| 4233 | #line 1806 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4234 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4235 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4236 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4237 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4238 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4239 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4240 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4241 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4242 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4243 | ;} |
| 4244 | break; |
| 4245 | |
| 4246 | case 169: |
| 4247 | #line 1816 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4248 | { // integral constants |
| 4249 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4250 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4251 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4252 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4253 | ;} |
| 4254 | break; |
| 4255 | |
| 4256 | case 170: |
| 4257 | #line 1822 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4258 | { // arbitrary precision integer constants |
| 4259 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4260 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4261 | GEN_ERROR("Constant value does not fit in type"); |
| 4262 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4263 | (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth); |
| 4264 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
| 4265 | delete (yyvsp[0].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4266 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4267 | ;} |
| 4268 | break; |
| 4269 | |
| 4270 | case 171: |
| 4271 | #line 1832 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4272 | { // integral constants |
| 4273 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4274 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4275 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4276 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4277 | ;} |
| 4278 | break; |
| 4279 | |
| 4280 | case 172: |
| 4281 | #line 1838 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4282 | { // arbitrary precision integer constants |
| 4283 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4284 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4285 | GEN_ERROR("Constant value does not fit in type"); |
| 4286 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4287 | (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth); |
| 4288 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
| 4289 | delete (yyvsp[0].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4290 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4291 | ;} |
| 4292 | break; |
| 4293 | |
| 4294 | case 173: |
| 4295 | #line 1848 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4296 | { // Boolean constants |
| 4297 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4298 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4299 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4300 | ;} |
| 4301 | break; |
| 4302 | |
| 4303 | case 174: |
| 4304 | #line 1853 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4305 | { // Boolean constants |
| 4306 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4307 | (yyval.ConstVal) = ConstantInt::getFalse(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4308 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4309 | ;} |
| 4310 | break; |
| 4311 | |
| 4312 | case 175: |
| 4313 | #line 1858 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4314 | { // Float & Double constants |
| 4315 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4316 | GEN_ERROR("Floating point constant invalid for type"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4317 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4318 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4319 | ;} |
| 4320 | break; |
| 4321 | |
| 4322 | case 176: |
| 4323 | #line 1866 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4324 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4325 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4326 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4327 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4328 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4329 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4330 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4331 | Val->getType()->getDescription() + "' to '" + |
| 4332 | DestTy->getDescription() + "'"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4333 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
| 4334 | delete (yyvsp[-1].TypeVal); |
| 4335 | ;} |
| 4336 | break; |
| 4337 | |
| 4338 | case 177: |
| 4339 | #line 1878 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4340 | { |
| 4341 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4342 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4343 | |
| 4344 | const Type *IdxTy = |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4345 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(), |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 4346 | true); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4347 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4348 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4349 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4350 | SmallVector<Constant*, 8> IdxVec; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4351 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 4352 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4353 | IdxVec.push_back(C); |
| 4354 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4355 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4356 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4357 | delete (yyvsp[-1].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4358 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4359 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4360 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4361 | ;} |
| 4362 | break; |
| 4363 | |
| 4364 | case 178: |
| 4365 | #line 1900 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4366 | { |
| 4367 | if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4368 | GEN_ERROR("Select condition must be of boolean type"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4369 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4370 | GEN_ERROR("Select operand types must match"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4371 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4372 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4373 | ;} |
| 4374 | break; |
| 4375 | |
| 4376 | case 179: |
| 4377 | #line 1908 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4378 | { |
| 4379 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4380 | GEN_ERROR("Binary operator types must match"); |
| 4381 | CHECK_FOR_ERROR; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4382 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4383 | ;} |
| 4384 | break; |
| 4385 | |
| 4386 | case 180: |
| 4387 | #line 1914 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4388 | { |
| 4389 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4390 | GEN_ERROR("Logical operator types must match"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4391 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) { |
| 4392 | if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) || |
| 4393 | !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4394 | GEN_ERROR("Logical operator requires integral operands"); |
| 4395 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4396 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4397 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4398 | ;} |
| 4399 | break; |
| 4400 | |
| 4401 | case 181: |
| 4402 | #line 1925 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4403 | { |
| 4404 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4405 | GEN_ERROR("icmp operand types must match"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4406 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4407 | ;} |
| 4408 | break; |
| 4409 | |
| 4410 | case 182: |
| 4411 | #line 1930 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4412 | { |
| 4413 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4414 | GEN_ERROR("fcmp operand types must match"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4415 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4416 | ;} |
| 4417 | break; |
| 4418 | |
| 4419 | case 183: |
| 4420 | #line 1935 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4421 | { |
| 4422 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4423 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4424 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4425 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4426 | ;} |
| 4427 | break; |
| 4428 | |
| 4429 | case 184: |
| 4430 | #line 1941 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4431 | { |
| 4432 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4433 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4434 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4435 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4436 | ;} |
| 4437 | break; |
| 4438 | |
| 4439 | case 185: |
| 4440 | #line 1947 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4441 | { |
| 4442 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4443 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4444 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4445 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4446 | ;} |
| 4447 | break; |
| 4448 | |
| 4449 | case 186: |
| 4450 | #line 1956 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4451 | { |
| 4452 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4453 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4454 | ;} |
| 4455 | break; |
| 4456 | |
| 4457 | case 187: |
| 4458 | #line 1960 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4459 | { |
| 4460 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4461 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4462 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4463 | ;} |
| 4464 | break; |
| 4465 | |
| 4466 | case 188: |
| 4467 | #line 1968 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4468 | { (yyval.BoolVal) = false; ;} |
| 4469 | break; |
| 4470 | |
| 4471 | case 189: |
| 4472 | #line 1968 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4473 | { (yyval.BoolVal) = true; ;} |
| 4474 | break; |
| 4475 | |
| 4476 | case 190: |
| 4477 | #line 1971 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4478 | { (yyval.BoolVal) = true; ;} |
| 4479 | break; |
| 4480 | |
| 4481 | case 191: |
| 4482 | #line 1971 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4483 | { (yyval.BoolVal) = false; ;} |
| 4484 | break; |
| 4485 | |
| 4486 | case 192: |
| 4487 | #line 1974 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4488 | { |
| 4489 | const Type* VTy = (yyvsp[-1].TypeVal)->get(); |
| 4490 | Value *V = getVal(VTy, (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4491 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 4492 | if (!Aliasee) |
| 4493 | GEN_ERROR("Aliases can be created only to global values"); |
| 4494 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4495 | (yyval.ConstVal) = Aliasee; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4496 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4497 | delete (yyvsp[-1].TypeVal); |
| 4498 | ;} |
| 4499 | break; |
| 4500 | |
| 4501 | case 193: |
| 4502 | #line 1985 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4503 | { |
| 4504 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4505 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4506 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4507 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4508 | Val->getType()->getDescription() + "' to '" + |
| 4509 | DestTy->getDescription() + "'"); |
| 4510 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4511 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4512 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4513 | delete (yyvsp[-1].TypeVal); |
| 4514 | ;} |
| 4515 | break; |
| 4516 | |
| 4517 | case 194: |
| 4518 | #line 2006 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4519 | { |
| 4520 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4521 | CurModule.ModuleDone(); |
| 4522 | CHECK_FOR_ERROR; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4523 | ;} |
| 4524 | break; |
| 4525 | |
| 4526 | case 195: |
| 4527 | #line 2011 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4528 | { |
| 4529 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4530 | CurModule.ModuleDone(); |
| 4531 | CHECK_FOR_ERROR; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4532 | ;} |
| 4533 | break; |
| 4534 | |
| 4535 | case 198: |
| 4536 | #line 2024 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4537 | { CurFun.isDeclare = false; ;} |
| 4538 | break; |
| 4539 | |
| 4540 | case 199: |
| 4541 | #line 2024 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4542 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4543 | CurFun.FunctionDone(); |
| 4544 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4545 | ;} |
| 4546 | break; |
| 4547 | |
| 4548 | case 200: |
| 4549 | #line 2028 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4550 | { CurFun.isDeclare = true; ;} |
| 4551 | break; |
| 4552 | |
| 4553 | case 201: |
| 4554 | #line 2028 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4555 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4556 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4557 | ;} |
| 4558 | break; |
| 4559 | |
| 4560 | case 202: |
| 4561 | #line 2031 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4562 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4563 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4564 | ;} |
| 4565 | break; |
| 4566 | |
| 4567 | case 203: |
| 4568 | #line 2034 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4569 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4570 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4571 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4572 | // Eagerly resolve types. This is not an optimization, this is a |
| 4573 | // requirement that is due to the fact that we could have this: |
| 4574 | // |
| 4575 | // %list = type { %list * } |
| 4576 | // %list = type { %list * } ; repeated type decl |
| 4577 | // |
| 4578 | // If types are not resolved eagerly, then the two types will not be |
| 4579 | // determined to be the same type! |
| 4580 | // |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4581 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4582 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4583 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4584 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4585 | // If this is a named type that is not a redefinition, add it to the slot |
| 4586 | // table. |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4587 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4588 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4589 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4590 | delete (yyvsp[0].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4591 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4592 | ;} |
| 4593 | break; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4594 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4595 | case 204: |
| 4596 | #line 2058 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4597 | { |
| 4598 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); |
| 4599 | |
| 4600 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4601 | CHECK_FOR_ERROR |
| 4602 | // If this is a named type that is not a redefinition, add it to the slot |
| 4603 | // table. |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4604 | CurModule.Types.push_back((yyvsp[0].PrimType)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4605 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4606 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4607 | ;} |
| 4608 | break; |
| 4609 | |
| 4610 | case 205: |
| 4611 | #line 2069 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4612 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4613 | /* "Externally Visible" Linkage */ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4614 | if ((yyvsp[0].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4615 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4616 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), GlobalValue::ExternalLinkage, |
| 4617 | (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4618 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4619 | ;} |
| 4620 | break; |
| 4621 | |
| 4622 | case 206: |
| 4623 | #line 2076 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4624 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4625 | CurGV = 0; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4626 | ;} |
| 4627 | break; |
| 4628 | |
| 4629 | case 207: |
| 4630 | #line 2080 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4631 | { |
| 4632 | if ((yyvsp[0].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4633 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4634 | CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4635 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4636 | ;} |
| 4637 | break; |
| 4638 | |
| 4639 | case 208: |
| 4640 | #line 2085 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4641 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4642 | CurGV = 0; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4643 | ;} |
| 4644 | break; |
| 4645 | |
| 4646 | case 209: |
| 4647 | #line 2089 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4648 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4649 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4650 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 4651 | CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0, (yyvsp[-2].BoolVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4652 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4653 | delete (yyvsp[0].TypeVal); |
| 4654 | ;} |
| 4655 | break; |
| 4656 | |
| 4657 | case 210: |
| 4658 | #line 2095 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4659 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4660 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4661 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4662 | ;} |
| 4663 | break; |
| 4664 | |
| 4665 | case 211: |
| 4666 | #line 2099 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4667 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4668 | std::string Name; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4669 | if ((yyvsp[-4].StrVal)) { |
| 4670 | Name = *(yyvsp[-4].StrVal); |
| 4671 | delete (yyvsp[-4].StrVal); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4672 | } |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4673 | if (Name.empty()) |
| 4674 | GEN_ERROR("Alias name cannot be empty"); |
| 4675 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4676 | Constant* Aliasee = (yyvsp[0].ConstVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4677 | if (Aliasee == 0) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4678 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4679 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4680 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[-1].Linkage), Name, Aliasee, |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4681 | CurModule.CurrentModule); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4682 | GA->setVisibility((yyvsp[-3].Visibility)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4683 | InsertValue(GA, CurModule.Values); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4684 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4685 | ;} |
| 4686 | break; |
| 4687 | |
| 4688 | case 212: |
| 4689 | #line 2118 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4690 | { |
Anton Korobeynikov | 77d0f97 | 2007-04-25 14:29:12 +0000 | [diff] [blame] | 4691 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4692 | ;} |
| 4693 | break; |
| 4694 | |
| 4695 | case 213: |
| 4696 | #line 2121 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4697 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4698 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4699 | ;} |
| 4700 | break; |
| 4701 | |
| 4702 | case 214: |
| 4703 | #line 2127 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4704 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4705 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4706 | if (AsmSoFar.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4707 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4708 | else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4709 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[0].StrVal)); |
| 4710 | delete (yyvsp[0].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4711 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4712 | ;} |
| 4713 | break; |
| 4714 | |
| 4715 | case 215: |
| 4716 | #line 2137 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4717 | { |
| 4718 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[0].StrVal)); |
| 4719 | delete (yyvsp[0].StrVal); |
| 4720 | ;} |
| 4721 | break; |
| 4722 | |
| 4723 | case 216: |
| 4724 | #line 2141 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4725 | { |
| 4726 | CurModule.CurrentModule->setDataLayout(*(yyvsp[0].StrVal)); |
| 4727 | delete (yyvsp[0].StrVal); |
| 4728 | ;} |
| 4729 | break; |
| 4730 | |
| 4731 | case 218: |
| 4732 | #line 2148 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4733 | { |
| 4734 | CurModule.CurrentModule->addLibrary(*(yyvsp[0].StrVal)); |
| 4735 | delete (yyvsp[0].StrVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4736 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4737 | ;} |
| 4738 | break; |
| 4739 | |
| 4740 | case 219: |
| 4741 | #line 2153 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4742 | { |
| 4743 | CurModule.CurrentModule->addLibrary(*(yyvsp[0].StrVal)); |
| 4744 | delete (yyvsp[0].StrVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4745 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4746 | ;} |
| 4747 | break; |
| 4748 | |
| 4749 | case 220: |
| 4750 | #line 2158 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4751 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4752 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4753 | ;} |
| 4754 | break; |
| 4755 | |
| 4756 | case 221: |
| 4757 | #line 2167 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4758 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4759 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4760 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4761 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4762 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4763 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4764 | (yyval.ArgList) = (yyvsp[-4].ArgList); |
| 4765 | (yyvsp[-4].ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4766 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4767 | ;} |
| 4768 | break; |
| 4769 | |
| 4770 | case 222: |
| 4771 | #line 2177 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4772 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4773 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4774 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4775 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4776 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4777 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4778 | (yyval.ArgList) = new ArgListType; |
| 4779 | (yyval.ArgList)->push_back(E); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4780 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4781 | ;} |
| 4782 | break; |
| 4783 | |
| 4784 | case 223: |
| 4785 | #line 2188 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4786 | { |
| 4787 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4788 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4789 | ;} |
| 4790 | break; |
| 4791 | |
| 4792 | case 224: |
| 4793 | #line 2192 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4794 | { |
| 4795 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4796 | struct ArgListEntry E; |
| 4797 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4798 | E.Name = 0; |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 4799 | E.Attrs = ParamAttr::None; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4800 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4801 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4802 | ;} |
| 4803 | break; |
| 4804 | |
| 4805 | case 225: |
| 4806 | #line 2201 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4807 | { |
| 4808 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4809 | struct ArgListEntry E; |
| 4810 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4811 | E.Name = 0; |
| 4812 | E.Attrs = ParamAttr::None; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4813 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4814 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4815 | ;} |
| 4816 | break; |
| 4817 | |
| 4818 | case 226: |
| 4819 | #line 2210 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4820 | { |
| 4821 | (yyval.ArgList) = 0; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4822 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4823 | ;} |
| 4824 | break; |
| 4825 | |
| 4826 | case 227: |
| 4827 | #line 2216 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4828 | { |
| 4829 | std::string FunctionName(*(yyvsp[-6].StrVal)); |
| 4830 | delete (yyvsp[-6].StrVal); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4831 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4832 | // Check the function result for abstractness if this is a define. We should |
| 4833 | // have no abstract types at this point |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4834 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal))) |
| 4835 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4836 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4837 | std::vector<const Type*> ParamTypeList; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4838 | ParamAttrsVector Attrs; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4839 | if ((yyvsp[-2].ParamAttrs) != ParamAttr::None) { |
| 4840 | ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-2].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4841 | Attrs.push_back(PAWI); |
| 4842 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4843 | if ((yyvsp[-4].ArgList)) { // If there are arguments... |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 4844 | unsigned index = 1; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4845 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4846 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4847 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4848 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4849 | ParamTypeList.push_back(Ty); |
| 4850 | if (Ty != Type::VoidTy) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4851 | if (I->Attrs != ParamAttr::None) { |
| 4852 | ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; |
| 4853 | Attrs.push_back(PAWI); |
| 4854 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4855 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4856 | } |
| 4857 | |
| 4858 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4859 | if (isVarArg) ParamTypeList.pop_back(); |
| 4860 | |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4861 | ParamAttrsList *PAL = 0; |
| 4862 | if (!Attrs.empty()) |
| 4863 | PAL = ParamAttrsList::get(Attrs); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 4864 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4865 | FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, PAL); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4866 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4867 | delete (yyvsp[-7].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4868 | |
| 4869 | ValID ID; |
| 4870 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4871 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4872 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4873 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4874 | } |
| 4875 | |
| 4876 | Function *Fn = 0; |
| 4877 | // See if this function was forward referenced. If so, recycle the object. |
| 4878 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4879 | // Move the function to the end of the list, from whereever it was |
| 4880 | // previously inserted. |
| 4881 | Fn = cast<Function>(FWRef); |
| 4882 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4883 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4884 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4885 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4886 | if (Fn->getFunctionType() != FT) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4887 | // The existing function doesn't have the same type. This is an overload |
| 4888 | // error. |
| 4889 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
| 4890 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4891 | // Neither the existing or the current function is a declaration and they |
| 4892 | // have the same name and same type. Clearly this is a redefinition. |
| 4893 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4894 | } if (Fn->isDeclaration()) { |
| 4895 | // Make sure to strip off any argument names so we can't get conflicts. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4896 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4897 | AI != AE; ++AI) |
| 4898 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4899 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4900 | } else { // Not already defined? |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4901 | Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4902 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4903 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4904 | InsertValue(Fn, CurModule.Values); |
| 4905 | } |
| 4906 | |
| 4907 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4908 | |
| 4909 | if (CurFun.isDeclare) { |
| 4910 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4911 | // correctly handle cases, when pointer to function is passed as argument to |
| 4912 | // another function. |
| 4913 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4914 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4915 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4916 | Fn->setCallingConv((yyvsp[-8].UIntVal)); |
| 4917 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4918 | if ((yyvsp[-1].StrVal)) { |
| 4919 | Fn->setSection(*(yyvsp[-1].StrVal)); |
| 4920 | delete (yyvsp[-1].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4921 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4922 | |
| 4923 | // Add all of the arguments we parsed to the function... |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4924 | if ((yyvsp[-4].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4925 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4926 | assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 && |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4927 | "Not a varargs marker!"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4928 | delete (yyvsp[-4].ArgList)->back().Ty; |
| 4929 | (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4930 | } |
| 4931 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4932 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4933 | unsigned Idx = 1; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4934 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); |
| 4935 | I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4936 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4937 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4938 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4939 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4940 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4941 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4942 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4943 | delete (yyvsp[-4].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4944 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4945 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4946 | ;} |
| 4947 | break; |
| 4948 | |
| 4949 | case 230: |
| 4950 | #line 2338 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4951 | { |
| 4952 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4953 | |
| 4954 | // Make sure that we keep track of the linkage type even if there was a |
| 4955 | // previous "declare". |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4956 | (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage)); |
| 4957 | (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility)); |
| 4958 | ;} |
| 4959 | break; |
| 4960 | |
| 4961 | case 233: |
| 4962 | #line 2349 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4963 | { |
| 4964 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4965 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4966 | ;} |
| 4967 | break; |
| 4968 | |
| 4969 | case 234: |
| 4970 | #line 2354 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4971 | { |
| 4972 | CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); |
| 4973 | CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); |
| 4974 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4975 | CurFun.FunctionDone(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4976 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4977 | ;} |
| 4978 | break; |
| 4979 | |
| 4980 | case 235: |
| 4981 | #line 2366 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4982 | { |
| 4983 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4984 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4985 | ;} |
| 4986 | break; |
| 4987 | |
| 4988 | case 236: |
| 4989 | #line 2370 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4990 | { |
| 4991 | (yyval.BoolVal) = true; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4992 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 4993 | ;} |
| 4994 | break; |
| 4995 | |
| 4996 | case 237: |
| 4997 | #line 2375 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4998 | { // A reference to a direct constant |
| 4999 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5000 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5001 | ;} |
| 5002 | break; |
| 5003 | |
| 5004 | case 238: |
| 5005 | #line 2379 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5006 | { |
| 5007 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5008 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5009 | ;} |
| 5010 | break; |
| 5011 | |
| 5012 | case 239: |
| 5013 | #line 2383 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5014 | { // Perhaps it's an FP constant? |
| 5015 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5016 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5017 | ;} |
| 5018 | break; |
| 5019 | |
| 5020 | case 240: |
| 5021 | #line 2387 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5022 | { |
| 5023 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5024 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5025 | ;} |
| 5026 | break; |
| 5027 | |
| 5028 | case 241: |
| 5029 | #line 2391 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5030 | { |
| 5031 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5032 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5033 | ;} |
| 5034 | break; |
| 5035 | |
| 5036 | case 242: |
| 5037 | #line 2395 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5038 | { |
| 5039 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5040 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5041 | ;} |
| 5042 | break; |
| 5043 | |
| 5044 | case 243: |
| 5045 | #line 2399 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5046 | { |
| 5047 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5048 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5049 | ;} |
| 5050 | break; |
| 5051 | |
| 5052 | case 244: |
| 5053 | #line 2403 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5054 | { // A vector zero constant. |
| 5055 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5056 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5057 | ;} |
| 5058 | break; |
| 5059 | |
| 5060 | case 245: |
| 5061 | #line 2407 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5062 | { // Nonempty unsized packed vector |
| 5063 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
| 5064 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5065 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5066 | VectorType* pt = VectorType::get(ETy, NumElements); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5067 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5068 | HandleUpRefs( |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5069 | VectorType::get( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5070 | ETy, |
| 5071 | NumElements) |
| 5072 | ) |
| 5073 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5074 | |
| 5075 | // Verify all elements are correct type! |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5076 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 5077 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5078 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5079 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5080 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5081 | } |
| 5082 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5083 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector))); |
| 5084 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5085 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5086 | ;} |
| 5087 | break; |
| 5088 | |
| 5089 | case 246: |
| 5090 | #line 2432 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5091 | { |
| 5092 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5093 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5094 | ;} |
| 5095 | break; |
| 5096 | |
| 5097 | case 247: |
| 5098 | #line 2436 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5099 | { |
| 5100 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[-2].StrVal), *(yyvsp[0].StrVal), (yyvsp[-3].BoolVal)); |
| 5101 | delete (yyvsp[-2].StrVal); |
| 5102 | delete (yyvsp[0].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5103 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5104 | ;} |
| 5105 | break; |
| 5106 | |
| 5107 | case 248: |
| 5108 | #line 2446 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5109 | { // Is it an integer reference...? |
| 5110 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5111 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5112 | ;} |
| 5113 | break; |
| 5114 | |
| 5115 | case 249: |
| 5116 | #line 2450 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5117 | { |
| 5118 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5119 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5120 | ;} |
| 5121 | break; |
| 5122 | |
| 5123 | case 250: |
| 5124 | #line 2454 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5125 | { // Is it a named reference...? |
| 5126 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[0].StrVal)); |
| 5127 | delete (yyvsp[0].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5128 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5129 | ;} |
| 5130 | break; |
| 5131 | |
| 5132 | case 251: |
| 5133 | #line 2459 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5134 | { // Is it a named reference...? |
| 5135 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[0].StrVal)); |
| 5136 | delete (yyvsp[0].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5137 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5138 | ;} |
| 5139 | break; |
| 5140 | |
| 5141 | case 254: |
| 5142 | #line 2472 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5143 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5144 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5145 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5146 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
| 5147 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5148 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5149 | ;} |
| 5150 | break; |
| 5151 | |
| 5152 | case 255: |
| 5153 | #line 2481 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5154 | { |
| 5155 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5156 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5157 | ;} |
| 5158 | break; |
| 5159 | |
| 5160 | case 256: |
| 5161 | #line 2485 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5162 | { // Do not allow functions with 0 basic blocks |
| 5163 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5164 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5165 | ;} |
| 5166 | break; |
| 5167 | |
| 5168 | case 257: |
| 5169 | #line 2494 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5170 | { |
| 5171 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5172 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5173 | InsertValue((yyvsp[0].TermInstVal)); |
| 5174 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 5175 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5176 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5177 | ;} |
| 5178 | break; |
| 5179 | |
| 5180 | case 258: |
| 5181 | #line 2503 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5182 | { |
| 5183 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5184 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 5185 | if (CI2->getParent() == 0) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5186 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
| 5187 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 5188 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5189 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5190 | ;} |
| 5191 | break; |
| 5192 | |
| 5193 | case 259: |
| 5194 | #line 2512 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5195 | { // Empty space between instruction lists |
| 5196 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5197 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5198 | ;} |
| 5199 | break; |
| 5200 | |
| 5201 | case 260: |
| 5202 | #line 2516 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5203 | { // Labelled (named) basic block |
| 5204 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[0].StrVal))); |
| 5205 | delete (yyvsp[0].StrVal); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5206 | CHECK_FOR_ERROR |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5207 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5208 | ;} |
| 5209 | break; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5210 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5211 | case 261: |
| 5212 | #line 2523 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5213 | { // Return with a result... |
| 5214 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
| 5215 | CHECK_FOR_ERROR |
| 5216 | ;} |
| 5217 | break; |
| 5218 | |
| 5219 | case 262: |
| 5220 | #line 2527 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5221 | { // Return with no result... |
| 5222 | (yyval.TermInstVal) = new ReturnInst(); |
| 5223 | CHECK_FOR_ERROR |
| 5224 | ;} |
| 5225 | break; |
| 5226 | |
| 5227 | case 263: |
| 5228 | #line 2531 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5229 | { // Unconditional Branch... |
| 5230 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5231 | CHECK_FOR_ERROR |
| 5232 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 5233 | ;} |
| 5234 | break; |
| 5235 | |
| 5236 | case 264: |
| 5237 | #line 2536 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5238 | { |
| 5239 | assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 5240 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 5241 | CHECK_FOR_ERROR |
| 5242 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5243 | CHECK_FOR_ERROR |
| 5244 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); |
| 5245 | CHECK_FOR_ERROR |
| 5246 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 5247 | ;} |
| 5248 | break; |
| 5249 | |
| 5250 | case 265: |
| 5251 | #line 2546 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5252 | { |
| 5253 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
| 5254 | CHECK_FOR_ERROR |
| 5255 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 5256 | CHECK_FOR_ERROR |
| 5257 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 5258 | (yyval.TermInstVal) = S; |
| 5259 | |
| 5260 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 5261 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5262 | for (; I != E; ++I) { |
| 5263 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5264 | S->addCase(CI, I->second); |
| 5265 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5266 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5267 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5268 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5269 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5270 | ;} |
| 5271 | break; |
| 5272 | |
| 5273 | case 266: |
| 5274 | #line 2565 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5275 | { |
| 5276 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5277 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5278 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5279 | CHECK_FOR_ERROR |
| 5280 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5281 | (yyval.TermInstVal) = S; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5282 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5283 | ;} |
| 5284 | break; |
| 5285 | |
| 5286 | case 267: |
| 5287 | #line 2575 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5288 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5289 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5290 | // Handle the short syntax |
| 5291 | const PointerType *PFTy = 0; |
| 5292 | const FunctionType *Ty = 0; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5293 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5294 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5295 | // Pull out the types of all of the arguments... |
| 5296 | std::vector<const Type*> ParamTypes; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5297 | ParamAttrsVector Attrs; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5298 | if ((yyvsp[-6].ParamAttrs) != ParamAttr::None) { |
| 5299 | ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-6].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5300 | Attrs.push_back(PAWI); |
| 5301 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5302 | ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5303 | unsigned index = 1; |
| 5304 | for (; I != E; ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5305 | const Type *Ty = I->Val->getType(); |
| 5306 | if (Ty == Type::VoidTy) |
| 5307 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5308 | ParamTypes.push_back(Ty); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5309 | if (I->Attrs != ParamAttr::None) { |
| 5310 | ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; |
| 5311 | Attrs.push_back(PAWI); |
| 5312 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5313 | } |
| 5314 | |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5315 | ParamAttrsList *PAL = 0; |
| 5316 | if (!Attrs.empty()) |
| 5317 | PAL = ParamAttrsList::get(Attrs); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5318 | Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, PAL); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5319 | PFTy = PointerType::get(Ty); |
| 5320 | } |
| 5321 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5322 | delete (yyvsp[-11].TypeVal); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5323 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5324 | Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5325 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5326 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5327 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5328 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5329 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5330 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5331 | // Check the arguments |
| 5332 | ValueList Args; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5333 | if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5334 | // Make sure no arguments is a good thing! |
| 5335 | if (Ty->getNumParams() != 0) |
| 5336 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5337 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5338 | } else { // Has arguments? |
| 5339 | // Loop through FunctionType's arguments and ensure they are specified |
| 5340 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5341 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5342 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5343 | ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5344 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5345 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5346 | if (ArgI->Val->getType() != *I) |
| 5347 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5348 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5349 | Args.push_back(ArgI->Val); |
| 5350 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5351 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5352 | if (Ty->isVarArg()) { |
| 5353 | if (I == E) |
| 5354 | for (; ArgI != ArgE; ++ArgI) |
| 5355 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5356 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5357 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5358 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5359 | |
| 5360 | // Create the InvokeInst |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5361 | InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size()); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5362 | II->setCallingConv((yyvsp[-12].UIntVal)); |
| 5363 | (yyval.TermInstVal) = II; |
| 5364 | delete (yyvsp[-8].ValueRefList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5365 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5366 | ;} |
| 5367 | break; |
| 5368 | |
| 5369 | case 268: |
| 5370 | #line 2654 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5371 | { |
| 5372 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5373 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5374 | ;} |
| 5375 | break; |
| 5376 | |
| 5377 | case 269: |
| 5378 | #line 2658 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5379 | { |
| 5380 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5381 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5382 | ;} |
| 5383 | break; |
| 5384 | |
| 5385 | case 270: |
| 5386 | #line 2665 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5387 | { |
| 5388 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
| 5389 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5390 | CHECK_FOR_ERROR |
| 5391 | if (V == 0) |
| 5392 | GEN_ERROR("May only switch on a constant pool value"); |
| 5393 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5394 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5395 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5396 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5397 | ;} |
| 5398 | break; |
| 5399 | |
| 5400 | case 271: |
| 5401 | #line 2676 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5402 | { |
| 5403 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5404 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5405 | CHECK_FOR_ERROR |
| 5406 | |
| 5407 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5408 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5409 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5410 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5411 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5412 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5413 | ;} |
| 5414 | break; |
| 5415 | |
| 5416 | case 272: |
| 5417 | #line 2689 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5418 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5419 | // Is this definition named?? if so, assign the name... |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5420 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5421 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5422 | InsertValue((yyvsp[0].InstVal)); |
| 5423 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5424 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5425 | ;} |
| 5426 | break; |
| 5427 | |
| 5428 | case 273: |
| 5429 | #line 2699 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5430 | { // Used for PHI nodes |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5431 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5432 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); |
| 5433 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5434 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5435 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5436 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5437 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5438 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5439 | delete (yyvsp[-5].TypeVal); |
| 5440 | ;} |
| 5441 | break; |
| 5442 | |
| 5443 | case 274: |
| 5444 | #line 2710 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5445 | { |
| 5446 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5447 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5448 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5449 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5450 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5451 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5452 | ;} |
| 5453 | break; |
| 5454 | |
| 5455 | case 275: |
| 5456 | #line 2720 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5457 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5458 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5459 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5460 | // Used for call and invoke instructions |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5461 | (yyval.ValueRefList) = new ValueRefList(); |
| 5462 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5463 | (yyval.ValueRefList)->push_back(E); |
| 5464 | delete (yyvsp[-2].TypeVal); |
| 5465 | ;} |
| 5466 | break; |
| 5467 | |
| 5468 | case 276: |
| 5469 | #line 2729 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5470 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5471 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5472 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5473 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); |
| 5474 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5475 | (yyval.ValueRefList)->push_back(E); |
| 5476 | delete (yyvsp[-2].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5477 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5478 | ;} |
| 5479 | break; |
| 5480 | |
| 5481 | case 277: |
| 5482 | #line 2738 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5483 | { (yyval.ValueRefList) = new ValueRefList(); ;} |
| 5484 | break; |
| 5485 | |
| 5486 | case 278: |
| 5487 | #line 2741 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5488 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5489 | break; |
| 5490 | |
| 5491 | case 279: |
| 5492 | #line 2742 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5493 | { |
| 5494 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5495 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5496 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5497 | ;} |
| 5498 | break; |
| 5499 | |
| 5500 | case 280: |
| 5501 | #line 2749 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5502 | { |
| 5503 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5504 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5505 | ;} |
| 5506 | break; |
| 5507 | |
| 5508 | case 281: |
| 5509 | #line 2753 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5510 | { |
| 5511 | (yyval.BoolVal) = false; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5512 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5513 | ;} |
| 5514 | break; |
| 5515 | |
| 5516 | case 282: |
| 5517 | #line 2758 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5518 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5519 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5520 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5521 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5522 | !isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5523 | GEN_ERROR( |
| 5524 | "Arithmetic operator requires integer, FP, or packed operands"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5525 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5526 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5527 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5528 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5529 | GEN_ERROR("Remainder not supported on vector types"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5530 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5531 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5532 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5533 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5534 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
| 5535 | if ((yyval.InstVal) == 0) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5536 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5537 | delete (yyvsp[-3].TypeVal); |
| 5538 | ;} |
| 5539 | break; |
| 5540 | |
| 5541 | case 283: |
| 5542 | #line 2779 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5543 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5544 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5545 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5546 | if (!(*(yyvsp[-3].TypeVal))->isInteger()) { |
| 5547 | if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) || |
| 5548 | !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5549 | GEN_ERROR("Logical operator requires integral operands"); |
| 5550 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5551 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5552 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5553 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5554 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5555 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
| 5556 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5557 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5558 | delete (yyvsp[-3].TypeVal); |
| 5559 | ;} |
| 5560 | break; |
| 5561 | |
| 5562 | case 284: |
| 5563 | #line 2796 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5564 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5565 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5566 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5567 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5568 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5569 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5570 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5571 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5572 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5573 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5574 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5575 | GEN_ERROR("icmp operator returned null"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5576 | delete (yyvsp[-3].TypeVal); |
| 5577 | ;} |
| 5578 | break; |
| 5579 | |
| 5580 | case 285: |
| 5581 | #line 2810 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5582 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5583 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5584 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5585 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5586 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5587 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5588 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5589 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5590 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5591 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5592 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5593 | GEN_ERROR("fcmp operator returned null"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5594 | delete (yyvsp[-3].TypeVal); |
| 5595 | ;} |
| 5596 | break; |
| 5597 | |
| 5598 | case 286: |
| 5599 | #line 2824 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5600 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5601 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5602 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5603 | Value* Val = (yyvsp[-2].ValueVal); |
| 5604 | const Type* DestTy = (yyvsp[0].TypeVal)->get(); |
| 5605 | if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5606 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5607 | Val->getType()->getDescription() + "' to '" + |
| 5608 | DestTy->getDescription() + "'"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5609 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy); |
| 5610 | delete (yyvsp[0].TypeVal); |
| 5611 | ;} |
| 5612 | break; |
| 5613 | |
| 5614 | case 287: |
| 5615 | #line 2836 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5616 | { |
| 5617 | if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5618 | GEN_ERROR("select condition must be boolean"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5619 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5620 | GEN_ERROR("select value types should match"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5621 | (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5622 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5623 | ;} |
| 5624 | break; |
| 5625 | |
| 5626 | case 288: |
| 5627 | #line 2844 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5628 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5629 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5630 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5631 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5632 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5633 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5634 | ;} |
| 5635 | break; |
| 5636 | |
| 5637 | case 289: |
| 5638 | #line 2851 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5639 | { |
| 5640 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5641 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5642 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5643 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5644 | ;} |
| 5645 | break; |
| 5646 | |
| 5647 | case 290: |
| 5648 | #line 2857 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5649 | { |
| 5650 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5651 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5652 | (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5653 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5654 | ;} |
| 5655 | break; |
| 5656 | |
| 5657 | case 291: |
| 5658 | #line 2863 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5659 | { |
| 5660 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5661 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5662 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5663 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5664 | ;} |
| 5665 | break; |
| 5666 | |
| 5667 | case 292: |
| 5668 | #line 2869 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5669 | { |
| 5670 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5671 | if (!Ty->isFirstClassType()) |
| 5672 | GEN_ERROR("PHI node operands must be of first class type"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5673 | (yyval.InstVal) = new PHINode(Ty); |
| 5674 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5675 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5676 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5677 | GEN_ERROR("All elements of a PHI node must be of the same type"); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5678 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5679 | (yyvsp[0].PHIList)->pop_front(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5680 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5681 | delete (yyvsp[0].PHIList); // Free the list... |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5682 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5683 | ;} |
| 5684 | break; |
| 5685 | |
| 5686 | case 293: |
| 5687 | #line 2885 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5688 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5689 | |
| 5690 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5691 | const PointerType *PFTy = 0; |
| 5692 | const FunctionType *Ty = 0; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5693 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5694 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5695 | // Pull out the types of all of the arguments... |
| 5696 | std::vector<const Type*> ParamTypes; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5697 | ParamAttrsVector Attrs; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5698 | if ((yyvsp[0].ParamAttrs) != ParamAttr::None) { |
| 5699 | ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[0].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5700 | Attrs.push_back(PAWI); |
| 5701 | } |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5702 | unsigned index = 1; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5703 | ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5704 | for (; I != E; ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5705 | const Type *Ty = I->Val->getType(); |
| 5706 | if (Ty == Type::VoidTy) |
| 5707 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5708 | ParamTypes.push_back(Ty); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5709 | if (I->Attrs != ParamAttr::None) { |
| 5710 | ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; |
| 5711 | Attrs.push_back(PAWI); |
| 5712 | } |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5713 | } |
| 5714 | |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5715 | ParamAttrsList *PAL = 0; |
| 5716 | if (!Attrs.empty()) |
| 5717 | PAL = ParamAttrsList::get(Attrs); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5718 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5719 | Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, PAL); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5720 | PFTy = PointerType::get(Ty); |
| 5721 | } |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5722 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5723 | Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5724 | CHECK_FOR_ERROR |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5725 | |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 5726 | // Check for call to invalid intrinsic to avoid crashing later. |
| 5727 | if (Function *theF = dyn_cast<Function>(V)) { |
Reid Spencer | ed48de2 | 2007-04-16 22:02:23 +0000 | [diff] [blame] | 5728 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
Reid Spencer | 36fdde1 | 2007-04-16 20:35:38 +0000 | [diff] [blame] | 5729 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 5730 | !theF->getIntrinsicID(true)) |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 5731 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 5732 | theF->getName() + "'"); |
| 5733 | } |
| 5734 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5735 | // Check the arguments |
| 5736 | ValueList Args; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5737 | if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5738 | // Make sure no arguments is a good thing! |
| 5739 | if (Ty->getNumParams() != 0) |
| 5740 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5741 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5742 | } else { // Has arguments? |
| 5743 | // Loop through FunctionType's arguments and ensure they are specified |
| 5744 | // correctly! |
| 5745 | // |
| 5746 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5747 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5748 | ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5749 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5750 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5751 | if (ArgI->Val->getType() != *I) |
| 5752 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5753 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5754 | Args.push_back(ArgI->Val); |
| 5755 | } |
| 5756 | if (Ty->isVarArg()) { |
| 5757 | if (I == E) |
| 5758 | for (; ArgI != ArgE; ++ArgI) |
| 5759 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5760 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5761 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5762 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5763 | // Create the call node |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5764 | CallInst *CI = new CallInst(V, &Args[0], Args.size()); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5765 | CI->setTailCall((yyvsp[-7].BoolVal)); |
| 5766 | CI->setCallingConv((yyvsp[-6].UIntVal)); |
| 5767 | (yyval.InstVal) = CI; |
| 5768 | delete (yyvsp[-2].ValueRefList); |
| 5769 | delete (yyvsp[-5].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5770 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5771 | ;} |
| 5772 | break; |
| 5773 | |
| 5774 | case 294: |
| 5775 | #line 2969 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5776 | { |
| 5777 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5778 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5779 | ;} |
| 5780 | break; |
| 5781 | |
| 5782 | case 295: |
| 5783 | #line 2974 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5784 | { |
| 5785 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5786 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5787 | ;} |
| 5788 | break; |
| 5789 | |
| 5790 | case 296: |
| 5791 | #line 2978 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5792 | { |
| 5793 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5794 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5795 | ;} |
| 5796 | break; |
| 5797 | |
| 5798 | case 297: |
| 5799 | #line 2985 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5800 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5801 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5802 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5803 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5804 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5805 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5806 | ;} |
| 5807 | break; |
| 5808 | |
| 5809 | case 298: |
| 5810 | #line 2992 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5811 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5812 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5813 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5814 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5815 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5816 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5817 | delete (yyvsp[-4].TypeVal); |
| 5818 | ;} |
| 5819 | break; |
| 5820 | |
| 5821 | case 299: |
| 5822 | #line 3000 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5823 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5824 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5825 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5826 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5827 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5828 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5829 | ;} |
| 5830 | break; |
| 5831 | |
| 5832 | case 300: |
| 5833 | #line 3007 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5834 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5835 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5836 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5837 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5838 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5839 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5840 | delete (yyvsp[-4].TypeVal); |
| 5841 | ;} |
| 5842 | break; |
| 5843 | |
| 5844 | case 301: |
| 5845 | #line 3015 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5846 | { |
| 5847 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5848 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5849 | (yyvsp[0].ValueVal)->getType()->getDescription() + ""); |
| 5850 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5851 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5852 | ;} |
| 5853 | break; |
| 5854 | |
| 5855 | case 302: |
| 5856 | #line 3023 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5857 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5858 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5859 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5860 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5861 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5862 | (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5863 | if (!cast<PointerType>((yyvsp[-2].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5864 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5865 | (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5866 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5867 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5868 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-4].BoolVal), (yyvsp[0].UIntVal)); |
| 5869 | delete (yyvsp[-2].TypeVal); |
| 5870 | ;} |
| 5871 | break; |
| 5872 | |
| 5873 | case 303: |
| 5874 | #line 3037 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5875 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5876 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5877 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5878 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5879 | if (!PT) |
| 5880 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5881 | (*(yyvsp[-2].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5882 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5883 | if (ElTy != (yyvsp[-4].ValueVal)->getType()) |
| 5884 | GEN_ERROR("Can't store '" + (yyvsp[-4].ValueVal)->getType()->getDescription() + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5885 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 5886 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5887 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5888 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5889 | (yyval.InstVal) = new StoreInst((yyvsp[-4].ValueVal), tmpVal, (yyvsp[-6].BoolVal), (yyvsp[0].UIntVal)); |
| 5890 | delete (yyvsp[-2].TypeVal); |
| 5891 | ;} |
| 5892 | break; |
| 5893 | |
| 5894 | case 304: |
| 5895 | #line 3054 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5896 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5897 | if (!UpRefs.empty()) |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5898 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5899 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5900 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5901 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5902 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5903 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5904 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'"); |
| 5905 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5906 | CHECK_FOR_ERROR |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5907 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size()); |
| 5908 | delete (yyvsp[-2].TypeVal); |
| 5909 | delete (yyvsp[0].ValueList); |
| 5910 | ;} |
| 5911 | break; |
| 5912 | |
| 5913 | |
| 5914 | default: break; |
| 5915 | } |
| 5916 | |
| 5917 | /* Line 1126 of yacc.c. */ |
| 5918 | #line 5919 "llvmAsmParser.tab.c" |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5919 | |
| 5920 | yyvsp -= yylen; |
| 5921 | yyssp -= yylen; |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 5922 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5923 | |
| 5924 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5925 | |
| 5926 | *++yyvsp = yyval; |
| 5927 | |
| 5928 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5929 | /* Now `shift' the result of the reduction. Determine what state |
| 5930 | that goes to, based on the state we popped back to and the rule |
| 5931 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5932 | |
| 5933 | yyn = yyr1[yyn]; |
| 5934 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5935 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5936 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5937 | yystate = yytable[yystate]; |
| 5938 | else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5939 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5940 | |
| 5941 | goto yynewstate; |
| 5942 | |
| 5943 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5944 | /*------------------------------------. |
| 5945 | | yyerrlab -- here on detecting error | |
| 5946 | `------------------------------------*/ |
| 5947 | yyerrlab: |
| 5948 | /* If not already recovering from an error, report this error. */ |
| 5949 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5950 | { |
| 5951 | ++yynerrs; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5952 | #if YYERROR_VERBOSE |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5953 | yyn = yypact[yystate]; |
| 5954 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5955 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5956 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5957 | int yytype = YYTRANSLATE (yychar); |
| 5958 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5959 | YYSIZE_T yysize = yysize0; |
| 5960 | YYSIZE_T yysize1; |
| 5961 | int yysize_overflow = 0; |
| 5962 | char *yymsg = 0; |
| 5963 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5964 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5965 | int yyx; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5966 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5967 | #if 0 |
| 5968 | /* This is so xgettext sees the translatable formats that are |
| 5969 | constructed on the fly. */ |
| 5970 | YY_("syntax error, unexpected %s"); |
| 5971 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5972 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5973 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5974 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5975 | #endif |
| 5976 | char *yyfmt; |
| 5977 | char const *yyf; |
| 5978 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5979 | static char const yyexpecting[] = ", expecting %s"; |
| 5980 | static char const yyor[] = " or %s"; |
| 5981 | char yyformat[sizeof yyunexpected |
| 5982 | + sizeof yyexpecting - 1 |
| 5983 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5984 | * (sizeof yyor - 1))]; |
| 5985 | char const *yyprefix = yyexpecting; |
| 5986 | |
| 5987 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5988 | YYCHECK. */ |
| 5989 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5990 | |
| 5991 | /* Stay within bounds of both yycheck and yytname. */ |
| 5992 | int yychecklim = YYLAST - yyn; |
| 5993 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5994 | int yycount = 1; |
| 5995 | |
| 5996 | yyarg[0] = yytname[yytype]; |
| 5997 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5998 | |
| 5999 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 6000 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 6001 | { |
| 6002 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 6003 | { |
| 6004 | yycount = 1; |
| 6005 | yysize = yysize0; |
| 6006 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 6007 | break; |
| 6008 | } |
| 6009 | yyarg[yycount++] = yytname[yyx]; |
| 6010 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 6011 | yysize_overflow |= yysize1 < yysize; |
| 6012 | yysize = yysize1; |
| 6013 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 6014 | yyprefix = yyor; |
| 6015 | } |
| 6016 | |
| 6017 | yyf = YY_(yyformat); |
| 6018 | yysize1 = yysize + yystrlen (yyf); |
| 6019 | yysize_overflow |= yysize1 < yysize; |
| 6020 | yysize = yysize1; |
| 6021 | |
| 6022 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 6023 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 6024 | if (yymsg) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6025 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6026 | /* Avoid sprintf, as that infringes on the user's name space. |
| 6027 | Don't have undefined behavior even if the translation |
| 6028 | produced a string with the wrong number of "%s"s. */ |
| 6029 | char *yyp = yymsg; |
| 6030 | int yyi = 0; |
| 6031 | while ((*yyp = *yyf)) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6032 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6033 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 6034 | { |
| 6035 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 6036 | yyf += 2; |
| 6037 | } |
| 6038 | else |
| 6039 | { |
| 6040 | yyp++; |
| 6041 | yyf++; |
| 6042 | } |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6043 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6044 | yyerror (yymsg); |
| 6045 | YYSTACK_FREE (yymsg); |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6046 | } |
| 6047 | else |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6048 | { |
| 6049 | yyerror (YY_("syntax error")); |
| 6050 | goto yyexhaustedlab; |
| 6051 | } |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6052 | } |
| 6053 | else |
| 6054 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6055 | yyerror (YY_("syntax error")); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6056 | } |
| 6057 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6058 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6059 | |
| 6060 | if (yyerrstatus == 3) |
| 6061 | { |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6062 | /* If just tried and failed to reuse look-ahead token after an |
| 6063 | error, discard it. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6064 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6065 | if (yychar <= YYEOF) |
| 6066 | { |
| 6067 | /* Return failure if at end of input. */ |
| 6068 | if (yychar == YYEOF) |
| 6069 | YYABORT; |
| 6070 | } |
| 6071 | else |
| 6072 | { |
| 6073 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 6074 | yychar = YYEMPTY; |
| 6075 | } |
| 6076 | } |
| 6077 | |
| 6078 | /* Else will try to reuse look-ahead token after shifting the error |
| 6079 | token. */ |
| 6080 | goto yyerrlab1; |
| 6081 | |
| 6082 | |
| 6083 | /*---------------------------------------------------. |
| 6084 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 6085 | `---------------------------------------------------*/ |
| 6086 | yyerrorlab: |
| 6087 | |
| 6088 | /* Pacify compilers like GCC when the user code never invokes |
| 6089 | YYERROR and the label yyerrorlab therefore never appears in user |
| 6090 | code. */ |
| 6091 | if (0) |
| 6092 | goto yyerrorlab; |
| 6093 | |
| 6094 | yyvsp -= yylen; |
| 6095 | yyssp -= yylen; |
| 6096 | yystate = *yyssp; |
| 6097 | goto yyerrlab1; |
| 6098 | |
| 6099 | |
| 6100 | /*-------------------------------------------------------------. |
| 6101 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 6102 | `-------------------------------------------------------------*/ |
| 6103 | yyerrlab1: |
| 6104 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 6105 | |
| 6106 | for (;;) |
| 6107 | { |
| 6108 | yyn = yypact[yystate]; |
| 6109 | if (yyn != YYPACT_NINF) |
| 6110 | { |
| 6111 | yyn += YYTERROR; |
| 6112 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 6113 | { |
| 6114 | yyn = yytable[yyn]; |
| 6115 | if (0 < yyn) |
| 6116 | break; |
| 6117 | } |
| 6118 | } |
| 6119 | |
| 6120 | /* Pop the current state because it cannot handle the error token. */ |
| 6121 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6122 | YYABORT; |
| 6123 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6124 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6125 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 6126 | YYPOPSTACK; |
| 6127 | yystate = *yyssp; |
| 6128 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6129 | } |
| 6130 | |
| 6131 | if (yyn == YYFINAL) |
| 6132 | YYACCEPT; |
| 6133 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6134 | *++yyvsp = yylval; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6135 | |
| 6136 | |
| 6137 | /* Shift the error token. */ |
| 6138 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6139 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6140 | yystate = yyn; |
| 6141 | goto yynewstate; |
| 6142 | |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 6143 | |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6144 | /*-------------------------------------. |
| 6145 | | yyacceptlab -- YYACCEPT comes here. | |
| 6146 | `-------------------------------------*/ |
| 6147 | yyacceptlab: |
| 6148 | yyresult = 0; |
| 6149 | goto yyreturn; |
| 6150 | |
| 6151 | /*-----------------------------------. |
| 6152 | | yyabortlab -- YYABORT comes here. | |
| 6153 | `-----------------------------------*/ |
| 6154 | yyabortlab: |
| 6155 | yyresult = 1; |
| 6156 | goto yyreturn; |
| 6157 | |
| 6158 | #ifndef yyoverflow |
| 6159 | /*-------------------------------------------------. |
| 6160 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 6161 | `-------------------------------------------------*/ |
| 6162 | yyexhaustedlab: |
| 6163 | yyerror (YY_("memory exhausted")); |
| 6164 | yyresult = 2; |
| 6165 | /* Fall through. */ |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 6166 | #endif |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6167 | |
| 6168 | yyreturn: |
| 6169 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 6170 | yydestruct ("Cleanup: discarding lookahead", |
| 6171 | yytoken, &yylval); |
| 6172 | while (yyssp != yyss) |
| 6173 | { |
| 6174 | yydestruct ("Cleanup: popping", |
| 6175 | yystos[*yyssp], yyvsp); |
| 6176 | YYPOPSTACK; |
Chris Lattner | ce5f24e | 2007-07-05 17:26:49 +0000 | [diff] [blame] | 6177 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6178 | #ifndef yyoverflow |
| 6179 | if (yyss != yyssa) |
| 6180 | YYSTACK_FREE (yyss); |
| 6181 | #endif |
| 6182 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6183 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6184 | |
| 6185 | |
| 6186 | #line 3071 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6187 | |
| 6188 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6189 | // common code from the two 'RunVMAsmParser' functions |
| 6190 | static Module* RunParser(Module * M) { |
| 6191 | |
| 6192 | llvmAsmlineno = 1; // Reset the current line number... |
| 6193 | CurModule.CurrentModule = M; |
| 6194 | #if YYDEBUG |
| 6195 | yydebug = Debug; |
| 6196 | #endif |
| 6197 | |
| 6198 | // Check to make sure the parser succeeded |
| 6199 | if (yyparse()) { |
| 6200 | if (ParserResult) |
| 6201 | delete ParserResult; |
| 6202 | return 0; |
| 6203 | } |
| 6204 | |
Reid Spencer | 0d60b5a | 2007-03-30 01:37:39 +0000 | [diff] [blame] | 6205 | // Emit an error if there are any unresolved types left. |
| 6206 | if (!CurModule.LateResolveTypes.empty()) { |
| 6207 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 6208 | if (DID.Type == ValID::LocalName) { |
| 6209 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 6210 | } else { |
| 6211 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 6212 | } |
| 6213 | if (ParserResult) |
| 6214 | delete ParserResult; |
| 6215 | return 0; |
| 6216 | } |
| 6217 | |
| 6218 | // Emit an error if there are any unresolved values left. |
| 6219 | if (!CurModule.LateResolveValues.empty()) { |
| 6220 | Value *V = CurModule.LateResolveValues.back(); |
| 6221 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 6222 | CurModule.PlaceHolderInfo.find(V); |
| 6223 | |
| 6224 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 6225 | ValID &DID = I->second.first; |
| 6226 | if (DID.Type == ValID::LocalName) { |
| 6227 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 6228 | } else { |
| 6229 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 6230 | } |
| 6231 | if (ParserResult) |
| 6232 | delete ParserResult; |
| 6233 | return 0; |
| 6234 | } |
| 6235 | } |
| 6236 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6237 | // Check to make sure that parsing produced a result |
| 6238 | if (!ParserResult) |
| 6239 | return 0; |
| 6240 | |
| 6241 | // Reset ParserResult variable while saving its value for the result. |
| 6242 | Module *Result = ParserResult; |
| 6243 | ParserResult = 0; |
| 6244 | |
| 6245 | return Result; |
| 6246 | } |
| 6247 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6248 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 6249 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 6250 | // TODO: column number in exception |
| 6251 | if (TheParseError) |
| 6252 | TheParseError->setError(CurFilename, message, LineNo); |
| 6253 | TriggerError = 1; |
| 6254 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6255 | |
| 6256 | int yyerror(const char *ErrorMsg) { |
| 6257 | std::string where |
| 6258 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 6259 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 6260 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
| 6261 | if (yychar != YYEMPTY && yychar != 0) |
| 6262 | errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ |
| 6263 | "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6264 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6265 | return 0; |
| 6266 | } |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6267 | |