Reid Spencer | ed951ea | 2007-05-19 07:22:10 +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 | ed951ea | 2007-05-19 07:22:10 +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 | ed951ea | 2007-05-19 07:22:10 +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 | ed951ea | 2007-05-19 07:22:10 +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 | ed951ea | 2007-05-19 07:22:10 +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 | ed951ea | 2007-05-19 07:22:10 +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 | ed951ea | 2007-05-19 07:22:10 +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 | NORETURN = 386, |
| 196 | INREG = 387, |
| 197 | SRET = 388, |
| 198 | NOUNWIND = 389, |
| 199 | DEFAULT = 390, |
| 200 | HIDDEN = 391, |
| 201 | PROTECTED = 392 |
| 202 | }; |
| 203 | #endif |
| 204 | /* Tokens. */ |
| 205 | #define ESINT64VAL 258 |
| 206 | #define EUINT64VAL 259 |
| 207 | #define ESAPINTVAL 260 |
| 208 | #define EUAPINTVAL 261 |
| 209 | #define LOCALVAL_ID 262 |
| 210 | #define GLOBALVAL_ID 263 |
| 211 | #define FPVAL 264 |
| 212 | #define VOID 265 |
| 213 | #define INTTYPE 266 |
| 214 | #define FLOAT 267 |
| 215 | #define DOUBLE 268 |
| 216 | #define LABEL 269 |
| 217 | #define TYPE 270 |
| 218 | #define LOCALVAR 271 |
| 219 | #define GLOBALVAR 272 |
| 220 | #define LABELSTR 273 |
| 221 | #define STRINGCONSTANT 274 |
| 222 | #define ATSTRINGCONSTANT 275 |
| 223 | #define PCTSTRINGCONSTANT 276 |
| 224 | #define ZEROINITIALIZER 277 |
| 225 | #define TRUETOK 278 |
| 226 | #define FALSETOK 279 |
| 227 | #define BEGINTOK 280 |
| 228 | #define ENDTOK 281 |
| 229 | #define DECLARE 282 |
| 230 | #define DEFINE 283 |
| 231 | #define GLOBAL 284 |
| 232 | #define CONSTANT 285 |
| 233 | #define SECTION 286 |
| 234 | #define ALIAS 287 |
| 235 | #define VOLATILE 288 |
| 236 | #define THREAD_LOCAL 289 |
| 237 | #define TO 290 |
| 238 | #define DOTDOTDOT 291 |
| 239 | #define NULL_TOK 292 |
| 240 | #define UNDEF 293 |
| 241 | #define INTERNAL 294 |
| 242 | #define LINKONCE 295 |
| 243 | #define WEAK 296 |
| 244 | #define APPENDING 297 |
| 245 | #define DLLIMPORT 298 |
| 246 | #define DLLEXPORT 299 |
| 247 | #define EXTERN_WEAK 300 |
| 248 | #define OPAQUE 301 |
| 249 | #define EXTERNAL 302 |
| 250 | #define TARGET 303 |
| 251 | #define TRIPLE 304 |
| 252 | #define ALIGN 305 |
| 253 | #define DEPLIBS 306 |
| 254 | #define CALL 307 |
| 255 | #define TAIL 308 |
| 256 | #define ASM_TOK 309 |
| 257 | #define MODULE 310 |
| 258 | #define SIDEEFFECT 311 |
| 259 | #define CC_TOK 312 |
| 260 | #define CCC_TOK 313 |
| 261 | #define FASTCC_TOK 314 |
| 262 | #define COLDCC_TOK 315 |
| 263 | #define X86_STDCALLCC_TOK 316 |
| 264 | #define X86_FASTCALLCC_TOK 317 |
| 265 | #define DATALAYOUT 318 |
| 266 | #define RET 319 |
| 267 | #define BR 320 |
| 268 | #define SWITCH 321 |
| 269 | #define INVOKE 322 |
| 270 | #define UNWIND 323 |
| 271 | #define UNREACHABLE 324 |
| 272 | #define ADD 325 |
| 273 | #define SUB 326 |
| 274 | #define MUL 327 |
| 275 | #define UDIV 328 |
| 276 | #define SDIV 329 |
| 277 | #define FDIV 330 |
| 278 | #define UREM 331 |
| 279 | #define SREM 332 |
| 280 | #define FREM 333 |
| 281 | #define AND 334 |
| 282 | #define OR 335 |
| 283 | #define XOR 336 |
| 284 | #define SHL 337 |
| 285 | #define LSHR 338 |
| 286 | #define ASHR 339 |
| 287 | #define ICMP 340 |
| 288 | #define FCMP 341 |
| 289 | #define EQ 342 |
| 290 | #define NE 343 |
| 291 | #define SLT 344 |
| 292 | #define SGT 345 |
| 293 | #define SLE 346 |
| 294 | #define SGE 347 |
| 295 | #define ULT 348 |
| 296 | #define UGT 349 |
| 297 | #define ULE 350 |
| 298 | #define UGE 351 |
| 299 | #define OEQ 352 |
| 300 | #define ONE 353 |
| 301 | #define OLT 354 |
| 302 | #define OGT 355 |
| 303 | #define OLE 356 |
| 304 | #define OGE 357 |
| 305 | #define ORD 358 |
| 306 | #define UNO 359 |
| 307 | #define UEQ 360 |
| 308 | #define UNE 361 |
| 309 | #define MALLOC 362 |
| 310 | #define ALLOCA 363 |
| 311 | #define FREE 364 |
| 312 | #define LOAD 365 |
| 313 | #define STORE 366 |
| 314 | #define GETELEMENTPTR 367 |
| 315 | #define TRUNC 368 |
| 316 | #define ZEXT 369 |
| 317 | #define SEXT 370 |
| 318 | #define FPTRUNC 371 |
| 319 | #define FPEXT 372 |
| 320 | #define BITCAST 373 |
| 321 | #define UITOFP 374 |
| 322 | #define SITOFP 375 |
| 323 | #define FPTOUI 376 |
| 324 | #define FPTOSI 377 |
| 325 | #define INTTOPTR 378 |
| 326 | #define PTRTOINT 379 |
| 327 | #define PHI_TOK 380 |
| 328 | #define SELECT 381 |
| 329 | #define VAARG 382 |
| 330 | #define EXTRACTELEMENT 383 |
| 331 | #define INSERTELEMENT 384 |
| 332 | #define SHUFFLEVECTOR 385 |
| 333 | #define NORETURN 386 |
| 334 | #define INREG 387 |
| 335 | #define SRET 388 |
| 336 | #define NOUNWIND 389 |
| 337 | #define DEFAULT 390 |
| 338 | #define HIDDEN 391 |
| 339 | #define PROTECTED 392 |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | /* Copy the first part of user declarations. */ |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 345 | #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 346 | |
| 347 | #include "ParserInternals.h" |
| 348 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 349 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 350 | #include "llvm/Instructions.h" |
| 351 | #include "llvm/Module.h" |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 352 | #include "llvm/ValueSymbolTable.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 353 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 354 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 355 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 356 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 357 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 358 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 359 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 360 | #include <list> |
Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 361 | #include <map> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 362 | #include <utility> |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 363 | #ifndef NDEBUG |
| 364 | #define YYDEBUG 1 |
| 365 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 366 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 367 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 368 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 369 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 370 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 371 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 372 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 373 | // GenerateError are made from inside productions and they must simulate the |
| 374 | // previous exception behavior by exiting the production immediately. We have |
| 375 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 376 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 377 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 378 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 379 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 380 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 381 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 382 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 383 | int yylex(); // declaration" of xxx warnings. |
| 384 | int yyparse(); |
| 385 | |
| 386 | namespace llvm { |
| 387 | std::string CurFilename; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 388 | #if YYDEBUG |
| 389 | static cl::opt<bool> |
| 390 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), |
| 391 | cl::Hidden, cl::init(false)); |
| 392 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 393 | } |
| 394 | using namespace llvm; |
| 395 | |
| 396 | static Module *ParserResult; |
| 397 | |
| 398 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 399 | // relating to upreferences in the input stream. |
| 400 | // |
| 401 | //#define DEBUG_UPREFS 1 |
| 402 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 403 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 404 | #else |
| 405 | #define UR_OUT(X) |
| 406 | #endif |
| 407 | |
| 408 | #define YYERROR_VERBOSE 1 |
| 409 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 410 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 411 | |
| 412 | |
| 413 | // This contains info used when building the body of a function. It is |
| 414 | // destroyed when the function is completed. |
| 415 | // |
| 416 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 417 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 418 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 419 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 420 | |
| 421 | static struct PerModuleInfo { |
| 422 | Module *CurrentModule; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 423 | ValueList Values; // Module level numbered definitions |
| 424 | ValueList LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 425 | std::vector<PATypeHolder> Types; |
| 426 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 427 | |
| 428 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 429 | /// 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] | 430 | /// that we can resolve them later and print error messages as appropriate. |
| 431 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 432 | |
| 433 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 434 | // references to global values. Global values may be referenced before they |
| 435 | // are defined, and if so, the temporary object that they represent is held |
| 436 | // here. This is used for forward references of GlobalValues. |
| 437 | // |
| 438 | typedef std::map<std::pair<const PointerType *, |
| 439 | ValID>, GlobalValue*> GlobalRefsType; |
| 440 | GlobalRefsType GlobalRefs; |
| 441 | |
| 442 | void ModuleDone() { |
| 443 | // If we could not resolve some functions at function compilation time |
| 444 | // (calls to functions before they are defined), resolve them now... Types |
| 445 | // are resolved when the constant pool has been completely parsed. |
| 446 | // |
| 447 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 448 | if (TriggerError) |
| 449 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 450 | |
| 451 | // Check to make sure that all global value forward references have been |
| 452 | // resolved! |
| 453 | // |
| 454 | if (!GlobalRefs.empty()) { |
| 455 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 456 | |
| 457 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 458 | I != E; ++I) { |
| 459 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 460 | I->first.second.getName() + "\n"; |
| 461 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 462 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 463 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 464 | } |
| 465 | |
| 466 | Values.clear(); // Clear out function local definitions |
| 467 | Types.clear(); |
| 468 | CurrentModule = 0; |
| 469 | } |
| 470 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 471 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 472 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 473 | // If not, just return null. |
| 474 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 475 | // Check to see if there is a forward reference to this global variable... |
| 476 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 477 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 478 | GlobalValue *Ret = 0; |
| 479 | if (I != GlobalRefs.end()) { |
| 480 | Ret = I->second; |
| 481 | GlobalRefs.erase(I); |
| 482 | } |
| 483 | return Ret; |
| 484 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 485 | |
| 486 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 487 | // If it isn't abstract, its resolved |
| 488 | const Type* Ty = PATy->get(); |
| 489 | if (!Ty->isAbstract()) |
| 490 | return false; |
| 491 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 492 | // we don't need to traverse that leg of the type. |
| 493 | std::vector<const Type*> WorkList, SeenList; |
| 494 | WorkList.push_back(Ty); |
| 495 | while (!WorkList.empty()) { |
| 496 | const Type* Ty = WorkList.back(); |
| 497 | SeenList.push_back(Ty); |
| 498 | WorkList.pop_back(); |
| 499 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 500 | // Check to see if this is an unresolved type |
| 501 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 502 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 503 | for ( ; I != E; ++I) { |
| 504 | if (I->second.get() == OpTy) |
| 505 | return true; |
| 506 | } |
| 507 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 508 | const Type* TheTy = SeqTy->getElementType(); |
| 509 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 510 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 511 | E = SeenList.end(); |
| 512 | for ( ; I != E; ++I) |
| 513 | if (*I == TheTy) |
| 514 | break; |
| 515 | if (I == E) |
| 516 | WorkList.push_back(TheTy); |
| 517 | } |
| 518 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 519 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 520 | const Type* TheTy = StrTy->getElementType(i); |
| 521 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 522 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 523 | E = SeenList.end(); |
| 524 | for ( ; I != E; ++I) |
| 525 | if (*I == TheTy) |
| 526 | break; |
| 527 | if (I == E) |
| 528 | WorkList.push_back(TheTy); |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | } |
| 533 | return false; |
| 534 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 535 | } CurModule; |
| 536 | |
| 537 | static struct PerFunctionInfo { |
| 538 | Function *CurrentFunction; // Pointer to current function being created |
| 539 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 540 | ValueList Values; // Keep track of #'d definitions |
| 541 | unsigned NextValNum; |
| 542 | ValueList LateResolveValues; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 543 | bool isDeclare; // Is this function a forward declararation? |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 544 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 545 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 546 | |
| 547 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 548 | /// track of them here. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 549 | std::map<ValID, BasicBlock*> BBForwardRefs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 550 | |
| 551 | inline PerFunctionInfo() { |
| 552 | CurrentFunction = 0; |
| 553 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 554 | Linkage = GlobalValue::ExternalLinkage; |
| 555 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | inline void FunctionStart(Function *M) { |
| 559 | CurrentFunction = M; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 560 | NextValNum = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | void FunctionDone() { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 564 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 565 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 566 | GenerateError("Undefined reference to label " + |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 567 | BBForwardRefs.begin()->second->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 568 | return; |
| 569 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 570 | |
| 571 | // Resolve all forward references now. |
| 572 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 573 | |
| 574 | Values.clear(); // Clear out function local definitions |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 575 | BBForwardRefs.clear(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 576 | CurrentFunction = 0; |
| 577 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 578 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 579 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 580 | } |
| 581 | } CurFun; // Info for the current function... |
| 582 | |
| 583 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 584 | |
| 585 | |
| 586 | //===----------------------------------------------------------------------===// |
| 587 | // Code to handle definitions of all the types |
| 588 | //===----------------------------------------------------------------------===// |
| 589 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 590 | static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
| 591 | // Things that have names or are void typed don't get slot numbers |
| 592 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
| 593 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 594 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 595 | // In the case of function values, we have to allow for the forward reference |
| 596 | // of basic blocks, which are included in the numbering. Consequently, we keep |
| 597 | // track of the next insertion location with NextValNum. When a BB gets |
| 598 | // inserted, it could change the size of the CurFun.Values vector. |
| 599 | if (&ValueTab == &CurFun.Values) { |
| 600 | if (ValueTab.size() <= CurFun.NextValNum) |
| 601 | ValueTab.resize(CurFun.NextValNum+1); |
| 602 | ValueTab[CurFun.NextValNum++] = V; |
| 603 | return; |
| 604 | } |
| 605 | // For all other lists, its okay to just tack it on the back of the vector. |
| 606 | ValueTab.push_back(V); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 610 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 611 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 612 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 613 | if (D.Num < CurModule.Types.size()) |
| 614 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 615 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 616 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 617 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 618 | D.destroy(); // Free old strdup'd memory... |
| 619 | return N; |
| 620 | } |
| 621 | break; |
| 622 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 623 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 624 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | // If we reached here, we referenced either a symbol that we don't know about |
| 628 | // or an id number that hasn't been read yet. We may be referencing something |
| 629 | // forward, so just create an entry to be resolved later and get to it... |
| 630 | // |
| 631 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 632 | |
| 633 | |
| 634 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 635 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 636 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 637 | return 0; |
| 638 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 639 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 640 | return 0; |
| 641 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 642 | } |
| 643 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 644 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 645 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 646 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 647 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 648 | Type *Typ = OpaqueType::get(); |
| 649 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 650 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 651 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 652 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 653 | // getExistingVal - Look up the value specified by the provided type and |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 654 | // the provided ValID. If the value exists and has already been defined, return |
| 655 | // it. Otherwise return null. |
| 656 | // |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 657 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 658 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 659 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 660 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 661 | return 0; |
| 662 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 663 | |
| 664 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 665 | case ValID::LocalID: { // Is it a numbered definition? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 666 | // Check that the number is within bounds. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 667 | if (D.Num >= CurFun.Values.size()) |
| 668 | return 0; |
| 669 | Value *Result = CurFun.Values[D.Num]; |
| 670 | if (Ty != Result->getType()) { |
| 671 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
| 672 | Result->getType()->getDescription() + "' does not match " |
| 673 | "expected type, '" + Ty->getDescription() + "'"); |
| 674 | return 0; |
| 675 | } |
| 676 | return Result; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 677 | } |
| 678 | case ValID::GlobalID: { // Is it a numbered definition? |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 679 | if (D.Num >= CurModule.Values.size()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 680 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 681 | Value *Result = CurModule.Values[D.Num]; |
| 682 | if (Ty != Result->getType()) { |
| 683 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
| 684 | Result->getType()->getDescription() + "' does not match " |
| 685 | "expected type, '" + Ty->getDescription() + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 686 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 687 | } |
| 688 | return Result; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 689 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 690 | |
| 691 | case ValID::LocalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 692 | if (!inFunctionScope()) |
| 693 | return 0; |
| 694 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 695 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 696 | if (N == 0) |
| 697 | return 0; |
| 698 | if (N->getType() != Ty) |
| 699 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 700 | |
| 701 | D.destroy(); // Free old strdup'd memory... |
| 702 | return N; |
| 703 | } |
| 704 | case ValID::GlobalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 705 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 706 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 707 | if (N == 0) |
| 708 | return 0; |
| 709 | if (N->getType() != Ty) |
| 710 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 711 | |
| 712 | D.destroy(); // Free old strdup'd memory... |
| 713 | return N; |
| 714 | } |
| 715 | |
| 716 | // Check to make sure that "Ty" is an integral type, and that our |
| 717 | // value will fit into the specified type... |
| 718 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 719 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 720 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 721 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 722 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 723 | return 0; |
| 724 | } |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 725 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 726 | |
| 727 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 728 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 729 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 730 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 731 | "' is invalid or out of range"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 732 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 733 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 734 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 735 | } |
| 736 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 737 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 738 | } |
| 739 | |
| 740 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 741 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 742 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 743 | return 0; |
| 744 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 745 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 746 | |
| 747 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 748 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 749 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 750 | return 0; |
| 751 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 752 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 753 | |
| 754 | case ValID::ConstUndefVal: // Is it an undef value? |
| 755 | return UndefValue::get(Ty); |
| 756 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 757 | case ValID::ConstZeroVal: // Is it a zero value? |
| 758 | return Constant::getNullValue(Ty); |
| 759 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 760 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 761 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 762 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 763 | return 0; |
| 764 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 765 | return D.ConstantValue; |
| 766 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 767 | case ValID::InlineAsmVal: { // Inline asm expression |
| 768 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 769 | const FunctionType *FTy = |
| 770 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 771 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 772 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 773 | return 0; |
| 774 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 775 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 776 | D.IAD->HasSideEffects); |
| 777 | D.destroy(); // Free InlineAsmDescriptor. |
| 778 | return IA; |
| 779 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 780 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 781 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 782 | return 0; |
| 783 | } // End of switch |
| 784 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 785 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 786 | return 0; |
| 787 | } |
| 788 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 789 | // getVal - This function is identical to getExistingVal, except that if a |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 790 | // value is not already defined, it "improvises" by creating a placeholder var |
| 791 | // that looks and acts just like the requested variable. When the value is |
| 792 | // defined later, all uses of the placeholder variable are replaced with the |
| 793 | // real thing. |
| 794 | // |
| 795 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 796 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 797 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 798 | return 0; |
| 799 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 800 | |
| 801 | // See if the value has already been defined. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 802 | Value *V = getExistingVal(Ty, ID); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 803 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 804 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 805 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 806 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 807 | GenerateError("Invalid use of a composite type"); |
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 | // If we reached here, we referenced either a symbol that we don't know about |
| 812 | // or an id number that hasn't been read yet. We may be referencing something |
| 813 | // forward, so just create an entry to be resolved later and get to it... |
| 814 | // |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 815 | switch (ID.Type) { |
| 816 | case ValID::GlobalName: |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 817 | case ValID::GlobalID: { |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 818 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 819 | if (!PTy) { |
| 820 | GenerateError("Invalid type for reference to global" ); |
| 821 | return 0; |
| 822 | } |
| 823 | const Type* ElTy = PTy->getElementType(); |
| 824 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
| 825 | V = new Function(FTy, GlobalValue::ExternalLinkage); |
| 826 | else |
| 827 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage); |
| 828 | break; |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 829 | } |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 830 | default: |
| 831 | V = new Argument(Ty); |
| 832 | } |
| 833 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 834 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 835 | // to recycle these things?? |
| 836 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 837 | llvmAsmlineno))); |
| 838 | |
| 839 | if (inFunctionScope()) |
| 840 | InsertValue(V, CurFun.LateResolveValues); |
| 841 | else |
| 842 | InsertValue(V, CurModule.LateResolveValues); |
| 843 | return V; |
| 844 | } |
| 845 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 846 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 847 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
| 848 | static BasicBlock *defineBBVal(const ValID &ID) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 849 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 850 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 851 | BasicBlock *BB = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 852 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 853 | // First, see if this was forward referenced |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 854 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 855 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 856 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 857 | BB = BBI->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 858 | // The forward declaration could have been inserted anywhere in the |
| 859 | // function: insert it into the correct place now. |
| 860 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 861 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 862 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 863 | // We're about to erase the entry, save the key so we can clean it up. |
| 864 | ValID Tmp = BBI->first; |
| 865 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 866 | // Erase the forward ref from the map as its no longer "forward" |
| 867 | CurFun.BBForwardRefs.erase(ID); |
| 868 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 869 | // The key has been removed from the map but so we don't want to leave |
| 870 | // strdup'd memory around so destroy it too. |
| 871 | Tmp.destroy(); |
| 872 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 873 | // If its a numbered definition, bump the number and set the BB value. |
| 874 | if (ID.Type == ValID::LocalID) { |
| 875 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 876 | InsertValue(BB); |
| 877 | } |
| 878 | |
| 879 | ID.destroy(); |
| 880 | return BB; |
| 881 | } |
| 882 | |
| 883 | // We haven't seen this BB before and its first mention is a definition. |
| 884 | // Just create it and return it. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 885 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 886 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 887 | if (ID.Type == ValID::LocalID) { |
| 888 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 889 | InsertValue(BB); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 890 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 891 | |
| 892 | ID.destroy(); // Free strdup'd memory |
| 893 | return BB; |
| 894 | } |
| 895 | |
| 896 | /// getBBVal - get an existing BB value or create a forward reference for it. |
| 897 | /// |
| 898 | static BasicBlock *getBBVal(const ValID &ID) { |
| 899 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 900 | |
| 901 | BasicBlock *BB = 0; |
| 902 | |
| 903 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 904 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 905 | BB = BBI->second; |
| 906 | } if (ID.Type == ValID::LocalName) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 907 | std::string Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 908 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
| 909 | if (N) |
| 910 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 911 | BB = cast<BasicBlock>(N); |
| 912 | else |
| 913 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 914 | N->getType()->getDescription() + "'"); |
| 915 | } else if (ID.Type == ValID::LocalID) { |
| 916 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 917 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 918 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 919 | else |
| 920 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 921 | "' is actually of type '"+ |
| 922 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 923 | } |
| 924 | } else { |
| 925 | GenerateError("Illegal label reference " + ID.getName()); |
| 926 | return 0; |
| 927 | } |
| 928 | |
| 929 | // If its already been defined, return it now. |
| 930 | if (BB) { |
| 931 | ID.destroy(); // Free strdup'd memory. |
| 932 | return BB; |
| 933 | } |
| 934 | |
| 935 | // Otherwise, this block has not been seen before, create it. |
| 936 | std::string Name; |
| 937 | if (ID.Type == ValID::LocalName) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 938 | Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 939 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 940 | |
| 941 | // Insert it in the forward refs map. |
| 942 | CurFun.BBForwardRefs[ID] = BB; |
| 943 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 944 | return BB; |
| 945 | } |
| 946 | |
| 947 | |
| 948 | //===----------------------------------------------------------------------===// |
| 949 | // Code to handle forward references in instructions |
| 950 | //===----------------------------------------------------------------------===// |
| 951 | // |
| 952 | // This code handles the late binding needed with statements that reference |
| 953 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 954 | // a loop body. |
| 955 | // |
| 956 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 957 | // and back patchs after we are done. |
| 958 | // |
| 959 | |
| 960 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 961 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 962 | // defs now... |
| 963 | // |
| 964 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 965 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 966 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 967 | while (!LateResolvers.empty()) { |
| 968 | Value *V = LateResolvers.back(); |
| 969 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 970 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 971 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 972 | CurModule.PlaceHolderInfo.find(V); |
| 973 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 974 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 975 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 976 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 977 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 978 | if (TriggerError) |
| 979 | return; |
| 980 | if (TheRealValue) { |
| 981 | V->replaceAllUsesWith(TheRealValue); |
| 982 | delete V; |
| 983 | CurModule.PlaceHolderInfo.erase(PHI); |
| 984 | } else if (FutureLateResolvers) { |
| 985 | // Functions have their unresolved items forwarded to the module late |
| 986 | // resolver table |
| 987 | InsertValue(V, *FutureLateResolvers); |
| 988 | } else { |
| 989 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 990 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 991 | "' of type '" + V->getType()->getDescription() + "'", |
| 992 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 993 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 994 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 995 | GenerateError("Reference to an invalid definition: #" + |
| 996 | itostr(DID.Num) + " of type '" + |
| 997 | V->getType()->getDescription() + "'", |
| 998 | PHI->second.second); |
| 999 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1000 | } |
| 1001 | } |
| 1002 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1003 | LateResolvers.clear(); |
| 1004 | } |
| 1005 | |
| 1006 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 1007 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 1008 | // refering to the number can be resolved. Do this now. |
| 1009 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1010 | static void ResolveTypeTo(std::string *Name, const Type *ToTy) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1011 | ValID D; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1012 | if (Name) |
| 1013 | D = ValID::createLocalName(*Name); |
| 1014 | else |
| 1015 | D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1016 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1017 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1018 | CurModule.LateResolveTypes.find(D); |
| 1019 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1020 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1021 | CurModule.LateResolveTypes.erase(I); |
| 1022 | } |
| 1023 | } |
| 1024 | |
| 1025 | // setValueName - Set the specified value to the name given. The name may be |
| 1026 | // null potentially, in which case this is a noop. The string passed in is |
| 1027 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1028 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1029 | static void setValueName(Value *V, std::string *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1030 | if (!NameStr) return; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1031 | std::string Name(*NameStr); // Copy string |
| 1032 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1033 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1034 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1035 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1036 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1037 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1038 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1039 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1040 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1041 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1042 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1043 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1044 | return; |
| 1045 | } |
| 1046 | |
| 1047 | // Set the name. |
| 1048 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1049 | } |
| 1050 | |
| 1051 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1052 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1053 | static GlobalVariable * |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1054 | ParseGlobalVariable(std::string *NameStr, |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1055 | GlobalValue::LinkageTypes Linkage, |
| 1056 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1057 | bool isConstantGlobal, const Type *Ty, |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1058 | Constant *Initializer, bool IsThreadLocal) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1059 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1060 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1061 | return 0; |
| 1062 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1063 | |
| 1064 | const PointerType *PTy = PointerType::get(Ty); |
| 1065 | |
| 1066 | std::string Name; |
| 1067 | if (NameStr) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1068 | Name = *NameStr; // Copy string |
| 1069 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1070 | } |
| 1071 | |
| 1072 | // See if this global value was forward referenced. If so, recycle the |
| 1073 | // object. |
| 1074 | ValID ID; |
| 1075 | if (!Name.empty()) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1076 | ID = ValID::createGlobalName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1077 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1078 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1079 | } |
| 1080 | |
| 1081 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1082 | // Move the global to the end of the list, from whereever it was |
| 1083 | // previously inserted. |
| 1084 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1085 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1086 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1087 | GV->setInitializer(Initializer); |
| 1088 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1089 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1090 | GV->setConstant(isConstantGlobal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1091 | GV->setThreadLocal(IsThreadLocal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1092 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1093 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1094 | } |
| 1095 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1096 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1097 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1098 | // if the global we're parsing has an initializer (is a definition) and |
| 1099 | // has external linkage. |
| 1100 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1101 | // If there is already a global with external linkage with this name |
| 1102 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1103 | // If we allow this GVar to get created, it will be renamed in the |
| 1104 | // symbol table because it conflicts with an existing GVar. We can't |
| 1105 | // allow redefinition of GVars whose linking indicates that their name |
| 1106 | // must stay the same. Issue the error. |
| 1107 | GenerateError("Redefinition of global variable named '" + Name + |
| 1108 | "' of type '" + Ty->getDescription() + "'"); |
| 1109 | return 0; |
| 1110 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1111 | } |
| 1112 | |
| 1113 | // Otherwise there is no existing GV to use, create one now. |
| 1114 | GlobalVariable *GV = |
| 1115 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1116 | CurModule.CurrentModule, IsThreadLocal); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1117 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1118 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1119 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1120 | } |
| 1121 | |
| 1122 | // setTypeName - Set the specified type to the name given. The name may be |
| 1123 | // null potentially, in which case this is a noop. The string passed in is |
| 1124 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1125 | // |
| 1126 | // This function returns true if the type has already been defined, but is |
| 1127 | // allowed to be redefined in the specified context. If the name is a new name |
| 1128 | // for the type plane, it is inserted and false is returned. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1129 | static bool setTypeName(const Type *T, std::string *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1130 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1131 | if (NameStr == 0) return false; |
| 1132 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1133 | std::string Name(*NameStr); // Copy string |
| 1134 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1135 | |
| 1136 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1137 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1138 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1139 | return false; |
| 1140 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1141 | |
| 1142 | // Set the type name, checking for conflicts as we do so. |
| 1143 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1144 | |
| 1145 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1146 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1147 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1148 | |
| 1149 | // There is only one case where this is allowed: when we are refining an |
| 1150 | // opaque type. In this case, Existing will be an opaque type. |
| 1151 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1152 | // We ARE replacing an opaque type! |
| 1153 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1154 | return true; |
| 1155 | } |
| 1156 | |
| 1157 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1158 | // the redefinition is identical to the original. This will be so if |
| 1159 | // Existing and T point to the same Type object. In this one case we |
| 1160 | // allow the equivalent redefinition. |
| 1161 | if (Existing == T) return true; // Yes, it's equal. |
| 1162 | |
| 1163 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1164 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1165 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1166 | } |
| 1167 | |
| 1168 | return false; |
| 1169 | } |
| 1170 | |
| 1171 | //===----------------------------------------------------------------------===// |
| 1172 | // Code for handling upreferences in type names... |
| 1173 | // |
| 1174 | |
| 1175 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1176 | // |
| 1177 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1178 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1179 | E) != Ty->subtype_end(); |
| 1180 | } |
| 1181 | |
| 1182 | namespace { |
| 1183 | struct UpRefRecord { |
| 1184 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1185 | // this type is resolved. |
| 1186 | unsigned NestingLevel; |
| 1187 | |
| 1188 | // LastContainedTy - This is the type at the current binding level for the |
| 1189 | // type. Every time we reduce the nesting level, this gets updated. |
| 1190 | const Type *LastContainedTy; |
| 1191 | |
| 1192 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1193 | // represented with. |
| 1194 | OpaqueType *UpRefTy; |
| 1195 | |
| 1196 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1197 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1198 | }; |
| 1199 | } |
| 1200 | |
| 1201 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1202 | static std::vector<UpRefRecord> UpRefs; |
| 1203 | |
| 1204 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1205 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1206 | /// currently active types. For each type, if the up reference is contained in |
| 1207 | /// the newly completed type, we decrement the level count. When the level |
| 1208 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1209 | /// thus we can complete the cycle. |
| 1210 | /// |
| 1211 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1212 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1213 | // nothing to resolve here. |
| 1214 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1215 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1216 | PATypeHolder Ty(ty); |
| 1217 | UR_OUT("Type '" << Ty->getDescription() << |
| 1218 | "' newly formed. Resolving upreferences.\n" << |
| 1219 | UpRefs.size() << " upreferences active!\n"); |
| 1220 | |
| 1221 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1222 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1223 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1224 | // this variable. |
| 1225 | OpaqueType *TypeToResolve = 0; |
| 1226 | |
| 1227 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1228 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1229 | << UpRefs[i].second->getDescription() << ") = " |
| 1230 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1231 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1232 | // Decrement level of upreference |
| 1233 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1234 | UpRefs[i].LastContainedTy = Ty; |
| 1235 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1236 | if (Level == 0) { // Upreference should be resolved! |
| 1237 | if (!TypeToResolve) { |
| 1238 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1239 | } else { |
| 1240 | UR_OUT(" * Resolving upreference for " |
| 1241 | << UpRefs[i].second->getDescription() << "\n"; |
| 1242 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1243 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1244 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1245 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1246 | } |
| 1247 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1248 | --i; // Do not skip the next element... |
| 1249 | } |
| 1250 | } |
| 1251 | } |
| 1252 | |
| 1253 | if (TypeToResolve) { |
| 1254 | UR_OUT(" * Resolving upreference for " |
| 1255 | << UpRefs[i].second->getDescription() << "\n"; |
| 1256 | std::string OldName = TypeToResolve->getDescription()); |
| 1257 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1258 | } |
| 1259 | |
| 1260 | return Ty; |
| 1261 | } |
| 1262 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1263 | //===----------------------------------------------------------------------===// |
| 1264 | // RunVMAsmParser - Define an interface to this parser |
| 1265 | //===----------------------------------------------------------------------===// |
| 1266 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1267 | static Module* RunParser(Module * M); |
| 1268 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1269 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1270 | set_scan_file(F); |
| 1271 | |
| 1272 | CurFilename = Filename; |
| 1273 | return RunParser(new Module(CurFilename)); |
| 1274 | } |
| 1275 | |
| 1276 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1277 | set_scan_string(AsmString); |
| 1278 | |
| 1279 | CurFilename = "from_memory"; |
| 1280 | if (M == NULL) { |
| 1281 | return RunParser(new Module (CurFilename)); |
| 1282 | } else { |
| 1283 | return RunParser(M); |
| 1284 | } |
| 1285 | } |
| 1286 | |
| 1287 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1288 | |
| 1289 | /* Enabling traces. */ |
| 1290 | #ifndef YYDEBUG |
| 1291 | # define YYDEBUG 0 |
| 1292 | #endif |
| 1293 | |
| 1294 | /* Enabling verbose error messages. */ |
| 1295 | #ifdef YYERROR_VERBOSE |
| 1296 | # undef YYERROR_VERBOSE |
| 1297 | # define YYERROR_VERBOSE 1 |
| 1298 | #else |
| 1299 | # define YYERROR_VERBOSE 0 |
| 1300 | #endif |
| 1301 | |
| 1302 | /* Enabling the token table. */ |
| 1303 | #ifndef YYTOKEN_TABLE |
| 1304 | # define YYTOKEN_TABLE 0 |
| 1305 | #endif |
| 1306 | |
| 1307 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1308 | #line 957 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1309 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1310 | llvm::Module *ModuleVal; |
| 1311 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1312 | llvm::BasicBlock *BasicBlockVal; |
| 1313 | llvm::TerminatorInst *TermInstVal; |
| 1314 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1315 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1316 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1317 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1318 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1319 | llvm::PATypeHolder *TypeVal; |
| 1320 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1321 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1322 | llvm::ArgListType *ArgList; |
| 1323 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1324 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1325 | llvm::ValueRefList *ValueRefList; |
| 1326 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1327 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1328 | std::list<std::pair<llvm::Value*, |
| 1329 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1330 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1331 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1332 | |
| 1333 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1334 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 1335 | uint16_t ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1336 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1337 | int64_t SInt64Val; |
| 1338 | uint64_t UInt64Val; |
| 1339 | int SIntVal; |
| 1340 | unsigned UIntVal; |
| 1341 | double FPVal; |
| 1342 | bool BoolVal; |
| 1343 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1344 | std::string *StrVal; // This memory must be deleted |
| 1345 | llvm::ValID ValIDVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1346 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1347 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1348 | llvm::Instruction::TermOps TermOpVal; |
| 1349 | llvm::Instruction::MemoryOps MemOpVal; |
| 1350 | llvm::Instruction::CastOps CastOpVal; |
| 1351 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1352 | llvm::ICmpInst::Predicate IPredicate; |
| 1353 | llvm::FCmpInst::Predicate FPredicate; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 1354 | } YYSTYPE; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1355 | /* Line 196 of yacc.c. */ |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1356 | #line 1357 "llvmAsmParser.tab.c" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1357 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1358 | # define YYSTYPE_IS_DECLARED 1 |
| 1359 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1360 | #endif |
| 1361 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1362 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1363 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1364 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1365 | |
| 1366 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1367 | /* Line 219 of yacc.c. */ |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1368 | #line 1369 "llvmAsmParser.tab.c" |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 1369 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1370 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1371 | # define YYSIZE_T __SIZE_TYPE__ |
| 1372 | #endif |
| 1373 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1374 | # define YYSIZE_T size_t |
| 1375 | #endif |
| 1376 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1377 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1378 | # define YYSIZE_T size_t |
| 1379 | #endif |
| 1380 | #if ! defined (YYSIZE_T) |
| 1381 | # define YYSIZE_T unsigned int |
| 1382 | #endif |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 1383 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1384 | #ifndef YY_ |
| 1385 | # if YYENABLE_NLS |
| 1386 | # if ENABLE_NLS |
| 1387 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1388 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1389 | # endif |
| 1390 | # endif |
| 1391 | # ifndef YY_ |
| 1392 | # define YY_(msgid) msgid |
| 1393 | # endif |
| 1394 | #endif |
| 1395 | |
| 1396 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1397 | |
| 1398 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1399 | |
| 1400 | # ifdef YYSTACK_USE_ALLOCA |
| 1401 | # if YYSTACK_USE_ALLOCA |
| 1402 | # ifdef __GNUC__ |
| 1403 | # define YYSTACK_ALLOC __builtin_alloca |
| 1404 | # else |
| 1405 | # define YYSTACK_ALLOC alloca |
| 1406 | # if defined (__STDC__) || defined (__cplusplus) |
| 1407 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1408 | # define YYINCLUDED_STDLIB_H |
| 1409 | # endif |
| 1410 | # endif |
| 1411 | # endif |
| 1412 | # endif |
| 1413 | |
| 1414 | # ifdef YYSTACK_ALLOC |
| 1415 | /* Pacify GCC's `empty if-body' warning. */ |
| 1416 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1417 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1418 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1419 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1420 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1421 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1422 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1423 | # endif |
| 1424 | # else |
| 1425 | # define YYSTACK_ALLOC YYMALLOC |
| 1426 | # define YYSTACK_FREE YYFREE |
| 1427 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1428 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1429 | # endif |
| 1430 | # ifdef __cplusplus |
| 1431 | extern "C" { |
| 1432 | # endif |
| 1433 | # ifndef YYMALLOC |
| 1434 | # define YYMALLOC malloc |
| 1435 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1436 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1437 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1438 | # endif |
| 1439 | # endif |
| 1440 | # ifndef YYFREE |
| 1441 | # define YYFREE free |
| 1442 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1443 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1444 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1445 | # endif |
| 1446 | # endif |
| 1447 | # ifdef __cplusplus |
| 1448 | } |
| 1449 | # endif |
| 1450 | # endif |
| 1451 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1452 | |
| 1453 | |
| 1454 | #if (! defined (yyoverflow) \ |
| 1455 | && (! defined (__cplusplus) \ |
| 1456 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1457 | |
| 1458 | /* A type that is properly aligned for any stack member. */ |
| 1459 | union yyalloc |
| 1460 | { |
| 1461 | short int yyss; |
| 1462 | YYSTYPE yyvs; |
| 1463 | }; |
| 1464 | |
| 1465 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1466 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1467 | |
| 1468 | /* The size of an array large to enough to hold all stacks, each with |
| 1469 | N elements. */ |
| 1470 | # define YYSTACK_BYTES(N) \ |
| 1471 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1472 | + YYSTACK_GAP_MAXIMUM) |
| 1473 | |
| 1474 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1475 | not overlap. */ |
| 1476 | # ifndef YYCOPY |
| 1477 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1478 | # define YYCOPY(To, From, Count) \ |
| 1479 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1480 | # else |
| 1481 | # define YYCOPY(To, From, Count) \ |
| 1482 | do \ |
| 1483 | { \ |
| 1484 | YYSIZE_T yyi; \ |
| 1485 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1486 | (To)[yyi] = (From)[yyi]; \ |
| 1487 | } \ |
| 1488 | while (0) |
| 1489 | # endif |
| 1490 | # endif |
| 1491 | |
| 1492 | /* Relocate STACK from its old location to the new one. The |
| 1493 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1494 | elements in the stack, and YYPTR gives the new location of the |
| 1495 | stack. Advance YYPTR to a properly aligned location for the next |
| 1496 | stack. */ |
| 1497 | # define YYSTACK_RELOCATE(Stack) \ |
| 1498 | do \ |
| 1499 | { \ |
| 1500 | YYSIZE_T yynewbytes; \ |
| 1501 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1502 | Stack = &yyptr->Stack; \ |
| 1503 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1504 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1505 | } \ |
| 1506 | while (0) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 1507 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1508 | #endif |
| 1509 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1510 | #if defined (__STDC__) || defined (__cplusplus) |
| 1511 | typedef signed char yysigned_char; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1512 | #else |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1513 | typedef short int yysigned_char; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1514 | #endif |
| 1515 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1516 | /* YYFINAL -- State number of the termination state. */ |
| 1517 | #define YYFINAL 43 |
| 1518 | /* YYLAST -- Last index in YYTABLE. */ |
| 1519 | #define YYLAST 1610 |
| 1520 | |
| 1521 | /* YYNTOKENS -- Number of terminals. */ |
| 1522 | #define YYNTOKENS 152 |
| 1523 | /* YYNNTS -- Number of nonterminals. */ |
| 1524 | #define YYNNTS 82 |
| 1525 | /* YYNRULES -- Number of rules. */ |
| 1526 | #define YYNRULES 298 |
| 1527 | /* YYNRULES -- Number of states. */ |
| 1528 | #define YYNSTATES 582 |
| 1529 | |
| 1530 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1531 | #define YYUNDEFTOK 2 |
| 1532 | #define YYMAXUTOK 392 |
| 1533 | |
| 1534 | #define YYTRANSLATE(YYX) \ |
| 1535 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1536 | |
| 1537 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1538 | static const unsigned char yytranslate[] = |
| 1539 | { |
| 1540 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1541 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1542 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1543 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1544 | 142, 143, 140, 2, 139, 2, 2, 2, 2, 2, |
| 1545 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1546 | 147, 138, 148, 2, 2, 2, 2, 2, 2, 2, |
| 1547 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1548 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1549 | 2, 144, 141, 146, 2, 2, 2, 2, 2, 151, |
| 1550 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1551 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1552 | 145, 2, 2, 149, 2, 150, 2, 2, 2, 2, |
| 1553 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1554 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1555 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1556 | 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1560 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1561 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1562 | 2, 2, 2, 2, 2, 2, 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, 1, 2, 3, 4, |
| 1566 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1567 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1568 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1569 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1570 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1571 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1572 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1573 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1574 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1575 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1576 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1577 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1578 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1579 | 135, 136, 137 |
| 1580 | }; |
| 1581 | |
| 1582 | #if YYDEBUG |
| 1583 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1584 | YYRHS. */ |
| 1585 | static const unsigned short int yyprhs[] = |
| 1586 | { |
| 1587 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1588 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1589 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1590 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1591 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1592 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1593 | 119, 121, 123, 124, 127, 128, 130, 132, 134, 135, |
| 1594 | 138, 140, 142, 144, 146, 148, 150, 152, 154, 155, |
| 1595 | 157, 159, 161, 162, 164, 166, 167, 169, 171, 173, |
| 1596 | 175, 176, 178, 180, 181, 183, 185, 187, 189, 191, |
| 1597 | 194, 196, 198, 200, 202, 203, 206, 208, 210, 212, |
| 1598 | 213, 216, 217, 220, 221, 225, 228, 229, 231, 232, |
| 1599 | 236, 238, 241, 243, 245, 247, 249, 251, 253, 256, |
| 1600 | 258, 261, 267, 273, 279, 285, 289, 292, 298, 303, |
| 1601 | 306, 308, 310, 312, 316, 318, 322, 324, 325, 327, |
| 1602 | 331, 336, 340, 344, 349, 354, 358, 365, 371, 374, |
| 1603 | 377, 380, 383, 386, 389, 392, 395, 398, 401, 404, |
| 1604 | 407, 414, 420, 429, 436, 443, 451, 459, 466, 475, |
| 1605 | 484, 488, 490, 492, 494, 496, 497, 500, 507, 509, |
| 1606 | 510, 512, 515, 516, 520, 521, 525, 529, 533, 537, |
| 1607 | 538, 546, 547, 556, 557, 566, 572, 575, 579, 581, |
| 1608 | 585, 589, 593, 597, 599, 600, 606, 610, 612, 616, |
| 1609 | 618, 619, 629, 631, 633, 638, 640, 642, 645, 649, |
| 1610 | 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, |
| 1611 | 672, 674, 680, 682, 684, 686, 688, 690, 692, 695, |
| 1612 | 698, 701, 705, 708, 709, 711, 714, 717, 721, 731, |
| 1613 | 741, 750, 765, 767, 769, 776, 782, 785, 792, 800, |
| 1614 | 804, 810, 811, 812, 816, 819, 821, 827, 833, 840, |
| 1615 | 847, 852, 859, 864, 869, 876, 883, 886, 895, 897, |
| 1616 | 899, 900, 904, 911, 915, 922, 925, 931, 939 |
| 1617 | }; |
| 1618 | |
| 1619 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1620 | static const short int yyrhs[] = |
| 1621 | { |
| 1622 | 196, 0, -1, 70, -1, 71, -1, 72, -1, 73, |
| 1623 | -1, 74, -1, 75, -1, 76, -1, 77, -1, 78, |
| 1624 | -1, 82, -1, 83, -1, 84, -1, 79, -1, 80, |
| 1625 | -1, 81, -1, 113, -1, 114, -1, 115, -1, 116, |
| 1626 | -1, 117, -1, 118, -1, 119, -1, 120, -1, 121, |
| 1627 | -1, 122, -1, 123, -1, 124, -1, 87, -1, 88, |
| 1628 | -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, |
| 1629 | -1, 94, -1, 95, -1, 96, -1, 97, -1, 98, |
| 1630 | -1, 99, -1, 100, -1, 101, -1, 102, -1, 103, |
| 1631 | -1, 104, -1, 105, -1, 106, -1, 93, -1, 94, |
| 1632 | -1, 95, -1, 96, -1, 23, -1, 24, -1, 11, |
| 1633 | -1, 12, -1, 13, -1, 16, -1, 19, -1, 21, |
| 1634 | -1, 160, -1, -1, 160, 138, -1, -1, 17, -1, |
| 1635 | 20, -1, 165, -1, -1, 163, 138, -1, 39, -1, |
| 1636 | 41, -1, 40, -1, 42, -1, 44, -1, 43, -1, |
| 1637 | 45, -1, 47, -1, -1, 135, -1, 136, -1, 137, |
| 1638 | -1, -1, 43, -1, 45, -1, -1, 39, -1, 40, |
| 1639 | -1, 41, -1, 44, -1, -1, 41, -1, 39, -1, |
| 1640 | -1, 58, -1, 59, -1, 60, -1, 61, -1, 62, |
| 1641 | -1, 57, 4, -1, 114, -1, 115, -1, 132, -1, |
| 1642 | 133, -1, -1, 174, 173, -1, 131, -1, 134, -1, |
| 1643 | 173, -1, -1, 176, 175, -1, -1, 50, 4, -1, |
| 1644 | -1, 139, 50, 4, -1, 31, 19, -1, -1, 179, |
| 1645 | -1, -1, 139, 182, 181, -1, 179, -1, 50, 4, |
| 1646 | -1, 11, -1, 12, -1, 13, -1, 14, -1, 46, |
| 1647 | -1, 183, -1, 184, 140, -1, 218, -1, 141, 4, |
| 1648 | -1, 184, 142, 188, 143, 176, -1, 10, 142, 188, |
| 1649 | 143, 176, -1, 144, 4, 145, 184, 146, -1, 147, |
| 1650 | 4, 145, 184, 148, -1, 149, 189, 150, -1, 149, |
| 1651 | 150, -1, 147, 149, 189, 150, 148, -1, 147, 149, |
| 1652 | 150, 148, -1, 184, 174, -1, 184, -1, 10, -1, |
| 1653 | 185, -1, 187, 139, 185, -1, 187, -1, 187, 139, |
| 1654 | 36, -1, 36, -1, -1, 184, -1, 189, 139, 184, |
| 1655 | -1, 184, 144, 192, 146, -1, 184, 144, 146, -1, |
| 1656 | 184, 151, 19, -1, 184, 147, 192, 148, -1, 184, |
| 1657 | 149, 192, 150, -1, 184, 149, 150, -1, 184, 147, |
| 1658 | 149, 192, 150, 148, -1, 184, 147, 149, 150, 148, |
| 1659 | -1, 184, 37, -1, 184, 38, -1, 184, 218, -1, |
| 1660 | 184, 191, -1, 184, 22, -1, 158, 3, -1, 158, |
| 1661 | 5, -1, 158, 4, -1, 158, 6, -1, 11, 23, |
| 1662 | -1, 11, 24, -1, 159, 9, -1, 155, 142, 190, |
| 1663 | 35, 184, 143, -1, 112, 142, 190, 229, 143, -1, |
| 1664 | 126, 142, 190, 139, 190, 139, 190, 143, -1, 153, |
| 1665 | 142, 190, 139, 190, 143, -1, 154, 142, 190, 139, |
| 1666 | 190, 143, -1, 85, 156, 142, 190, 139, 190, 143, |
| 1667 | -1, 86, 157, 142, 190, 139, 190, 143, -1, 128, |
| 1668 | 142, 190, 139, 190, 143, -1, 129, 142, 190, 139, |
| 1669 | 190, 139, 190, 143, -1, 130, 142, 190, 139, 190, |
| 1670 | 139, 190, 143, -1, 192, 139, 190, -1, 190, -1, |
| 1671 | 29, -1, 30, -1, 34, -1, -1, 186, 218, -1, |
| 1672 | 118, 142, 195, 35, 184, 143, -1, 197, -1, -1, |
| 1673 | 198, -1, 197, 198, -1, -1, 28, 199, 214, -1, |
| 1674 | -1, 27, 200, 215, -1, 55, 54, 204, -1, 162, |
| 1675 | 15, 184, -1, 162, 15, 10, -1, -1, 164, 168, |
| 1676 | 194, 193, 190, 201, 181, -1, -1, 164, 166, 168, |
| 1677 | 194, 193, 190, 202, 181, -1, -1, 164, 167, 168, |
| 1678 | 194, 193, 184, 203, 181, -1, 164, 168, 32, 171, |
| 1679 | 195, -1, 48, 205, -1, 51, 138, 206, -1, 19, |
| 1680 | -1, 49, 138, 19, -1, 63, 138, 19, -1, 144, |
| 1681 | 207, 146, -1, 207, 139, 19, -1, 19, -1, -1, |
| 1682 | 208, 139, 184, 174, 161, -1, 184, 174, 161, -1, |
| 1683 | 208, -1, 208, 139, 36, -1, 36, -1, -1, 172, |
| 1684 | 186, 163, 142, 209, 143, 176, 180, 177, -1, 25, |
| 1685 | -1, 149, -1, 170, 168, 210, 211, -1, 26, -1, |
| 1686 | 150, -1, 221, 213, -1, 169, 168, 210, -1, -1, |
| 1687 | 56, -1, 3, -1, 4, -1, 9, -1, 23, -1, |
| 1688 | 24, -1, 37, -1, 38, -1, 22, -1, 147, 192, |
| 1689 | 148, -1, 191, -1, 54, 216, 19, 139, 19, -1, |
| 1690 | 7, -1, 8, -1, 160, -1, 163, -1, 218, -1, |
| 1691 | 217, -1, 184, 219, -1, 221, 222, -1, 212, 222, |
| 1692 | -1, 223, 162, 224, -1, 223, 226, -1, -1, 18, |
| 1693 | -1, 64, 220, -1, 64, 10, -1, 65, 14, 219, |
| 1694 | -1, 65, 11, 219, 139, 14, 219, 139, 14, 219, |
| 1695 | -1, 66, 158, 219, 139, 14, 219, 144, 225, 146, |
| 1696 | -1, 66, 158, 219, 139, 14, 219, 144, 146, -1, |
| 1697 | 67, 172, 186, 219, 142, 228, 143, 176, 35, 14, |
| 1698 | 219, 68, 14, 219, -1, 68, -1, 69, -1, 225, |
| 1699 | 158, 217, 139, 14, 219, -1, 158, 217, 139, 14, |
| 1700 | 219, -1, 162, 231, -1, 184, 144, 219, 139, 219, |
| 1701 | 146, -1, 227, 139, 144, 219, 139, 219, 146, -1, |
| 1702 | 184, 219, 174, -1, 228, 139, 184, 219, 174, -1, |
| 1703 | -1, -1, 229, 139, 220, -1, 53, 52, -1, 52, |
| 1704 | -1, 153, 184, 219, 139, 219, -1, 154, 184, 219, |
| 1705 | 139, 219, -1, 85, 156, 184, 219, 139, 219, -1, |
| 1706 | 86, 157, 184, 219, 139, 219, -1, 155, 220, 35, |
| 1707 | 184, -1, 126, 220, 139, 220, 139, 220, -1, 127, |
| 1708 | 220, 139, 184, -1, 128, 220, 139, 220, -1, 129, |
| 1709 | 220, 139, 220, 139, 220, -1, 130, 220, 139, 220, |
| 1710 | 139, 220, -1, 125, 227, -1, 230, 172, 186, 219, |
| 1711 | 142, 228, 143, 176, -1, 233, -1, 33, -1, -1, |
| 1712 | 107, 184, 178, -1, 107, 184, 139, 11, 219, 178, |
| 1713 | -1, 108, 184, 178, -1, 108, 184, 139, 11, 219, |
| 1714 | 178, -1, 109, 220, -1, 232, 110, 184, 219, 178, |
| 1715 | -1, 232, 111, 220, 139, 184, 219, 178, -1, 112, |
| 1716 | 184, 219, 229, -1 |
| 1717 | }; |
| 1718 | |
| 1719 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1720 | static const unsigned short int yyrline[] = |
| 1721 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1722 | 0, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, |
| 1723 | 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1118, 1118, 1118, |
| 1724 | 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1122, |
| 1725 | 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1130, |
| 1726 | 1130, 1131, 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1135, |
| 1727 | 1135, 1136, 1136, 1137, 1138, 1143, 1144, 1144, 1146, 1146, |
| 1728 | 1146, 1147, 1147, 1151, 1155, 1160, 1160, 1162, 1163, 1168, |
| 1729 | 1174, 1175, 1176, 1177, 1178, 1182, 1183, 1184, 1188, 1189, |
| 1730 | 1190, 1191, 1195, 1196, 1197, 1201, 1202, 1203, 1204, 1205, |
| 1731 | 1209, 1210, 1211, 1214, 1215, 1216, 1217, 1218, 1219, 1220, |
| 1732 | 1227, 1228, 1229, 1230, 1233, 1234, 1239, 1240, 1241, 1244, |
| 1733 | 1245, 1252, 1253, 1259, 1260, 1268, 1276, 1277, 1282, 1283, |
| 1734 | 1284, 1289, 1302, 1302, 1302, 1302, 1305, 1309, 1313, 1320, |
| 1735 | 1325, 1333, 1363, 1394, 1399, 1411, 1421, 1425, 1435, 1442, |
| 1736 | 1449, 1456, 1461, 1466, 1473, 1474, 1481, 1488, 1496, 1502, |
| 1737 | 1514, 1542, 1558, 1585, 1613, 1639, 1659, 1685, 1705, 1717, |
| 1738 | 1724, 1790, 1800, 1810, 1816, 1826, 1832, 1842, 1847, 1852, |
| 1739 | 1860, 1872, 1894, 1902, 1908, 1919, 1924, 1929, 1935, 1941, |
| 1740 | 1950, 1954, 1962, 1962, 1965, 1965, 1968, 1979, 2000, 2005, |
| 1741 | 2013, 2014, 2018, 2018, 2022, 2022, 2025, 2028, 2052, 2063, |
| 1742 | 2063, 2074, 2073, 2083, 2082, 2093, 2112, 2115, 2121, 2131, |
| 1743 | 2135, 2140, 2142, 2147, 2152, 2161, 2171, 2182, 2186, 2195, |
| 1744 | 2204, 2209, 2330, 2330, 2332, 2341, 2341, 2343, 2348, 2360, |
| 1745 | 2364, 2369, 2373, 2377, 2381, 2385, 2389, 2393, 2397, 2401, |
| 1746 | 2426, 2430, 2440, 2444, 2448, 2453, 2460, 2460, 2466, 2475, |
| 1747 | 2479, 2488, 2497, 2506, 2510, 2517, 2521, 2525, 2530, 2540, |
| 1748 | 2559, 2568, 2648, 2652, 2659, 2670, 2683, 2693, 2704, 2714, |
| 1749 | 2723, 2732, 2735, 2736, 2743, 2747, 2752, 2773, 2790, 2804, |
| 1750 | 2818, 2830, 2838, 2845, 2851, 2857, 2863, 2878, 2963, 2968, |
| 1751 | 2972, 2979, 2986, 2994, 3001, 3009, 3017, 3031, 3048 |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 1752 | }; |
| 1753 | #endif |
| 1754 | |
| 1755 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1756 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1757 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1758 | static const char *const yytname[] = |
| 1759 | { |
| 1760 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1761 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1762 | "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR", |
| 1763 | "STRINGCONSTANT", "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", |
| 1764 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1765 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "ALIAS", |
| 1766 | "VOLATILE", "THREAD_LOCAL", "TO", "DOTDOTDOT", "NULL_TOK", "UNDEF", |
| 1767 | "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", |
| 1768 | "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", |
| 1769 | "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", |
| 1770 | "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", |
| 1771 | "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", |
| 1772 | "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", |
| 1773 | "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", |
| 1774 | "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", |
| 1775 | "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", |
| 1776 | "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", |
| 1777 | "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", |
| 1778 | "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", |
| 1779 | "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", |
| 1780 | "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "NOUNWIND", "DEFAULT", |
| 1781 | "HIDDEN", "PROTECTED", "'='", "','", "'*'", "'\\\\'", "'('", "')'", |
| 1782 | "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", |
| 1783 | "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", "FPredicates", |
| 1784 | "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign", |
| 1785 | "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", |
| 1786 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1787 | "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr", |
| 1788 | "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", |
| 1789 | "SectionString", "OptSection", "GlobalVarAttributes", |
| 1790 | "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", |
| 1791 | "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", |
| 1792 | "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", |
| 1793 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1794 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1795 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1796 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1797 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", |
| 1798 | "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", |
| 1799 | "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal", |
| 1800 | "OptVolatile", "MemoryInst", 0 |
| 1801 | }; |
| 1802 | #endif |
| 1803 | |
| 1804 | # ifdef YYPRINT |
| 1805 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1806 | token YYLEX-NUM. */ |
| 1807 | static const unsigned short int yytoknum[] = |
| 1808 | { |
| 1809 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1810 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1811 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1812 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1813 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1814 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1815 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1816 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1817 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1818 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1819 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1820 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1821 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1822 | 385, 386, 387, 388, 389, 390, 391, 392, 61, 44, |
| 1823 | 42, 92, 40, 41, 91, 120, 93, 60, 62, 123, |
| 1824 | 125, 99 |
| 1825 | }; |
| 1826 | # endif |
| 1827 | |
| 1828 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1829 | static const unsigned char yyr1[] = |
| 1830 | { |
| 1831 | 0, 152, 153, 153, 153, 153, 153, 153, 153, 153, |
| 1832 | 153, 154, 154, 154, 154, 154, 154, 155, 155, 155, |
| 1833 | 155, 155, 155, 155, 155, 155, 155, 155, 155, 156, |
| 1834 | 156, 156, 156, 156, 156, 156, 156, 156, 156, 157, |
| 1835 | 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, |
| 1836 | 157, 157, 157, 157, 157, 158, 159, 159, 160, 160, |
| 1837 | 160, 161, 161, 162, 162, 163, 163, 164, 164, 165, |
| 1838 | 166, 166, 166, 166, 166, 167, 167, 167, 168, 168, |
| 1839 | 168, 168, 169, 169, 169, 170, 170, 170, 170, 170, |
| 1840 | 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, |
| 1841 | 173, 173, 173, 173, 174, 174, 175, 175, 175, 176, |
| 1842 | 176, 177, 177, 178, 178, 179, 180, 180, 181, 181, |
| 1843 | 182, 182, 183, 183, 183, 183, 184, 184, 184, 184, |
| 1844 | 184, 184, 184, 184, 184, 184, 184, 184, 184, 185, |
| 1845 | 186, 186, 187, 187, 188, 188, 188, 188, 189, 189, |
| 1846 | 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, |
| 1847 | 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, |
| 1848 | 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, |
| 1849 | 192, 192, 193, 193, 194, 194, 195, 195, 196, 196, |
| 1850 | 197, 197, 199, 198, 200, 198, 198, 198, 198, 201, |
| 1851 | 198, 202, 198, 203, 198, 198, 198, 198, 204, 205, |
| 1852 | 205, 206, 207, 207, 207, 208, 208, 209, 209, 209, |
| 1853 | 209, 210, 211, 211, 212, 213, 213, 214, 215, 216, |
| 1854 | 216, 217, 217, 217, 217, 217, 217, 217, 217, 217, |
| 1855 | 217, 217, 218, 218, 218, 218, 219, 219, 220, 221, |
| 1856 | 221, 222, 223, 223, 223, 224, 224, 224, 224, 224, |
| 1857 | 224, 224, 224, 224, 225, 225, 226, 227, 227, 228, |
| 1858 | 228, 228, 229, 229, 230, 230, 231, 231, 231, 231, |
| 1859 | 231, 231, 231, 231, 231, 231, 231, 231, 231, 232, |
| 1860 | 232, 233, 233, 233, 233, 233, 233, 233, 233 |
| 1861 | }; |
| 1862 | |
| 1863 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1864 | static const unsigned char yyr2[] = |
| 1865 | { |
| 1866 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1867 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1868 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1869 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1870 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1871 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1872 | 1, 1, 0, 2, 0, 1, 1, 1, 0, 2, |
| 1873 | 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, |
| 1874 | 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, |
| 1875 | 0, 1, 1, 0, 1, 1, 1, 1, 1, 2, |
| 1876 | 1, 1, 1, 1, 0, 2, 1, 1, 1, 0, |
| 1877 | 2, 0, 2, 0, 3, 2, 0, 1, 0, 3, |
| 1878 | 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, |
| 1879 | 2, 5, 5, 5, 5, 3, 2, 5, 4, 2, |
| 1880 | 1, 1, 1, 3, 1, 3, 1, 0, 1, 3, |
| 1881 | 4, 3, 3, 4, 4, 3, 6, 5, 2, 2, |
| 1882 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1883 | 6, 5, 8, 6, 6, 7, 7, 6, 8, 8, |
| 1884 | 3, 1, 1, 1, 1, 0, 2, 6, 1, 0, |
| 1885 | 1, 2, 0, 3, 0, 3, 3, 3, 3, 0, |
| 1886 | 7, 0, 8, 0, 8, 5, 2, 3, 1, 3, |
| 1887 | 3, 3, 3, 1, 0, 5, 3, 1, 3, 1, |
| 1888 | 0, 9, 1, 1, 4, 1, 1, 2, 3, 0, |
| 1889 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, |
| 1890 | 1, 5, 1, 1, 1, 1, 1, 1, 2, 2, |
| 1891 | 2, 3, 2, 0, 1, 2, 2, 3, 9, 9, |
| 1892 | 8, 14, 1, 1, 6, 5, 2, 6, 7, 3, |
| 1893 | 5, 0, 0, 3, 2, 1, 5, 5, 6, 6, |
| 1894 | 4, 6, 4, 4, 6, 6, 2, 8, 1, 1, |
| 1895 | 0, 3, 6, 3, 6, 2, 5, 7, 4 |
| 1896 | }; |
| 1897 | |
| 1898 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1899 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1900 | means the default is an error. */ |
| 1901 | static const unsigned short int yydefact[] = |
| 1902 | { |
| 1903 | 68, 58, 65, 59, 66, 60, 194, 192, 0, 0, |
| 1904 | 0, 0, 0, 0, 78, 67, 0, 68, 190, 82, |
| 1905 | 85, 0, 0, 206, 0, 0, 63, 0, 69, 70, |
| 1906 | 72, 71, 73, 75, 74, 76, 77, 79, 80, 81, |
| 1907 | 78, 78, 185, 1, 191, 83, 84, 78, 195, 86, |
| 1908 | 87, 88, 89, 78, 253, 193, 253, 0, 0, 214, |
| 1909 | 207, 208, 196, 242, 243, 198, 122, 123, 124, 125, |
| 1910 | 126, 0, 0, 0, 0, 244, 245, 127, 197, 129, |
| 1911 | 185, 185, 90, 184, 0, 93, 93, 254, 250, 64, |
| 1912 | 225, 226, 227, 249, 209, 210, 213, 0, 147, 130, |
| 1913 | 0, 0, 0, 0, 136, 148, 0, 128, 147, 0, |
| 1914 | 0, 92, 91, 0, 182, 183, 0, 0, 94, 95, |
| 1915 | 96, 97, 98, 0, 228, 0, 290, 252, 0, 211, |
| 1916 | 146, 104, 142, 144, 0, 0, 0, 0, 0, 0, |
| 1917 | 135, 0, 0, 0, 141, 0, 140, 0, 205, 122, |
| 1918 | 123, 124, 0, 0, 0, 199, 99, 0, 222, 223, |
| 1919 | 224, 289, 275, 0, 0, 0, 0, 93, 262, 263, |
| 1920 | 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, |
| 1921 | 15, 16, 11, 12, 13, 0, 0, 0, 0, 0, |
| 1922 | 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
| 1923 | 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, |
| 1924 | 0, 0, 251, 93, 266, 0, 288, 212, 139, 0, |
| 1925 | 109, 0, 0, 138, 0, 149, 109, 201, 203, 0, |
| 1926 | 186, 167, 168, 163, 165, 164, 166, 169, 162, 158, |
| 1927 | 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1928 | 0, 0, 0, 0, 0, 161, 160, 118, 0, 274, |
| 1929 | 256, 0, 255, 0, 0, 55, 0, 0, 29, 30, |
| 1930 | 31, 32, 33, 34, 35, 36, 37, 38, 0, 53, |
| 1931 | 54, 49, 50, 51, 52, 39, 40, 41, 42, 43, |
| 1932 | 44, 45, 46, 47, 48, 0, 113, 113, 295, 0, |
| 1933 | 0, 286, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1934 | 0, 0, 0, 100, 101, 102, 103, 105, 145, 143, |
| 1935 | 132, 133, 134, 137, 131, 118, 118, 0, 0, 0, |
| 1936 | 0, 0, 0, 0, 0, 151, 181, 0, 0, 0, |
| 1937 | 155, 0, 152, 0, 0, 0, 0, 200, 220, 231, |
| 1938 | 232, 233, 238, 234, 235, 236, 237, 229, 0, 240, |
| 1939 | 247, 246, 248, 0, 257, 0, 0, 0, 0, 0, |
| 1940 | 291, 0, 293, 272, 0, 0, 0, 0, 0, 0, |
| 1941 | 0, 0, 0, 0, 0, 0, 0, 106, 107, 108, |
| 1942 | 110, 202, 204, 0, 0, 0, 272, 0, 0, 0, |
| 1943 | 0, 0, 150, 136, 148, 0, 153, 154, 0, 0, |
| 1944 | 0, 0, 0, 120, 118, 219, 104, 217, 0, 230, |
| 1945 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1946 | 298, 0, 0, 0, 282, 283, 0, 0, 0, 0, |
| 1947 | 280, 0, 113, 0, 0, 0, 0, 0, 0, 0, |
| 1948 | 0, 0, 180, 157, 0, 0, 0, 0, 115, 121, |
| 1949 | 119, 62, 0, 109, 0, 239, 0, 0, 271, 0, |
| 1950 | 0, 113, 114, 113, 0, 0, 0, 0, 0, 0, |
| 1951 | 276, 277, 271, 0, 296, 0, 187, 0, 0, 171, |
| 1952 | 0, 0, 0, 0, 156, 0, 0, 0, 61, 216, |
| 1953 | 218, 104, 116, 0, 0, 0, 0, 0, 278, 279, |
| 1954 | 292, 294, 273, 0, 0, 281, 284, 285, 0, 113, |
| 1955 | 0, 0, 0, 177, 0, 0, 173, 174, 170, 62, |
| 1956 | 117, 111, 241, 0, 0, 104, 0, 109, 267, 0, |
| 1957 | 109, 297, 175, 176, 0, 0, 0, 215, 0, 221, |
| 1958 | 0, 260, 0, 0, 269, 0, 0, 268, 287, 172, |
| 1959 | 178, 179, 112, 258, 0, 259, 0, 104, 0, 0, |
| 1960 | 0, 270, 0, 0, 0, 0, 265, 0, 0, 264, |
| 1961 | 0, 261 |
| 1962 | }; |
| 1963 | |
| 1964 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1965 | static const short int yydefgoto[] = |
| 1966 | { |
| 1967 | -1, 252, 253, 254, 278, 295, 152, 153, 75, 499, |
| 1968 | 12, 76, 14, 15, 40, 41, 42, 47, 53, 113, |
| 1969 | 123, 317, 218, 390, 320, 549, 370, 413, 531, 347, |
| 1970 | 414, 77, 154, 132, 147, 133, 134, 106, 336, 359, |
| 1971 | 337, 116, 84, 148, 16, 17, 18, 20, 19, 257, |
| 1972 | 325, 326, 62, 23, 60, 97, 417, 418, 124, 160, |
| 1973 | 54, 92, 55, 48, 420, 360, 79, 362, 262, 56, |
| 1974 | 88, 89, 212, 553, 127, 301, 507, 430, 213, 214, |
| 1975 | 215, 216 |
| 1976 | }; |
| 1977 | |
| 1978 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1979 | STATE-NUM. */ |
| 1980 | #define YYPACT_NINF -509 |
| 1981 | static const short int yypact[] = |
| 1982 | { |
| 1983 | 47, -509, -509, -509, -509, -509, -509, -509, -8, -120, |
| 1984 | -11, -110, 58, -77, 432, -509, 79, 240, -509, 204, |
| 1985 | 64, -50, -32, -509, -17, 114, -509, 1280, -509, -509, |
| 1986 | -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, |
| 1987 | 102, 102, 286, -509, -509, -509, -509, 102, -509, -509, |
| 1988 | -509, -509, -509, 102, 122, -509, 1, 130, 141, 157, |
| 1989 | -509, -509, -509, -509, -509, 62, -509, -509, -509, -509, |
| 1990 | -509, 191, 239, 5, 365, -509, -509, -509, 181, -509, |
| 1991 | 196, 196, 292, -509, 170, 220, 220, -509, -509, 118, |
| 1992 | -509, -509, -509, -509, -509, -509, -509, -93, 1082, -509, |
| 1993 | 101, 106, 566, 62, -509, 181, -94, -509, 1082, 170, |
| 1994 | 170, -509, -509, 1122, -509, -509, 1327, 250, -509, -509, |
| 1995 | -509, -509, -509, 1342, -509, -14, 1480, -509, 251, -509, |
| 1996 | -509, 181, -509, 119, 140, 1379, 1379, 125, -58, 1379, |
| 1997 | -509, 147, 1327, 1379, 62, 151, 181, 255, -509, 28, |
| 1998 | 302, 308, 219, 315, 863, -509, -509, 149, -509, -509, |
| 1999 | -509, -509, -509, 273, 1394, 222, 317, 220, -509, -509, |
| 2000 | -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, |
| 2001 | -509, -509, -509, -509, -509, 395, 443, 1379, 1379, 1379, |
| 2002 | 1379, -509, -509, -509, -509, -509, -509, -509, -509, -509, |
| 2003 | -509, -509, -509, 1379, 1379, 1379, 1379, 1379, 1379, 1379, |
| 2004 | 1379, 1379, -509, 220, -509, 155, -509, -509, 14, 1137, |
| 2005 | -509, -10, -41, -509, 184, 181, -509, -509, 181, 1122, |
| 2006 | -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, |
| 2007 | -509, 395, 443, 192, 194, 195, 197, 198, 1168, 1431, |
| 2008 | 820, 319, 199, 200, 201, -509, -509, 205, 206, -509, |
| 2009 | 62, 610, -509, 739, 739, -509, 739, 1342, -509, -509, |
| 2010 | -509, -509, -509, -509, -509, -509, -509, -509, 1379, -509, |
| 2011 | -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, |
| 2012 | -509, -509, -509, -509, -509, 1379, 2, 66, -509, 610, |
| 2013 | 46, 207, 208, 210, 216, 217, 224, 610, 610, 323, |
| 2014 | 1342, 1379, 1379, -509, -509, -509, -509, -509, -509, -509, |
| 2015 | 41, -509, -509, -509, 41, 205, 205, 326, 227, 238, |
| 2016 | 1327, 1327, 1327, 1327, 1327, -509, -509, -46, 904, -99, |
| 2017 | -509, -56, -509, 1327, 1327, 1327, 19, -509, 1184, -509, |
| 2018 | -509, -509, -509, -509, -509, -509, -509, 312, 1327, -509, |
| 2019 | -509, -509, -509, 244, -509, 248, 739, 610, 610, 10, |
| 2020 | -509, 15, -509, -509, 739, 246, 1379, 1379, 1379, 1379, |
| 2021 | 1379, 249, 252, 1379, 739, 610, 253, -509, -509, -509, |
| 2022 | -509, -509, -509, 1379, 1327, 1327, -509, 254, 257, 258, |
| 2023 | 259, 1327, -509, 260, 863, -54, -509, -509, 261, 262, |
| 2024 | 359, 380, 398, -509, 205, -509, 181, 266, 263, -509, |
| 2025 | 388, -68, 399, 400, 267, 277, 283, 739, 408, 739, |
| 2026 | 284, 285, 739, 288, 181, -509, 289, 290, 739, 739, |
| 2027 | 181, 293, 291, 1379, 89, 295, 299, -24, 1327, 1327, |
| 2028 | 1327, 1327, -509, -509, 296, 1327, 1327, 1379, -509, -509, |
| 2029 | -509, 38, 1231, -509, 300, -509, 739, 739, 1379, 739, |
| 2030 | 739, 291, -509, 291, 1379, 739, 304, 1379, 1379, 1379, |
| 2031 | -509, -509, 1379, 391, -509, 610, -509, 1327, 1327, -509, |
| 2032 | 306, 303, 310, 311, -509, 316, 322, 154, -509, -509, |
| 2033 | -509, 181, 83, 428, 321, 324, 610, -23, -509, -509, |
| 2034 | -509, -509, -509, 309, 739, -509, -509, -509, 53, 291, |
| 2035 | 335, 350, 1327, -509, 1327, 1327, -509, -509, -509, 38, |
| 2036 | -509, 404, -509, 455, -1, -509, 1379, -509, -509, 351, |
| 2037 | -509, -509, -509, -509, 353, 355, 356, -509, 496, -509, |
| 2038 | 739, -509, 993, 4, 14, 610, 87, -509, 41, -509, |
| 2039 | -509, -509, -509, -509, 362, -509, 993, -509, 488, 489, |
| 2040 | 366, 14, 739, 739, 490, 439, -509, 739, 494, -509, |
| 2041 | 739, -509 |
| 2042 | }; |
| 2043 | |
| 2044 | /* YYPGOTO[NTERM-NUM]. */ |
| 2045 | static const short int yypgoto[] = |
| 2046 | { |
| 2047 | -509, 385, 387, 390, 276, 278, -164, -509, 0, -7, |
| 2048 | 429, 8, -509, -509, -509, -509, 37, -509, -509, -509, |
| 2049 | -143, -308, -410, -509, -221, -509, -284, 17, -509, -296, |
| 2050 | -509, -509, -26, 305, -119, -509, 413, 424, -30, -151, |
| 2051 | -227, 103, 226, 298, -509, -509, 513, -509, -509, -509, |
| 2052 | -509, -509, -509, -509, -509, -509, -509, -509, 445, -509, |
| 2053 | -509, -509, -509, -509, -509, -508, -140, 96, -169, -509, |
| 2054 | 476, -509, -509, -509, -509, -509, 51, 156, -509, -509, |
| 2055 | -509, -509 |
| 2056 | }; |
| 2057 | |
| 2058 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2059 | positive, shift that token. If negative, reduce the rule which |
| 2060 | number is the opposite. If zero, do what YYDEFACT says. |
| 2061 | If YYTABLE_NINF, syntax error. */ |
| 2062 | #define YYTABLE_NINF -190 |
| 2063 | static const short int yytable[] = |
| 2064 | { |
| 2065 | 11, 78, 266, 255, 157, 324, 461, 230, 13, 101, |
| 2066 | 265, 158, 389, 372, 256, 265, 389, 11, 24, 87, |
| 2067 | 298, 427, 339, 341, 267, 13, 429, 90, 26, 391, |
| 2068 | 392, -55, -55, -55, -55, 302, 303, 304, 305, 306, |
| 2069 | 401, 21, 309, 25, 564, 139, 128, -189, 105, 406, |
| 2070 | 411, 231, 232, 129, 1, 22, 140, 3, 570, 5, |
| 2071 | 428, 28, -64, 1, 2, 428, 3, 4, 5, 412, |
| 2072 | 310, 401, 131, 27, 6, 7, 105, 80, 81, 43, |
| 2073 | 465, 139, 131, 401, 85, 401, 155, 146, 57, 11, |
| 2074 | 86, 529, 224, 401, 407, 8, 454, 146, 9, 107, |
| 2075 | 402, 108, 10, 49, 50, 51, 58, 322, 52, 221, |
| 2076 | 222, 405, 227, 225, 411, 474, 536, 228, 460, 489, |
| 2077 | 537, 361, 568, 361, 361, 554, 361, 59, 313, 314, |
| 2078 | 107, 421, 108, 61, 1, 159, 321, 3, 261, 5, |
| 2079 | 87, 369, 107, 386, 108, 551, 315, 316, 366, 94, |
| 2080 | 565, 91, 313, 314, 102, 313, 314, 571, 484, 361, |
| 2081 | 95, 296, 297, 261, 299, 258, 2, 361, 361, 4, |
| 2082 | 315, 316, 387, 315, 316, 388, 96, 300, 261, 261, |
| 2083 | 261, 261, 261, 307, 308, 261, 107, 510, 108, 511, |
| 2084 | 374, 384, 536, 131, 389, 99, 540, 313, 314, 114, |
| 2085 | 115, 313, 314, 146, 98, 371, 107, 433, 108, 435, |
| 2086 | 436, 437, 142, 143, 387, 315, 316, 388, 387, 315, |
| 2087 | 316, 388, 233, 234, 235, 236, 361, 361, 361, 107, |
| 2088 | 83, 108, 486, 263, 361, 541, 264, 37, 38, 39, |
| 2089 | -188, 146, 502, 100, 361, 361, 135, 45, 389, 46, |
| 2090 | 389, 136, 367, 255, 156, -64, 1, 2, 219, 3, |
| 2091 | 4, 5, 63, 64, 256, 311, 312, 6, 7, 368, |
| 2092 | 217, 1, 2, 223, 3, 4, 5, 117, 118, 119, |
| 2093 | 120, 121, 122, 220, 146, 385, 261, 361, 8, 361, |
| 2094 | 226, 9, 361, 229, 107, 10, 108, 528, 361, 361, |
| 2095 | 396, 397, 398, 399, 400, 512, 109, 110, 515, 516, |
| 2096 | 517, -56, 404, 408, 409, 410, 556, -57, 82, 558, |
| 2097 | 83, 107, 416, 108, 237, 259, 361, 361, 265, 361, |
| 2098 | 361, 111, 323, 112, 330, 361, 331, 332, 342, 333, |
| 2099 | 334, 343, 344, 345, 346, 361, 375, 376, 348, 377, |
| 2100 | 261, 434, 261, 261, 261, 378, 379, 440, 383, 363, |
| 2101 | 364, 393, 365, 380, 445, 446, 361, 444, 419, 394, |
| 2102 | 552, 452, 63, 64, 361, 103, 66, 67, 68, 69, |
| 2103 | 395, 1, 2, 422, 3, 4, 5, 423, 438, 566, |
| 2104 | 432, 439, 443, 448, 457, 373, 449, 450, 451, 458, |
| 2105 | 455, 456, 459, 381, 382, 462, 463, 464, 453, 468, |
| 2106 | 361, 70, 472, 466, 467, 361, 469, 485, 490, 491, |
| 2107 | 492, 493, 470, 474, 475, 495, 496, 477, 478, 479, |
| 2108 | 483, 497, 361, 361, 487, 482, 501, 361, 488, 503, |
| 2109 | 361, 428, 506, 514, 494, 522, 523, 532, 261, 524, |
| 2110 | 525, 261, 261, 261, 548, 538, 506, 520, 521, 526, |
| 2111 | 533, 498, 424, 425, 426, 527, 279, 280, 534, 550, |
| 2112 | 431, 29, 30, 31, 32, 33, 34, 35, 542, 36, |
| 2113 | 441, 442, 268, 269, 270, 271, 272, 273, 274, 275, |
| 2114 | 276, 277, 544, 543, 545, 546, 559, 557, 560, 561, |
| 2115 | 562, 569, 572, 573, 577, 574, 71, 578, 580, 72, |
| 2116 | 555, 209, 73, 210, 74, 104, 211, 328, 126, 530, |
| 2117 | 329, 141, 547, 471, 319, 473, 138, 327, 476, 498, |
| 2118 | 44, 125, 93, 518, 480, 481, 281, 282, 283, 284, |
| 2119 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 2120 | 0, 0, 447, 0, 0, 0, 0, 0, 0, 0, |
| 2121 | 0, 0, 504, 505, 0, 508, 509, 37, 38, 39, |
| 2122 | 0, 513, 0, 63, 64, 0, 103, 66, 67, 68, |
| 2123 | 69, 519, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2124 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2125 | 0, 0, 535, 0, 0, 0, 0, 0, 0, 0, |
| 2126 | 539, 0, 70, 349, 350, 0, 0, 63, 64, 351, |
| 2127 | 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, |
| 2128 | 4, 5, 352, 353, 354, 0, 0, 0, 0, 0, |
| 2129 | 0, 0, 0, 0, 0, 0, 563, 355, 356, 0, |
| 2130 | 0, 567, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2131 | 0, 0, 0, 0, 357, 0, 0, 0, 575, 576, |
| 2132 | 0, 0, 0, 579, 0, 0, 581, 0, 0, 0, |
| 2133 | 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, |
| 2134 | 180, 181, 182, 183, 184, 241, 242, 0, 0, 0, |
| 2135 | 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, |
| 2136 | 72, 0, 0, 73, 0, 74, 137, 0, 0, 0, |
| 2137 | 0, 0, 243, 191, 192, 193, 194, 195, 196, 197, |
| 2138 | 198, 199, 200, 201, 202, 0, 244, 0, 245, 246, |
| 2139 | 247, 0, 349, 350, 0, 0, 63, 64, 351, 0, |
| 2140 | 107, 0, 108, 0, 0, 1, 2, 358, 3, 4, |
| 2141 | 5, 352, 353, 354, 0, 0, 0, 0, 0, 0, |
| 2142 | 0, 0, 0, 0, 0, 0, 355, 356, 0, 0, |
| 2143 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2144 | 0, 0, 0, 357, 0, 0, 0, 0, 0, 0, |
| 2145 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, |
| 2146 | 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, |
| 2147 | 181, 182, 183, 184, 241, 242, 0, 63, 64, 0, |
| 2148 | 103, 149, 150, 151, 69, 0, 1, 2, 0, 3, |
| 2149 | 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2150 | 0, 243, 191, 192, 193, 194, 195, 196, 197, 198, |
| 2151 | 199, 200, 201, 202, 0, 244, 70, 245, 246, 247, |
| 2152 | 63, 64, 0, 0, 0, 0, 0, 0, 0, 1, |
| 2153 | 2, 0, 3, 4, 5, 238, 358, 0, 0, 0, |
| 2154 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2155 | 239, 240, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2156 | 0, 63, 64, 0, 103, 149, 150, 151, 69, 0, |
| 2157 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2158 | 0, 0, 0, 170, 171, 172, 173, 174, 175, 176, |
| 2159 | 177, 178, 179, 180, 181, 182, 183, 184, 241, 242, |
| 2160 | 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2161 | 0, 71, 0, 0, 72, 0, 0, 73, 0, 74, |
| 2162 | 340, 0, 0, 0, 0, 243, 191, 192, 193, 194, |
| 2163 | 195, 196, 197, 198, 199, 200, 201, 202, 0, 244, |
| 2164 | 0, 245, 246, 247, 0, 0, 349, 350, 0, 0, |
| 2165 | 0, 0, 351, 107, 0, 108, 0, 248, 0, 0, |
| 2166 | 249, 0, 250, 0, 251, 352, 353, 354, 0, 0, |
| 2167 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2168 | 355, 356, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2169 | 0, 0, 0, 0, 0, 71, 0, 357, 72, 0, |
| 2170 | 0, 73, 0, 74, 403, 0, 0, 0, 0, 0, |
| 2171 | 0, 0, 0, 170, 171, 172, 173, 174, 175, 176, |
| 2172 | 177, 178, 179, 180, 181, 182, 183, 184, 241, 242, |
| 2173 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, |
| 2174 | 64, 0, 103, 66, 67, 68, 69, 0, 1, 2, |
| 2175 | 0, 3, 4, 5, 0, 243, 191, 192, 193, 194, |
| 2176 | 195, 196, 197, 198, 199, 200, 201, 202, 130, 244, |
| 2177 | 0, 245, 246, 247, 0, 0, 0, 0, 70, 63, |
| 2178 | 64, 0, 144, 66, 67, 68, 69, 0, 1, 2, |
| 2179 | 358, 3, 4, 5, 63, 64, 0, 103, 66, 67, |
| 2180 | 68, 69, 0, 1, 2, 0, 3, 4, 5, 0, |
| 2181 | 0, 0, 0, 0, 0, 0, 0, 0, 70, 0, |
| 2182 | 0, 0, 0, 318, 0, 63, 64, 0, 103, 149, |
| 2183 | 150, 151, 69, 70, 1, 2, 0, 3, 4, 5, |
| 2184 | 0, 63, 64, 0, 103, 66, 67, 68, 69, 0, |
| 2185 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2186 | 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, |
| 2187 | 415, 0, 0, 71, 0, 0, 72, 0, 0, 73, |
| 2188 | 70, 74, 0, 0, 0, 0, 0, 0, 63, 64, |
| 2189 | 145, 103, 66, 67, 68, 69, 0, 1, 2, 0, |
| 2190 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
| 2191 | 0, 0, 0, 71, 0, 0, 72, 500, 0, 73, |
| 2192 | 0, 74, 0, 0, 0, 0, 0, 70, 71, 0, |
| 2193 | 0, 72, 0, 0, 73, 0, 74, 63, 64, 0, |
| 2194 | 65, 66, 67, 68, 69, 0, 1, 2, 0, 3, |
| 2195 | 4, 5, 0, 0, 0, 0, 0, 0, 0, 71, |
| 2196 | 0, 0, 72, 0, 335, 73, 0, 74, 0, 0, |
| 2197 | 0, 0, 0, 0, 0, 71, 70, 0, 72, 0, |
| 2198 | 0, 73, 0, 74, 63, 64, 0, 103, 149, 150, |
| 2199 | 151, 69, 0, 1, 2, 0, 3, 4, 5, 63, |
| 2200 | 64, 0, 144, 66, 67, 68, 69, 0, 1, 2, |
| 2201 | 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, |
| 2202 | 0, 0, 71, 70, 0, 72, 0, 0, 73, 0, |
| 2203 | 74, 0, 0, 0, 0, 0, 63, 64, 70, 103, |
| 2204 | 66, 67, 68, 69, 0, 1, 2, 0, 3, 4, |
| 2205 | 5, 63, 64, 0, 260, 66, 67, 68, 69, 0, |
| 2206 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2207 | 0, 71, 0, 0, 72, 70, 0, 73, 0, 74, |
| 2208 | 0, 0, 0, 0, 0, 0, 0, 0, 63, 64, |
| 2209 | 70, 103, 149, 150, 151, 69, 0, 1, 2, 0, |
| 2210 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
| 2211 | 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, |
| 2212 | 0, 72, 0, 0, 73, 0, 74, 70, 0, 0, |
| 2213 | 0, 0, 0, 71, 0, 0, 72, 0, 0, 73, |
| 2214 | 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2215 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2216 | 0, 0, 0, 161, 0, 0, 0, 0, 0, 0, |
| 2217 | 71, 0, 0, 72, 0, 0, 73, 0, 74, 0, |
| 2218 | 0, 0, 162, 163, 0, 71, 0, 0, 72, 0, |
| 2219 | 0, 73, 0, 74, 164, 165, 166, 167, 168, 169, |
| 2220 | 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, |
| 2221 | 180, 181, 182, 183, 184, 185, 186, 0, 0, 0, |
| 2222 | 0, 0, 71, 0, 0, 72, 0, 0, 73, 0, |
| 2223 | 338, 0, 0, 0, 0, 0, 0, 187, 188, 189, |
| 2224 | 0, 0, 190, 191, 192, 193, 194, 195, 196, 197, |
| 2225 | 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, |
| 2226 | 208 |
| 2227 | }; |
| 2228 | |
| 2229 | static const short int yycheck[] = |
| 2230 | { |
| 2231 | 0, 27, 166, 154, 123, 226, 416, 147, 0, 4, |
| 2232 | 11, 25, 320, 297, 154, 11, 324, 17, 138, 18, |
| 2233 | 189, 11, 249, 250, 167, 17, 11, 26, 138, 325, |
| 2234 | 326, 3, 4, 5, 6, 204, 205, 206, 207, 208, |
| 2235 | 139, 49, 211, 54, 552, 139, 139, 0, 74, 148, |
| 2236 | 31, 23, 24, 146, 16, 63, 150, 19, 566, 21, |
| 2237 | 50, 138, 15, 16, 17, 50, 19, 20, 21, 50, |
| 2238 | 213, 139, 98, 15, 27, 28, 102, 40, 41, 0, |
| 2239 | 148, 139, 108, 139, 47, 139, 116, 113, 138, 89, |
| 2240 | 53, 501, 150, 139, 150, 48, 150, 123, 51, 140, |
| 2241 | 146, 142, 55, 39, 40, 41, 138, 148, 44, 135, |
| 2242 | 136, 338, 142, 139, 31, 139, 139, 143, 414, 143, |
| 2243 | 143, 261, 35, 263, 264, 535, 266, 144, 114, 115, |
| 2244 | 140, 358, 142, 19, 16, 149, 146, 19, 164, 21, |
| 2245 | 18, 139, 140, 312, 142, 146, 132, 133, 267, 19, |
| 2246 | 146, 150, 114, 115, 149, 114, 115, 567, 442, 299, |
| 2247 | 19, 187, 188, 189, 190, 157, 17, 307, 308, 20, |
| 2248 | 132, 133, 131, 132, 133, 134, 19, 203, 204, 205, |
| 2249 | 206, 207, 208, 209, 210, 211, 140, 471, 142, 473, |
| 2250 | 144, 310, 139, 219, 502, 4, 143, 114, 115, 29, |
| 2251 | 30, 114, 115, 229, 142, 139, 140, 376, 142, 378, |
| 2252 | 379, 380, 109, 110, 131, 132, 133, 134, 131, 132, |
| 2253 | 133, 134, 3, 4, 5, 6, 366, 367, 368, 140, |
| 2254 | 34, 142, 143, 11, 374, 519, 14, 135, 136, 137, |
| 2255 | 0, 267, 463, 4, 384, 385, 145, 43, 556, 45, |
| 2256 | 558, 145, 278, 404, 4, 15, 16, 17, 139, 19, |
| 2257 | 20, 21, 7, 8, 404, 110, 111, 27, 28, 295, |
| 2258 | 19, 16, 17, 148, 19, 20, 21, 57, 58, 59, |
| 2259 | 60, 61, 62, 143, 310, 311, 312, 427, 48, 429, |
| 2260 | 143, 51, 432, 142, 140, 55, 142, 143, 438, 439, |
| 2261 | 330, 331, 332, 333, 334, 474, 80, 81, 477, 478, |
| 2262 | 479, 9, 338, 343, 344, 345, 537, 9, 32, 540, |
| 2263 | 34, 140, 348, 142, 9, 52, 466, 467, 11, 469, |
| 2264 | 470, 39, 148, 41, 142, 475, 142, 142, 19, 142, |
| 2265 | 142, 142, 142, 142, 139, 485, 139, 139, 142, 139, |
| 2266 | 376, 377, 378, 379, 380, 139, 139, 383, 35, 263, |
| 2267 | 264, 35, 266, 139, 394, 395, 506, 393, 56, 142, |
| 2268 | 534, 401, 7, 8, 514, 10, 11, 12, 13, 14, |
| 2269 | 142, 16, 17, 139, 19, 20, 21, 139, 139, 553, |
| 2270 | 144, 139, 139, 139, 35, 299, 139, 139, 139, 19, |
| 2271 | 139, 139, 4, 307, 308, 139, 143, 19, 148, 142, |
| 2272 | 550, 46, 4, 14, 14, 555, 139, 443, 448, 449, |
| 2273 | 450, 451, 139, 139, 139, 455, 456, 139, 139, 139, |
| 2274 | 139, 457, 572, 573, 139, 142, 462, 577, 139, 139, |
| 2275 | 580, 50, 468, 139, 148, 139, 143, 19, 474, 139, |
| 2276 | 139, 477, 478, 479, 50, 146, 482, 487, 488, 143, |
| 2277 | 139, 461, 366, 367, 368, 143, 23, 24, 144, 14, |
| 2278 | 374, 39, 40, 41, 42, 43, 44, 45, 143, 47, |
| 2279 | 384, 385, 87, 88, 89, 90, 91, 92, 93, 94, |
| 2280 | 95, 96, 522, 143, 524, 525, 143, 146, 143, 143, |
| 2281 | 4, 139, 14, 14, 14, 139, 141, 68, 14, 144, |
| 2282 | 536, 126, 147, 126, 149, 150, 126, 241, 89, 502, |
| 2283 | 242, 108, 529, 427, 219, 429, 102, 229, 432, 529, |
| 2284 | 17, 86, 56, 482, 438, 439, 93, 94, 95, 96, |
| 2285 | 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, |
| 2286 | -1, -1, 396, -1, -1, -1, -1, -1, -1, -1, |
| 2287 | -1, -1, 466, 467, -1, 469, 470, 135, 136, 137, |
| 2288 | -1, 475, -1, 7, 8, -1, 10, 11, 12, 13, |
| 2289 | 14, 485, 16, 17, -1, 19, 20, 21, -1, -1, |
| 2290 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2291 | -1, -1, 506, -1, -1, -1, -1, -1, -1, -1, |
| 2292 | 514, -1, 46, 3, 4, -1, -1, 7, 8, 9, |
| 2293 | -1, -1, -1, -1, -1, -1, 16, 17, -1, 19, |
| 2294 | 20, 21, 22, 23, 24, -1, -1, -1, -1, -1, |
| 2295 | -1, -1, -1, -1, -1, -1, 550, 37, 38, -1, |
| 2296 | -1, 555, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2297 | -1, -1, -1, -1, 54, -1, -1, -1, 572, 573, |
| 2298 | -1, -1, -1, 577, -1, -1, 580, -1, -1, -1, |
| 2299 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2300 | 80, 81, 82, 83, 84, 85, 86, -1, -1, -1, |
| 2301 | -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, |
| 2302 | 144, -1, -1, 147, -1, 149, 150, -1, -1, -1, |
| 2303 | -1, -1, 112, 113, 114, 115, 116, 117, 118, 119, |
| 2304 | 120, 121, 122, 123, 124, -1, 126, -1, 128, 129, |
| 2305 | 130, -1, 3, 4, -1, -1, 7, 8, 9, -1, |
| 2306 | 140, -1, 142, -1, -1, 16, 17, 147, 19, 20, |
| 2307 | 21, 22, 23, 24, -1, -1, -1, -1, -1, -1, |
| 2308 | -1, -1, -1, -1, -1, -1, 37, 38, -1, -1, |
| 2309 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2310 | -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, |
| 2311 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, |
| 2312 | 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, |
| 2313 | 81, 82, 83, 84, 85, 86, -1, 7, 8, -1, |
| 2314 | 10, 11, 12, 13, 14, -1, 16, 17, -1, 19, |
| 2315 | 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2316 | -1, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 2317 | 121, 122, 123, 124, -1, 126, 46, 128, 129, 130, |
| 2318 | 7, 8, -1, -1, -1, -1, -1, -1, -1, 16, |
| 2319 | 17, -1, 19, 20, 21, 22, 147, -1, -1, -1, |
| 2320 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2321 | 37, 38, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2322 | -1, 7, 8, -1, 10, 11, 12, 13, 14, -1, |
| 2323 | 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, |
| 2324 | -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, |
| 2325 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2326 | 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2327 | -1, 141, -1, -1, 144, -1, -1, 147, -1, 149, |
| 2328 | 150, -1, -1, -1, -1, 112, 113, 114, 115, 116, |
| 2329 | 117, 118, 119, 120, 121, 122, 123, 124, -1, 126, |
| 2330 | -1, 128, 129, 130, -1, -1, 3, 4, -1, -1, |
| 2331 | -1, -1, 9, 140, -1, 142, -1, 144, -1, -1, |
| 2332 | 147, -1, 149, -1, 151, 22, 23, 24, -1, -1, |
| 2333 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2334 | 37, 38, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2335 | -1, -1, -1, -1, -1, 141, -1, 54, 144, -1, |
| 2336 | -1, 147, -1, 149, 150, -1, -1, -1, -1, -1, |
| 2337 | -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, |
| 2338 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2339 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, |
| 2340 | 8, -1, 10, 11, 12, 13, 14, -1, 16, 17, |
| 2341 | -1, 19, 20, 21, -1, 112, 113, 114, 115, 116, |
| 2342 | 117, 118, 119, 120, 121, 122, 123, 124, 36, 126, |
| 2343 | -1, 128, 129, 130, -1, -1, -1, -1, 46, 7, |
| 2344 | 8, -1, 10, 11, 12, 13, 14, -1, 16, 17, |
| 2345 | 147, 19, 20, 21, 7, 8, -1, 10, 11, 12, |
| 2346 | 13, 14, -1, 16, 17, -1, 19, 20, 21, -1, |
| 2347 | -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, |
| 2348 | -1, -1, -1, 36, -1, 7, 8, -1, 10, 11, |
| 2349 | 12, 13, 14, 46, 16, 17, -1, 19, 20, 21, |
| 2350 | -1, 7, 8, -1, 10, 11, 12, 13, 14, -1, |
| 2351 | 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, |
| 2352 | -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, |
| 2353 | 36, -1, -1, 141, -1, -1, 144, -1, -1, 147, |
| 2354 | 46, 149, -1, -1, -1, -1, -1, -1, 7, 8, |
| 2355 | 118, 10, 11, 12, 13, 14, -1, 16, 17, -1, |
| 2356 | 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, |
| 2357 | -1, -1, -1, 141, -1, -1, 144, 36, -1, 147, |
| 2358 | -1, 149, -1, -1, -1, -1, -1, 46, 141, -1, |
| 2359 | -1, 144, -1, -1, 147, -1, 149, 7, 8, -1, |
| 2360 | 10, 11, 12, 13, 14, -1, 16, 17, -1, 19, |
| 2361 | 20, 21, -1, -1, -1, -1, -1, -1, -1, 141, |
| 2362 | -1, -1, 144, -1, 146, 147, -1, 149, -1, -1, |
| 2363 | -1, -1, -1, -1, -1, 141, 46, -1, 144, -1, |
| 2364 | -1, 147, -1, 149, 7, 8, -1, 10, 11, 12, |
| 2365 | 13, 14, -1, 16, 17, -1, 19, 20, 21, 7, |
| 2366 | 8, -1, 10, 11, 12, 13, 14, -1, 16, 17, |
| 2367 | -1, 19, 20, 21, -1, -1, -1, -1, -1, -1, |
| 2368 | -1, -1, 141, 46, -1, 144, -1, -1, 147, -1, |
| 2369 | 149, -1, -1, -1, -1, -1, 7, 8, 46, 10, |
| 2370 | 11, 12, 13, 14, -1, 16, 17, -1, 19, 20, |
| 2371 | 21, 7, 8, -1, 10, 11, 12, 13, 14, -1, |
| 2372 | 16, 17, -1, 19, 20, 21, -1, -1, -1, -1, |
| 2373 | -1, 141, -1, -1, 144, 46, -1, 147, -1, 149, |
| 2374 | -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, |
| 2375 | 46, 10, 11, 12, 13, 14, -1, 16, 17, -1, |
| 2376 | 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, |
| 2377 | -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, |
| 2378 | -1, 144, -1, -1, 147, -1, 149, 46, -1, -1, |
| 2379 | -1, -1, -1, 141, -1, -1, 144, -1, -1, 147, |
| 2380 | -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2381 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2382 | -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, |
| 2383 | 141, -1, -1, 144, -1, -1, 147, -1, 149, -1, |
| 2384 | -1, -1, 52, 53, -1, 141, -1, -1, 144, -1, |
| 2385 | -1, 147, -1, 149, 64, 65, 66, 67, 68, 69, |
| 2386 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2387 | 80, 81, 82, 83, 84, 85, 86, -1, -1, -1, |
| 2388 | -1, -1, 141, -1, -1, 144, -1, -1, 147, -1, |
| 2389 | 149, -1, -1, -1, -1, -1, -1, 107, 108, 109, |
| 2390 | -1, -1, 112, 113, 114, 115, 116, 117, 118, 119, |
| 2391 | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, |
| 2392 | 130 |
| 2393 | }; |
| 2394 | |
| 2395 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2396 | symbol of state STATE-NUM. */ |
| 2397 | static const unsigned char yystos[] = |
| 2398 | { |
| 2399 | 0, 16, 17, 19, 20, 21, 27, 28, 48, 51, |
| 2400 | 55, 160, 162, 163, 164, 165, 196, 197, 198, 200, |
| 2401 | 199, 49, 63, 205, 138, 54, 138, 15, 138, 39, |
| 2402 | 40, 41, 42, 43, 44, 45, 47, 135, 136, 137, |
| 2403 | 166, 167, 168, 0, 198, 43, 45, 169, 215, 39, |
| 2404 | 40, 41, 44, 170, 212, 214, 221, 138, 138, 144, |
| 2405 | 206, 19, 204, 7, 8, 10, 11, 12, 13, 14, |
| 2406 | 46, 141, 144, 147, 149, 160, 163, 183, 184, 218, |
| 2407 | 168, 168, 32, 34, 194, 168, 168, 18, 222, 223, |
| 2408 | 26, 150, 213, 222, 19, 19, 19, 207, 142, 4, |
| 2409 | 4, 4, 149, 10, 150, 184, 189, 140, 142, 194, |
| 2410 | 194, 39, 41, 171, 29, 30, 193, 57, 58, 59, |
| 2411 | 60, 61, 62, 172, 210, 210, 162, 226, 139, 146, |
| 2412 | 36, 184, 185, 187, 188, 145, 145, 150, 189, 139, |
| 2413 | 150, 188, 193, 193, 10, 118, 184, 186, 195, 11, |
| 2414 | 12, 13, 158, 159, 184, 190, 4, 186, 25, 149, |
| 2415 | 211, 33, 52, 53, 64, 65, 66, 67, 68, 69, |
| 2416 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2417 | 80, 81, 82, 83, 84, 85, 86, 107, 108, 109, |
| 2418 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
| 2419 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 153, |
| 2420 | 154, 155, 224, 230, 231, 232, 233, 19, 174, 139, |
| 2421 | 143, 184, 184, 148, 150, 184, 143, 190, 184, 142, |
| 2422 | 218, 23, 24, 3, 4, 5, 6, 9, 22, 37, |
| 2423 | 38, 85, 86, 112, 126, 128, 129, 130, 144, 147, |
| 2424 | 149, 151, 153, 154, 155, 191, 218, 201, 163, 52, |
| 2425 | 10, 184, 220, 11, 14, 11, 158, 172, 87, 88, |
| 2426 | 89, 90, 91, 92, 93, 94, 95, 96, 156, 23, |
| 2427 | 24, 93, 94, 95, 96, 97, 98, 99, 100, 101, |
| 2428 | 102, 103, 104, 105, 106, 157, 184, 184, 220, 184, |
| 2429 | 184, 227, 220, 220, 220, 220, 220, 184, 184, 220, |
| 2430 | 172, 110, 111, 114, 115, 132, 133, 173, 36, 185, |
| 2431 | 176, 146, 148, 148, 176, 202, 203, 195, 156, 157, |
| 2432 | 142, 142, 142, 142, 142, 146, 190, 192, 149, 192, |
| 2433 | 150, 192, 19, 142, 142, 142, 139, 181, 142, 3, |
| 2434 | 4, 9, 22, 23, 24, 37, 38, 54, 147, 191, |
| 2435 | 217, 218, 219, 219, 219, 219, 186, 184, 184, 139, |
| 2436 | 178, 139, 178, 219, 144, 139, 139, 139, 139, 139, |
| 2437 | 139, 219, 219, 35, 186, 184, 220, 131, 134, 173, |
| 2438 | 175, 181, 181, 35, 142, 142, 190, 190, 190, 190, |
| 2439 | 190, 139, 146, 150, 184, 192, 148, 150, 190, 190, |
| 2440 | 190, 31, 50, 179, 182, 36, 184, 208, 209, 56, |
| 2441 | 216, 192, 139, 139, 219, 219, 219, 11, 50, 11, |
| 2442 | 229, 219, 144, 220, 184, 220, 220, 220, 139, 139, |
| 2443 | 184, 219, 219, 139, 184, 190, 190, 229, 139, 139, |
| 2444 | 139, 139, 190, 148, 150, 139, 139, 35, 19, 4, |
| 2445 | 181, 174, 139, 143, 19, 148, 14, 14, 142, 139, |
| 2446 | 139, 219, 4, 219, 139, 139, 219, 139, 139, 139, |
| 2447 | 219, 219, 142, 139, 178, 184, 143, 139, 139, 143, |
| 2448 | 190, 190, 190, 190, 148, 190, 190, 184, 160, 161, |
| 2449 | 36, 184, 176, 139, 219, 219, 184, 228, 219, 219, |
| 2450 | 178, 178, 220, 219, 139, 220, 220, 220, 228, 219, |
| 2451 | 190, 190, 139, 143, 139, 139, 143, 143, 143, 174, |
| 2452 | 179, 180, 19, 139, 144, 219, 139, 143, 146, 219, |
| 2453 | 143, 178, 143, 143, 190, 190, 190, 161, 50, 177, |
| 2454 | 14, 146, 158, 225, 174, 184, 176, 146, 176, 143, |
| 2455 | 143, 143, 4, 219, 217, 146, 158, 219, 35, 139, |
| 2456 | 217, 174, 14, 14, 139, 219, 219, 14, 68, 219, |
| 2457 | 14, 219 |
| 2458 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2459 | |
| 2460 | #define yyerrok (yyerrstatus = 0) |
| 2461 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2462 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2463 | #define YYEOF 0 |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2464 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2465 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2466 | #define YYABORT goto yyabortlab |
| 2467 | #define YYERROR goto yyerrorlab |
| 2468 | |
| 2469 | |
| 2470 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2471 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2472 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2473 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2474 | #define YYFAIL goto yyerrlab |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2475 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2476 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2477 | |
| 2478 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2479 | do \ |
| 2480 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2481 | { \ |
| 2482 | yychar = (Token); \ |
| 2483 | yylval = (Value); \ |
| 2484 | yytoken = YYTRANSLATE (yychar); \ |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2485 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2486 | goto yybackup; \ |
| 2487 | } \ |
| 2488 | else \ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2489 | { \ |
| 2490 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2491 | YYERROR; \ |
| 2492 | } \ |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2493 | while (0) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2494 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2495 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2496 | #define YYTERROR 1 |
| 2497 | #define YYERRCODE 256 |
| 2498 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2499 | |
| 2500 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2501 | If N is 0, then set CURRENT to the empty location which ends |
| 2502 | the previous symbol: RHS[0] (always defined). */ |
| 2503 | |
| 2504 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2505 | #ifndef YYLLOC_DEFAULT |
| 2506 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2507 | do \ |
| 2508 | if (N) \ |
| 2509 | { \ |
| 2510 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2511 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2512 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2513 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2514 | } \ |
| 2515 | else \ |
| 2516 | { \ |
| 2517 | (Current).first_line = (Current).last_line = \ |
| 2518 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2519 | (Current).first_column = (Current).last_column = \ |
| 2520 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2521 | } \ |
| 2522 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2523 | #endif |
| 2524 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2525 | |
| 2526 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2527 | This macro was not mandated originally: define only if we know |
| 2528 | we won't break user code: when these are the locations we know. */ |
| 2529 | |
| 2530 | #ifndef YY_LOCATION_PRINT |
| 2531 | # if YYLTYPE_IS_TRIVIAL |
| 2532 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2533 | fprintf (File, "%d.%d-%d.%d", \ |
| 2534 | (Loc).first_line, (Loc).first_column, \ |
| 2535 | (Loc).last_line, (Loc).last_column) |
| 2536 | # else |
| 2537 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2538 | # endif |
| 2539 | #endif |
| 2540 | |
| 2541 | |
| 2542 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2543 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2544 | #ifdef YYLEX_PARAM |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2545 | # define YYLEX yylex (YYLEX_PARAM) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2546 | #else |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2547 | # define YYLEX yylex () |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2548 | #endif |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2549 | |
| 2550 | /* Enable debugging if requested. */ |
| 2551 | #if YYDEBUG |
| 2552 | |
| 2553 | # ifndef YYFPRINTF |
| 2554 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2555 | # define YYFPRINTF fprintf |
| 2556 | # endif |
| 2557 | |
| 2558 | # define YYDPRINTF(Args) \ |
| 2559 | do { \ |
| 2560 | if (yydebug) \ |
| 2561 | YYFPRINTF Args; \ |
| 2562 | } while (0) |
| 2563 | |
| 2564 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2565 | do { \ |
| 2566 | if (yydebug) \ |
| 2567 | { \ |
| 2568 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2569 | yysymprint (stderr, \ |
| 2570 | Type, Value); \ |
| 2571 | YYFPRINTF (stderr, "\n"); \ |
| 2572 | } \ |
| 2573 | } while (0) |
| 2574 | |
| 2575 | /*------------------------------------------------------------------. |
| 2576 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2577 | | TOP (included). | |
| 2578 | `------------------------------------------------------------------*/ |
| 2579 | |
| 2580 | #if defined (__STDC__) || defined (__cplusplus) |
| 2581 | static void |
| 2582 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2583 | #else |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2584 | static void |
| 2585 | yy_stack_print (bottom, top) |
| 2586 | short int *bottom; |
| 2587 | short int *top; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2588 | #endif |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2589 | { |
| 2590 | YYFPRINTF (stderr, "Stack now"); |
| 2591 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2592 | YYFPRINTF (stderr, " %d", *bottom); |
| 2593 | YYFPRINTF (stderr, "\n"); |
| 2594 | } |
| 2595 | |
| 2596 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2597 | do { \ |
| 2598 | if (yydebug) \ |
| 2599 | yy_stack_print ((Bottom), (Top)); \ |
| 2600 | } while (0) |
| 2601 | |
| 2602 | |
| 2603 | /*------------------------------------------------. |
| 2604 | | Report that the YYRULE is going to be reduced. | |
| 2605 | `------------------------------------------------*/ |
| 2606 | |
| 2607 | #if defined (__STDC__) || defined (__cplusplus) |
| 2608 | static void |
| 2609 | yy_reduce_print (int yyrule) |
| 2610 | #else |
| 2611 | static void |
| 2612 | yy_reduce_print (yyrule) |
| 2613 | int yyrule; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2614 | #endif |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2615 | { |
| 2616 | int yyi; |
| 2617 | unsigned long int yylno = yyrline[yyrule]; |
| 2618 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2619 | yyrule - 1, yylno); |
| 2620 | /* Print the symbols being reduced, and their result. */ |
| 2621 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2622 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2623 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2624 | } |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2625 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2626 | # define YY_REDUCE_PRINT(Rule) \ |
| 2627 | do { \ |
| 2628 | if (yydebug) \ |
| 2629 | yy_reduce_print (Rule); \ |
| 2630 | } while (0) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2631 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2632 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2633 | multiple parsers can coexist. */ |
| 2634 | int yydebug; |
| 2635 | #else /* !YYDEBUG */ |
| 2636 | # define YYDPRINTF(Args) |
| 2637 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2638 | # define YY_STACK_PRINT(Bottom, Top) |
| 2639 | # define YY_REDUCE_PRINT(Rule) |
| 2640 | #endif /* !YYDEBUG */ |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2641 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2642 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2643 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2644 | #ifndef YYINITDEPTH |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2645 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2646 | #endif |
| 2647 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2648 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2649 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2650 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2651 | Do not make this value too large; the results are undefined if |
| 2652 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2653 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2654 | |
| 2655 | #ifndef YYMAXDEPTH |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2656 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2657 | #endif |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2658 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2659 | |
| 2660 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2661 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2662 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2663 | # ifndef yystrlen |
| 2664 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2665 | # define yystrlen strlen |
| 2666 | # else |
| 2667 | /* Return the length of YYSTR. */ |
| 2668 | static YYSIZE_T |
| 2669 | # if defined (__STDC__) || defined (__cplusplus) |
| 2670 | yystrlen (const char *yystr) |
| 2671 | # else |
| 2672 | yystrlen (yystr) |
| 2673 | const char *yystr; |
| 2674 | # endif |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2675 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2676 | const char *yys = yystr; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2677 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2678 | while (*yys++ != '\0') |
| 2679 | continue; |
| 2680 | |
| 2681 | return yys - yystr - 1; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2682 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2683 | # endif |
| 2684 | # endif |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2685 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2686 | # ifndef yystpcpy |
| 2687 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2688 | # define yystpcpy stpcpy |
| 2689 | # else |
| 2690 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2691 | YYDEST. */ |
| 2692 | static char * |
| 2693 | # if defined (__STDC__) || defined (__cplusplus) |
| 2694 | yystpcpy (char *yydest, const char *yysrc) |
| 2695 | # else |
| 2696 | yystpcpy (yydest, yysrc) |
| 2697 | char *yydest; |
| 2698 | const char *yysrc; |
| 2699 | # endif |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2700 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2701 | char *yyd = yydest; |
| 2702 | const char *yys = yysrc; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2703 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2704 | while ((*yyd++ = *yys++) != '\0') |
| 2705 | continue; |
| 2706 | |
| 2707 | return yyd - 1; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2708 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2709 | # endif |
| 2710 | # endif |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2711 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2712 | # ifndef yytnamerr |
| 2713 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2714 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2715 | heuristic is that double-quoting is unnecessary unless the string |
| 2716 | contains an apostrophe, a comma, or backslash (other than |
| 2717 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2718 | null, do not copy; instead, return the length of what the result |
| 2719 | would have been. */ |
| 2720 | static YYSIZE_T |
| 2721 | yytnamerr (char *yyres, const char *yystr) |
| 2722 | { |
| 2723 | if (*yystr == '"') |
| 2724 | { |
| 2725 | size_t yyn = 0; |
| 2726 | char const *yyp = yystr; |
| 2727 | |
| 2728 | for (;;) |
| 2729 | switch (*++yyp) |
| 2730 | { |
| 2731 | case '\'': |
| 2732 | case ',': |
| 2733 | goto do_not_strip_quotes; |
| 2734 | |
| 2735 | case '\\': |
| 2736 | if (*++yyp != '\\') |
| 2737 | goto do_not_strip_quotes; |
| 2738 | /* Fall through. */ |
| 2739 | default: |
| 2740 | if (yyres) |
| 2741 | yyres[yyn] = *yyp; |
| 2742 | yyn++; |
| 2743 | break; |
| 2744 | |
| 2745 | case '"': |
| 2746 | if (yyres) |
| 2747 | yyres[yyn] = '\0'; |
| 2748 | return yyn; |
| 2749 | } |
| 2750 | do_not_strip_quotes: ; |
| 2751 | } |
| 2752 | |
| 2753 | if (! yyres) |
| 2754 | return yystrlen (yystr); |
| 2755 | |
| 2756 | return yystpcpy (yyres, yystr) - yyres; |
| 2757 | } |
| 2758 | # endif |
| 2759 | |
| 2760 | #endif /* YYERROR_VERBOSE */ |
| 2761 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2762 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2763 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2764 | #if YYDEBUG |
| 2765 | /*--------------------------------. |
| 2766 | | Print this symbol on YYOUTPUT. | |
| 2767 | `--------------------------------*/ |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2768 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2769 | #if defined (__STDC__) || defined (__cplusplus) |
| 2770 | static void |
| 2771 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2772 | #else |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2773 | static void |
| 2774 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2775 | FILE *yyoutput; |
| 2776 | int yytype; |
| 2777 | YYSTYPE *yyvaluep; |
| 2778 | #endif |
| 2779 | { |
| 2780 | /* Pacify ``unused variable'' warnings. */ |
| 2781 | (void) yyvaluep; |
| 2782 | |
| 2783 | if (yytype < YYNTOKENS) |
| 2784 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2785 | else |
| 2786 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2787 | |
| 2788 | |
| 2789 | # ifdef YYPRINT |
| 2790 | if (yytype < YYNTOKENS) |
| 2791 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2792 | # endif |
| 2793 | switch (yytype) |
| 2794 | { |
| 2795 | default: |
| 2796 | break; |
| 2797 | } |
| 2798 | YYFPRINTF (yyoutput, ")"); |
| 2799 | } |
| 2800 | |
| 2801 | #endif /* ! YYDEBUG */ |
| 2802 | /*-----------------------------------------------. |
| 2803 | | Release the memory associated to this symbol. | |
| 2804 | `-----------------------------------------------*/ |
| 2805 | |
| 2806 | #if defined (__STDC__) || defined (__cplusplus) |
| 2807 | static void |
| 2808 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2809 | #else |
| 2810 | static void |
| 2811 | yydestruct (yymsg, yytype, yyvaluep) |
| 2812 | const char *yymsg; |
| 2813 | int yytype; |
| 2814 | YYSTYPE *yyvaluep; |
| 2815 | #endif |
| 2816 | { |
| 2817 | /* Pacify ``unused variable'' warnings. */ |
| 2818 | (void) yyvaluep; |
| 2819 | |
| 2820 | if (!yymsg) |
| 2821 | yymsg = "Deleting"; |
| 2822 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2823 | |
| 2824 | switch (yytype) |
| 2825 | { |
| 2826 | |
| 2827 | default: |
| 2828 | break; |
| 2829 | } |
| 2830 | } |
| 2831 | |
| 2832 | |
| 2833 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2834 | |
| 2835 | #ifdef YYPARSE_PARAM |
| 2836 | # if defined (__STDC__) || defined (__cplusplus) |
| 2837 | int yyparse (void *YYPARSE_PARAM); |
| 2838 | # else |
| 2839 | int yyparse (); |
| 2840 | # endif |
| 2841 | #else /* ! YYPARSE_PARAM */ |
| 2842 | #if defined (__STDC__) || defined (__cplusplus) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2843 | int yyparse (void); |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2844 | #else |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2845 | int yyparse (); |
| 2846 | #endif |
| 2847 | #endif /* ! YYPARSE_PARAM */ |
| 2848 | |
| 2849 | |
| 2850 | |
| 2851 | /* The look-ahead symbol. */ |
| 2852 | int yychar; |
| 2853 | |
| 2854 | /* The semantic value of the look-ahead symbol. */ |
| 2855 | YYSTYPE yylval; |
| 2856 | |
| 2857 | /* Number of syntax errors so far. */ |
| 2858 | int yynerrs; |
| 2859 | |
| 2860 | |
| 2861 | |
| 2862 | /*----------. |
| 2863 | | yyparse. | |
| 2864 | `----------*/ |
| 2865 | |
| 2866 | #ifdef YYPARSE_PARAM |
| 2867 | # if defined (__STDC__) || defined (__cplusplus) |
| 2868 | int yyparse (void *YYPARSE_PARAM) |
| 2869 | # else |
| 2870 | int yyparse (YYPARSE_PARAM) |
| 2871 | void *YYPARSE_PARAM; |
| 2872 | # endif |
| 2873 | #else /* ! YYPARSE_PARAM */ |
| 2874 | #if defined (__STDC__) || defined (__cplusplus) |
| 2875 | int |
| 2876 | yyparse (void) |
| 2877 | #else |
| 2878 | int |
| 2879 | yyparse () |
| 2880 | |
| 2881 | #endif |
| 2882 | #endif |
| 2883 | { |
| 2884 | |
| 2885 | int yystate; |
| 2886 | int yyn; |
| 2887 | int yyresult; |
| 2888 | /* Number of tokens to shift before error messages enabled. */ |
| 2889 | int yyerrstatus; |
| 2890 | /* Look-ahead token as an internal (translated) token number. */ |
| 2891 | int yytoken = 0; |
| 2892 | |
| 2893 | /* Three stacks and their tools: |
| 2894 | `yyss': related to states, |
| 2895 | `yyvs': related to semantic values, |
| 2896 | `yyls': related to locations. |
| 2897 | |
| 2898 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2899 | to reallocate them elsewhere. */ |
| 2900 | |
| 2901 | /* The state stack. */ |
| 2902 | short int yyssa[YYINITDEPTH]; |
| 2903 | short int *yyss = yyssa; |
| 2904 | short int *yyssp; |
| 2905 | |
| 2906 | /* The semantic value stack. */ |
| 2907 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2908 | YYSTYPE *yyvs = yyvsa; |
| 2909 | YYSTYPE *yyvsp; |
| 2910 | |
| 2911 | |
| 2912 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2913 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 77d0f97 | 2007-04-25 14:29:12 +0000 | [diff] [blame] | 2914 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2915 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2916 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2917 | /* The variables used to return semantic value and location from the |
| 2918 | action routines. */ |
| 2919 | YYSTYPE yyval; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2920 | |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2921 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2922 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2923 | rule. */ |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 2924 | int yylen; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2925 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2926 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2927 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2928 | yystate = 0; |
| 2929 | yyerrstatus = 0; |
| 2930 | yynerrs = 0; |
| 2931 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2932 | |
| 2933 | /* Initialize stack pointers. |
| 2934 | Waste one element of value and location stack |
| 2935 | so that they stay on the same level as the state stack. |
| 2936 | The wasted elements are never initialized. */ |
| 2937 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2938 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2939 | yyvsp = yyvs; |
| 2940 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2941 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2942 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2943 | /*------------------------------------------------------------. |
| 2944 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2945 | `------------------------------------------------------------*/ |
| 2946 | yynewstate: |
| 2947 | /* In all cases, when you get here, the value and location stacks |
| 2948 | have just been pushed. so pushing a state here evens the stacks. |
| 2949 | */ |
| 2950 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2951 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2952 | yysetstate: |
| 2953 | *yyssp = yystate; |
| 2954 | |
| 2955 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2956 | { |
| 2957 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2958 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2959 | |
| 2960 | #ifdef yyoverflow |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2961 | { |
| 2962 | /* Give user a chance to reallocate the stack. Use copies of |
| 2963 | these so that the &'s don't force the real ones into |
| 2964 | memory. */ |
| 2965 | YYSTYPE *yyvs1 = yyvs; |
| 2966 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2967 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2968 | |
| 2969 | /* Each stack pointer address is followed by the size of the |
| 2970 | data in use in that stack, in bytes. This used to be a |
| 2971 | conditional around just the two extra args, but that might |
| 2972 | be undefined if yyoverflow is a macro. */ |
| 2973 | yyoverflow (YY_("memory exhausted"), |
| 2974 | &yyss1, yysize * sizeof (*yyssp), |
| 2975 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2976 | |
| 2977 | &yystacksize); |
| 2978 | |
| 2979 | yyss = yyss1; |
| 2980 | yyvs = yyvs1; |
| 2981 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2982 | #else /* no yyoverflow */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2983 | # ifndef YYSTACK_RELOCATE |
| 2984 | goto yyexhaustedlab; |
| 2985 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2986 | /* Extend the stack our own way. */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2987 | if (YYMAXDEPTH <= yystacksize) |
| 2988 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2989 | yystacksize *= 2; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2990 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2991 | yystacksize = YYMAXDEPTH; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 2992 | |
| 2993 | { |
| 2994 | short int *yyss1 = yyss; |
| 2995 | union yyalloc *yyptr = |
| 2996 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2997 | if (! yyptr) |
| 2998 | goto yyexhaustedlab; |
| 2999 | YYSTACK_RELOCATE (yyss); |
| 3000 | YYSTACK_RELOCATE (yyvs); |
| 3001 | |
| 3002 | # undef YYSTACK_RELOCATE |
| 3003 | if (yyss1 != yyssa) |
| 3004 | YYSTACK_FREE (yyss1); |
| 3005 | } |
| 3006 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3007 | #endif /* no yyoverflow */ |
| 3008 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3009 | yyssp = yyss + yysize - 1; |
| 3010 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3011 | |
| 3012 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3013 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3014 | (unsigned long int) yystacksize)); |
| 3015 | |
| 3016 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3017 | YYABORT; |
| 3018 | } |
| 3019 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3020 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3021 | |
| 3022 | goto yybackup; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3023 | |
| 3024 | /*-----------. |
| 3025 | | yybackup. | |
| 3026 | `-----------*/ |
| 3027 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3028 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3029 | /* Do appropriate processing given the current state. */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3030 | /* 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] | 3031 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3032 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3033 | /* 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] | 3034 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3035 | yyn = yypact[yystate]; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3036 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3037 | goto yydefault; |
| 3038 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3039 | /* 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] | 3040 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3041 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3042 | if (yychar == YYEMPTY) |
| 3043 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3044 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3045 | yychar = YYLEX; |
| 3046 | } |
| 3047 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3048 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3049 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3050 | yychar = yytoken = YYEOF; |
| 3051 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3052 | } |
| 3053 | else |
| 3054 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3055 | yytoken = YYTRANSLATE (yychar); |
| 3056 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3057 | } |
| 3058 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3059 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3060 | detect an error, take that action. */ |
| 3061 | yyn += yytoken; |
| 3062 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3063 | goto yydefault; |
| 3064 | yyn = yytable[yyn]; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3065 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3066 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3067 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3068 | goto yyerrlab; |
| 3069 | yyn = -yyn; |
| 3070 | goto yyreduce; |
| 3071 | } |
| 3072 | |
| 3073 | if (yyn == YYFINAL) |
| 3074 | YYACCEPT; |
| 3075 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3076 | /* Shift the look-ahead token. */ |
| 3077 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3078 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3079 | /* Discard the token being shifted unless it is eof. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3080 | if (yychar != YYEOF) |
| 3081 | yychar = YYEMPTY; |
| 3082 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3083 | *++yyvsp = yylval; |
| 3084 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3085 | |
| 3086 | /* Count tokens shifted since error; after three, turn off error |
| 3087 | status. */ |
| 3088 | if (yyerrstatus) |
| 3089 | yyerrstatus--; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3090 | |
| 3091 | yystate = yyn; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3092 | goto yynewstate; |
| 3093 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 3094 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3095 | /*-----------------------------------------------------------. |
| 3096 | | yydefault -- do the default action for the current state. | |
| 3097 | `-----------------------------------------------------------*/ |
| 3098 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3099 | yyn = yydefact[yystate]; |
| 3100 | if (yyn == 0) |
| 3101 | goto yyerrlab; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3102 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3103 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3104 | |
| 3105 | /*-----------------------------. |
| 3106 | | yyreduce -- Do a reduction. | |
| 3107 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3108 | yyreduce: |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3109 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3110 | yylen = yyr2[yyn]; |
| 3111 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3112 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3113 | `$$ = $1'. |
| 3114 | |
| 3115 | Otherwise, the following line sets YYVAL to garbage. |
| 3116 | This behavior is undocumented and Bison |
| 3117 | users should not rely upon it. Assigning to YYVAL |
| 3118 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3119 | GCC warning that YYVAL may be used uninitialized. */ |
| 3120 | yyval = yyvsp[1-yylen]; |
| 3121 | |
| 3122 | |
| 3123 | YY_REDUCE_PRINT (yyn); |
| 3124 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3125 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3126 | case 29: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3127 | #line 1122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3128 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3129 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3130 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3131 | case 30: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3132 | #line 1122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3133 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3134 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3135 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3136 | case 31: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3137 | #line 1123 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3138 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3139 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3140 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3141 | case 32: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3142 | #line 1123 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3143 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3144 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3145 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3146 | case 33: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3147 | #line 1124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3148 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3149 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3150 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3151 | case 34: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3152 | #line 1124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3153 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3154 | break; |
| 3155 | |
| 3156 | case 35: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3157 | #line 1125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3158 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3159 | break; |
| 3160 | |
| 3161 | case 36: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3162 | #line 1125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3163 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3164 | break; |
| 3165 | |
| 3166 | case 37: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3167 | #line 1126 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3168 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3169 | break; |
| 3170 | |
| 3171 | case 38: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3172 | #line 1126 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3173 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3174 | break; |
| 3175 | |
| 3176 | case 39: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3177 | #line 1130 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3178 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3179 | break; |
| 3180 | |
| 3181 | case 40: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3182 | #line 1130 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3183 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3184 | break; |
| 3185 | |
| 3186 | case 41: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3187 | #line 1131 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3188 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3189 | break; |
| 3190 | |
| 3191 | case 42: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3192 | #line 1131 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3193 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3194 | break; |
| 3195 | |
| 3196 | case 43: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3197 | #line 1132 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3198 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3199 | break; |
| 3200 | |
| 3201 | case 44: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3202 | #line 1132 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3203 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3204 | break; |
| 3205 | |
| 3206 | case 45: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3207 | #line 1133 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3208 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3209 | break; |
| 3210 | |
| 3211 | case 46: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3212 | #line 1133 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3213 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3214 | break; |
| 3215 | |
| 3216 | case 47: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3217 | #line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3218 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3219 | break; |
| 3220 | |
| 3221 | case 48: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3222 | #line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3223 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3224 | break; |
| 3225 | |
| 3226 | case 49: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3227 | #line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3228 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3229 | break; |
| 3230 | |
| 3231 | case 50: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3232 | #line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3233 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3234 | break; |
| 3235 | |
| 3236 | case 51: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3237 | #line 1136 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3238 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3239 | break; |
| 3240 | |
| 3241 | case 52: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3242 | #line 1136 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3243 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3244 | break; |
| 3245 | |
| 3246 | case 53: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3247 | #line 1137 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3248 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3249 | break; |
| 3250 | |
| 3251 | case 54: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3252 | #line 1138 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3253 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3254 | break; |
| 3255 | |
| 3256 | case 62: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3257 | #line 1147 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3258 | { (yyval.StrVal) = 0; ;} |
| 3259 | break; |
| 3260 | |
| 3261 | case 63: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3262 | #line 1151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3263 | { |
| 3264 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3265 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3266 | ;} |
| 3267 | break; |
| 3268 | |
| 3269 | case 64: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3270 | #line 1155 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3271 | { |
| 3272 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3273 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3274 | ;} |
| 3275 | break; |
| 3276 | |
| 3277 | case 68: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3278 | #line 1163 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3279 | { |
| 3280 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3281 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3282 | ;} |
| 3283 | break; |
| 3284 | |
| 3285 | case 69: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3286 | #line 1168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3287 | { |
| 3288 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3289 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3290 | ;} |
| 3291 | break; |
| 3292 | |
| 3293 | case 70: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3294 | #line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3295 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3296 | break; |
| 3297 | |
| 3298 | case 71: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3299 | #line 1175 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3300 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3301 | break; |
| 3302 | |
| 3303 | case 72: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3304 | #line 1176 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3305 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3306 | break; |
| 3307 | |
| 3308 | case 73: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3309 | #line 1177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3310 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3311 | break; |
| 3312 | |
| 3313 | case 74: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3314 | #line 1178 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3315 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3316 | break; |
| 3317 | |
| 3318 | case 75: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3319 | #line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3320 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3321 | break; |
| 3322 | |
| 3323 | case 76: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3324 | #line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3325 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3326 | break; |
| 3327 | |
| 3328 | case 77: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3329 | #line 1184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3330 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3331 | break; |
| 3332 | |
| 3333 | case 78: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3334 | #line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3335 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3336 | break; |
| 3337 | |
| 3338 | case 79: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3339 | #line 1189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3340 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3341 | break; |
| 3342 | |
| 3343 | case 80: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3344 | #line 1190 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3345 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3346 | break; |
| 3347 | |
| 3348 | case 81: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3349 | #line 1191 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3350 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
| 3351 | break; |
| 3352 | |
| 3353 | case 82: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3354 | #line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3355 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3356 | break; |
| 3357 | |
| 3358 | case 83: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3359 | #line 1196 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3360 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3361 | break; |
| 3362 | |
| 3363 | case 84: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3364 | #line 1197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3365 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3366 | break; |
| 3367 | |
| 3368 | case 85: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3369 | #line 1201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3370 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3371 | break; |
| 3372 | |
| 3373 | case 86: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3374 | #line 1202 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3375 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3376 | break; |
| 3377 | |
| 3378 | case 87: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3379 | #line 1203 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3380 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3381 | break; |
| 3382 | |
| 3383 | case 88: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3384 | #line 1204 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3385 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3386 | break; |
| 3387 | |
| 3388 | case 89: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3389 | #line 1205 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3390 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3391 | break; |
| 3392 | |
| 3393 | case 90: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3394 | #line 1209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3395 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3396 | break; |
| 3397 | |
| 3398 | case 91: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3399 | #line 1210 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3400 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3401 | break; |
| 3402 | |
| 3403 | case 92: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3404 | #line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3405 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3406 | break; |
| 3407 | |
| 3408 | case 93: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3409 | #line 1214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3410 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3411 | break; |
| 3412 | |
| 3413 | case 94: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3414 | #line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3415 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3416 | break; |
| 3417 | |
| 3418 | case 95: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3419 | #line 1216 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3420 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3421 | break; |
| 3422 | |
| 3423 | case 96: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3424 | #line 1217 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3425 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3426 | break; |
| 3427 | |
| 3428 | case 97: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3429 | #line 1218 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3430 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3431 | break; |
| 3432 | |
| 3433 | case 98: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3434 | #line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3435 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3436 | break; |
| 3437 | |
| 3438 | case 99: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3439 | #line 1220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3440 | { |
| 3441 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3442 | GEN_ERROR("Calling conv too large"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3443 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3444 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3445 | ;} |
| 3446 | break; |
| 3447 | |
| 3448 | case 100: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3449 | #line 1227 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3450 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3451 | break; |
| 3452 | |
| 3453 | case 101: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3454 | #line 1228 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3455 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3456 | break; |
| 3457 | |
| 3458 | case 102: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3459 | #line 1229 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3460 | { (yyval.ParamAttrs) = ParamAttr::InReg; ;} |
| 3461 | break; |
| 3462 | |
| 3463 | case 103: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3464 | #line 1230 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3465 | { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} |
| 3466 | break; |
| 3467 | |
| 3468 | case 104: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3469 | #line 1233 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3470 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3471 | break; |
| 3472 | |
| 3473 | case 105: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3474 | #line 1234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3475 | { |
| 3476 | (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs); |
| 3477 | ;} |
| 3478 | break; |
| 3479 | |
| 3480 | case 106: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3481 | #line 1239 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3482 | { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} |
| 3483 | break; |
| 3484 | |
| 3485 | case 107: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3486 | #line 1240 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3487 | { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} |
| 3488 | break; |
| 3489 | |
| 3490 | case 109: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3491 | #line 1244 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3492 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3493 | break; |
| 3494 | |
| 3495 | case 110: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3496 | #line 1245 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3497 | { |
| 3498 | (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs); |
| 3499 | ;} |
| 3500 | break; |
| 3501 | |
| 3502 | case 111: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3503 | #line 1252 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3504 | { (yyval.UIntVal) = 0; ;} |
| 3505 | break; |
| 3506 | |
| 3507 | case 112: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3508 | #line 1253 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3509 | { |
| 3510 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3511 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3512 | GEN_ERROR("Alignment must be a power of two"); |
| 3513 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3514 | ;} |
| 3515 | break; |
| 3516 | |
| 3517 | case 113: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3518 | #line 1259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3519 | { (yyval.UIntVal) = 0; ;} |
| 3520 | break; |
| 3521 | |
| 3522 | case 114: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3523 | #line 1260 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3524 | { |
| 3525 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3526 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3527 | GEN_ERROR("Alignment must be a power of two"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3528 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3529 | ;} |
| 3530 | break; |
| 3531 | |
| 3532 | case 115: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3533 | #line 1268 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3534 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3535 | for (unsigned i = 0, e = (yyvsp[0].StrVal)->length(); i != e; ++i) |
| 3536 | if ((*(yyvsp[0].StrVal))[i] == '"' || (*(yyvsp[0].StrVal))[i] == '\\') |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3537 | GEN_ERROR("Invalid character in section name"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3538 | (yyval.StrVal) = (yyvsp[0].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3539 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3540 | ;} |
| 3541 | break; |
| 3542 | |
| 3543 | case 116: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3544 | #line 1276 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3545 | { (yyval.StrVal) = 0; ;} |
| 3546 | break; |
| 3547 | |
| 3548 | case 117: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3549 | #line 1277 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3550 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3551 | break; |
| 3552 | |
| 3553 | case 118: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3554 | #line 1282 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3555 | {;} |
| 3556 | break; |
| 3557 | |
| 3558 | case 119: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3559 | #line 1283 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3560 | {;} |
| 3561 | break; |
| 3562 | |
| 3563 | case 120: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3564 | #line 1284 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3565 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3566 | CurGV->setSection(*(yyvsp[0].StrVal)); |
| 3567 | delete (yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3568 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3569 | ;} |
| 3570 | break; |
| 3571 | |
| 3572 | case 121: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3573 | #line 1289 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3574 | { |
| 3575 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3576 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3577 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3578 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3579 | ;} |
| 3580 | break; |
| 3581 | |
| 3582 | case 126: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3583 | #line 1305 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3584 | { |
| 3585 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3586 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3587 | ;} |
| 3588 | break; |
| 3589 | |
| 3590 | case 127: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3591 | #line 1309 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3592 | { |
| 3593 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3594 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3595 | ;} |
| 3596 | break; |
| 3597 | |
| 3598 | case 128: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3599 | #line 1313 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3600 | { // Pointer type? |
| 3601 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3602 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3603 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3604 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3605 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3606 | ;} |
| 3607 | break; |
| 3608 | |
| 3609 | case 129: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3610 | #line 1320 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3611 | { // Named types are also simple types... |
| 3612 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3613 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3614 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 3615 | ;} |
| 3616 | break; |
| 3617 | |
| 3618 | case 130: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3619 | #line 1325 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3620 | { // Type UpReference |
| 3621 | 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] | 3622 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3623 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3624 | (yyval.TypeVal) = new PATypeHolder(OT); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3625 | UR_OUT("New Upreference!\n"); |
| 3626 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3627 | ;} |
| 3628 | break; |
| 3629 | |
| 3630 | case 131: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3631 | #line 1333 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3632 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3633 | std::vector<const Type*> Params; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3634 | ParamAttrsVector Attrs; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3635 | if ((yyvsp[0].ParamAttrs) != ParamAttr::None) { |
| 3636 | ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3637 | Attrs.push_back(X); |
| 3638 | } |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3639 | unsigned index = 1; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3640 | TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3641 | for (; I != E; ++I, ++index) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3642 | const Type *Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3643 | Params.push_back(Ty); |
| 3644 | if (Ty != Type::VoidTy) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3645 | if (I->Attrs != ParamAttr::None) { |
| 3646 | ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; |
| 3647 | Attrs.push_back(X); |
| 3648 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3649 | } |
| 3650 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3651 | if (isVarArg) Params.pop_back(); |
| 3652 | |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3653 | ParamAttrsList *ActualAttrs = 0; |
| 3654 | if (!Attrs.empty()) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3655 | ActualAttrs = ParamAttrsList::get(Attrs); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3656 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, ActualAttrs); |
| 3657 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3658 | delete (yyvsp[-4].TypeVal); // Delete the return type handle |
| 3659 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3660 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3661 | ;} |
| 3662 | break; |
| 3663 | |
| 3664 | case 132: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3665 | #line 1363 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3666 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3667 | std::vector<const Type*> Params; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3668 | ParamAttrsVector Attrs; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3669 | if ((yyvsp[0].ParamAttrs) != ParamAttr::None) { |
| 3670 | ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3671 | Attrs.push_back(X); |
| 3672 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3673 | TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3674 | unsigned index = 1; |
| 3675 | for ( ; I != E; ++I, ++index) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3676 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3677 | Params.push_back(Ty); |
| 3678 | if (Ty != Type::VoidTy) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3679 | if (I->Attrs != ParamAttr::None) { |
| 3680 | ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; |
| 3681 | Attrs.push_back(X); |
| 3682 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3683 | } |
| 3684 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3685 | if (isVarArg) Params.pop_back(); |
| 3686 | |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3687 | ParamAttrsList *ActualAttrs = 0; |
| 3688 | if (!Attrs.empty()) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 3689 | ActualAttrs = ParamAttrsList::get(Attrs); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 3690 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3691 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, ActualAttrs); |
| 3692 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3693 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3694 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3695 | ;} |
| 3696 | break; |
| 3697 | |
| 3698 | case 133: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3699 | #line 1394 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3700 | { // Sized array type? |
| 3701 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3702 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3703 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3704 | ;} |
| 3705 | break; |
| 3706 | |
| 3707 | case 134: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3708 | #line 1399 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3709 | { // Vector type? |
| 3710 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3711 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3712 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3713 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 3714 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3715 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3716 | GEN_ERROR("Vector length should be a power of 2"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3717 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3718 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3719 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3720 | ;} |
| 3721 | break; |
| 3722 | |
| 3723 | case 135: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3724 | #line 1411 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3725 | { // Structure type? |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3726 | std::vector<const Type*> Elements; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3727 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3728 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3729 | Elements.push_back(*I); |
| 3730 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3731 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3732 | delete (yyvsp[-1].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3733 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3734 | ;} |
| 3735 | break; |
| 3736 | |
| 3737 | case 136: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3738 | #line 1421 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3739 | { // Empty structure type? |
| 3740 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3741 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3742 | ;} |
| 3743 | break; |
| 3744 | |
| 3745 | case 137: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3746 | #line 1425 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3747 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3748 | std::vector<const Type*> Elements; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3749 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 3750 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3751 | Elements.push_back(*I); |
| 3752 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3753 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3754 | delete (yyvsp[-2].TypeList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3755 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3756 | ;} |
| 3757 | break; |
| 3758 | |
| 3759 | case 138: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3760 | #line 1435 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3761 | { // Empty structure type? |
| 3762 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3763 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3764 | ;} |
| 3765 | break; |
| 3766 | |
| 3767 | case 139: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3768 | #line 1442 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3769 | { |
| 3770 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3771 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3772 | ;} |
| 3773 | break; |
| 3774 | |
| 3775 | case 140: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3776 | #line 1449 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3777 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3778 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3779 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 3780 | if (!(*(yyvsp[0].TypeVal))->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3781 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3782 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
| 3783 | ;} |
| 3784 | break; |
| 3785 | |
| 3786 | case 141: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3787 | #line 1456 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3788 | { |
| 3789 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 3790 | ;} |
| 3791 | break; |
| 3792 | |
| 3793 | case 142: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3794 | #line 1461 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3795 | { |
| 3796 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3797 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3798 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3799 | ;} |
| 3800 | break; |
| 3801 | |
| 3802 | case 143: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3803 | #line 1466 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3804 | { |
| 3805 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3806 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3807 | ;} |
| 3808 | break; |
| 3809 | |
| 3810 | case 145: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3811 | #line 1474 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3812 | { |
| 3813 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 3814 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3815 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3816 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3817 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3818 | ;} |
| 3819 | break; |
| 3820 | |
| 3821 | case 146: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3822 | #line 1481 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3823 | { |
| 3824 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3825 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 3826 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3827 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3828 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3829 | ;} |
| 3830 | break; |
| 3831 | |
| 3832 | case 147: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3833 | #line 1488 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3834 | { |
| 3835 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3836 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3837 | ;} |
| 3838 | break; |
| 3839 | |
| 3840 | case 148: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3841 | #line 1496 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3842 | { |
| 3843 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 3844 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); |
| 3845 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3846 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3847 | ;} |
| 3848 | break; |
| 3849 | |
| 3850 | case 149: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3851 | #line 1502 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3852 | { |
| 3853 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); |
| 3854 | delete (yyvsp[0].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3855 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3856 | ;} |
| 3857 | break; |
| 3858 | |
| 3859 | case 150: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3860 | #line 1514 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3861 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3862 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3863 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3864 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3865 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3866 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3867 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3868 | const Type *ETy = ATy->getElementType(); |
| 3869 | int NumElements = ATy->getNumElements(); |
| 3870 | |
| 3871 | // Verify that we have the correct size... |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3872 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3873 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3874 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3875 | itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3876 | |
| 3877 | // Verify all elements are correct type! |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3878 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3879 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3880 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3881 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3882 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3883 | } |
| 3884 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3885 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3886 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3887 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3888 | ;} |
| 3889 | break; |
| 3890 | |
| 3891 | case 151: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3892 | #line 1542 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3893 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3894 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3895 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3896 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3897 | if (ATy == 0) |
| 3898 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3899 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3900 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3901 | int NumElements = ATy->getNumElements(); |
| 3902 | if (NumElements != -1 && NumElements != 0) |
| 3903 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3904 | " arguments, but has size of " + itostr(NumElements) +""); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3905 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3906 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3907 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3908 | ;} |
| 3909 | break; |
| 3910 | |
| 3911 | case 152: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3912 | #line 1558 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3913 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3914 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3915 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3916 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3917 | if (ATy == 0) |
| 3918 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3919 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3920 | |
| 3921 | int NumElements = ATy->getNumElements(); |
| 3922 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3923 | if (NumElements != -1 && NumElements != int((yyvsp[0].StrVal)->length())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3924 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3925 | itostr((int)((yyvsp[0].StrVal)->length())) + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3926 | " when array has size " + itostr(NumElements) + ""); |
| 3927 | std::vector<Constant*> Vals; |
| 3928 | if (ETy == Type::Int8Ty) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3929 | for (unsigned i = 0; i < (yyvsp[0].StrVal)->length(); ++i) |
| 3930 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[0].StrVal))[i])); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3931 | } else { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3932 | delete (yyvsp[0].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3933 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 3934 | } |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3935 | delete (yyvsp[0].StrVal); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3936 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3937 | delete (yyvsp[-2].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3938 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3939 | ;} |
| 3940 | break; |
| 3941 | |
| 3942 | case 153: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3943 | #line 1585 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3944 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3945 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3946 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3947 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3948 | if (PTy == 0) |
| 3949 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3950 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3951 | const Type *ETy = PTy->getElementType(); |
| 3952 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3953 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3954 | // Verify that we have the correct size... |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3955 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3956 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3957 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3958 | itostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3959 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3960 | // Verify all elements are correct type! |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3961 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3962 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3963 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3964 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3965 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3966 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3967 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3968 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector)); |
| 3969 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3970 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3971 | ;} |
| 3972 | break; |
| 3973 | |
| 3974 | case 154: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 3975 | #line 1613 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3976 | { |
| 3977 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3978 | if (STy == 0) |
| 3979 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3980 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3981 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3982 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3983 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 3984 | |
| 3985 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3986 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
| 3987 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3988 | GEN_ERROR("Expected type '" + |
| 3989 | STy->getElementType(i)->getDescription() + |
| 3990 | "' for element #" + utostr(i) + |
| 3991 | " of structure initializer"); |
| 3992 | |
| 3993 | // Check to ensure that Type is not packed |
| 3994 | if (STy->isPacked()) |
| 3995 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 3996 | STy->getDescription() + "'"); |
| 3997 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 3998 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 3999 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4000 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4001 | ;} |
| 4002 | break; |
| 4003 | |
| 4004 | case 155: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4005 | #line 1639 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4006 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4007 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4008 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4009 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4010 | if (STy == 0) |
| 4011 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4012 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4013 | |
| 4014 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4015 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4016 | |
| 4017 | // Check to ensure that Type is not packed |
| 4018 | if (STy->isPacked()) |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4019 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4020 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4021 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4022 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4023 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4024 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4025 | ;} |
| 4026 | break; |
| 4027 | |
| 4028 | case 156: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4029 | #line 1659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4030 | { |
| 4031 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4032 | if (STy == 0) |
| 4033 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4034 | (*(yyvsp[-5].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4035 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4036 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4037 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4038 | |
| 4039 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4040 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) |
| 4041 | if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4042 | GEN_ERROR("Expected type '" + |
| 4043 | STy->getElementType(i)->getDescription() + |
| 4044 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4045 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4046 | |
| 4047 | // Check to ensure that Type is packed |
| 4048 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4049 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4050 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4051 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4052 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector)); |
| 4053 | delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4054 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4055 | ;} |
| 4056 | break; |
| 4057 | |
| 4058 | case 157: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4059 | #line 1685 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4060 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4061 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4062 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 4063 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4064 | if (STy == 0) |
| 4065 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4066 | (*(yyvsp[-4].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4067 | |
| 4068 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4069 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4070 | |
| 4071 | // Check to ensure that Type is packed |
| 4072 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4073 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4074 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4075 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4076 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4077 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4078 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4079 | ;} |
| 4080 | break; |
| 4081 | |
| 4082 | case 158: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4083 | #line 1705 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4084 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4085 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4086 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4087 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4088 | if (PTy == 0) |
| 4089 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4090 | (*(yyvsp[-1].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4091 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4092 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4093 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4094 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4095 | ;} |
| 4096 | break; |
| 4097 | |
| 4098 | case 159: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4099 | #line 1717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4100 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4101 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4102 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4103 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 4104 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4105 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4106 | ;} |
| 4107 | break; |
| 4108 | |
| 4109 | case 160: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4110 | #line 1724 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4111 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4112 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4113 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4114 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4115 | if (Ty == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4116 | GEN_ERROR("Global const reference must be a pointer type"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4117 | |
| 4118 | // ConstExprs can exist in the body of a function, thus creating |
| 4119 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4120 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4121 | // symbol table instead of the module symbol table for the global symbol, |
| 4122 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4123 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4124 | // |
| 4125 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4126 | CurFun.CurrentFunction = 0; |
| 4127 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4128 | Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4129 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4130 | |
| 4131 | CurFun.CurrentFunction = SavedCurFn; |
| 4132 | |
| 4133 | // If this is an initializer for a constant pointer, which is referencing a |
| 4134 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4135 | // in the future with the right type of variable. |
| 4136 | // |
| 4137 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4138 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4139 | const PointerType *PT = cast<PointerType>(Ty); |
| 4140 | |
| 4141 | // First check to see if the forward references value is already created! |
| 4142 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4143 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4144 | |
| 4145 | if (I != CurModule.GlobalRefs.end()) { |
| 4146 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4147 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4148 | } else { |
| 4149 | std::string Name; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4150 | if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4151 | Name = (yyvsp[0].ValIDVal).getName(); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4152 | else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4153 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4154 | |
| 4155 | // Create the forward referenced global. |
| 4156 | GlobalValue *GV; |
| 4157 | if (const FunctionType *FTy = |
| 4158 | dyn_cast<FunctionType>(PT->getElementType())) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4159 | GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4160 | CurModule.CurrentModule); |
| 4161 | } else { |
| 4162 | GV = new GlobalVariable(PT->getElementType(), false, |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4163 | GlobalValue::ExternalWeakLinkage, 0, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4164 | Name, CurModule.CurrentModule); |
| 4165 | } |
| 4166 | |
| 4167 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4168 | 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] | 4169 | V = GV; |
| 4170 | } |
| 4171 | } |
| 4172 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4173 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4174 | delete (yyvsp[-1].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4175 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4176 | ;} |
| 4177 | break; |
| 4178 | |
| 4179 | case 161: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4180 | #line 1790 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4181 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4182 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4183 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4184 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4185 | GEN_ERROR("Mismatched types for constant expression: " + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4186 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); |
| 4187 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 4188 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4189 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4190 | ;} |
| 4191 | break; |
| 4192 | |
| 4193 | case 162: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4194 | #line 1800 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4195 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4196 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4197 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4198 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4199 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4200 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4201 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4202 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4203 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4204 | ;} |
| 4205 | break; |
| 4206 | |
| 4207 | case 163: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4208 | #line 1810 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4209 | { // integral constants |
| 4210 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4211 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4212 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4213 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4214 | ;} |
| 4215 | break; |
| 4216 | |
| 4217 | case 164: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4218 | #line 1816 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4219 | { // arbitrary precision integer constants |
| 4220 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4221 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4222 | GEN_ERROR("Constant value does not fit in type"); |
| 4223 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4224 | (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth); |
| 4225 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
| 4226 | delete (yyvsp[0].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4227 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4228 | ;} |
| 4229 | break; |
| 4230 | |
| 4231 | case 165: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4232 | #line 1826 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4233 | { // integral constants |
| 4234 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4235 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4236 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4237 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4238 | ;} |
| 4239 | break; |
| 4240 | |
| 4241 | case 166: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4242 | #line 1832 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4243 | { // arbitrary precision integer constants |
| 4244 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4245 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4246 | GEN_ERROR("Constant value does not fit in type"); |
| 4247 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4248 | (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth); |
| 4249 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
| 4250 | delete (yyvsp[0].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4251 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4252 | ;} |
| 4253 | break; |
| 4254 | |
| 4255 | case 167: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4256 | #line 1842 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4257 | { // Boolean constants |
| 4258 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4259 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4260 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4261 | ;} |
| 4262 | break; |
| 4263 | |
| 4264 | case 168: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4265 | #line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4266 | { // Boolean constants |
| 4267 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4268 | (yyval.ConstVal) = ConstantInt::getFalse(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4269 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4270 | ;} |
| 4271 | break; |
| 4272 | |
| 4273 | case 169: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4274 | #line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4275 | { // Float & Double constants |
| 4276 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4277 | GEN_ERROR("Floating point constant invalid for type"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4278 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4279 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4280 | ;} |
| 4281 | break; |
| 4282 | |
| 4283 | case 170: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4284 | #line 1860 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4285 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4286 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4287 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4288 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4289 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4290 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4291 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4292 | Val->getType()->getDescription() + "' to '" + |
| 4293 | DestTy->getDescription() + "'"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4294 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
| 4295 | delete (yyvsp[-1].TypeVal); |
| 4296 | ;} |
| 4297 | break; |
| 4298 | |
| 4299 | case 171: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4300 | #line 1872 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4301 | { |
| 4302 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4303 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4304 | |
| 4305 | const Type *IdxTy = |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4306 | 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] | 4307 | true); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4308 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4309 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4310 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4311 | SmallVector<Constant*, 8> IdxVec; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4312 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 4313 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4314 | IdxVec.push_back(C); |
| 4315 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4316 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4317 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4318 | delete (yyvsp[-1].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4319 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4320 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4321 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4322 | ;} |
| 4323 | break; |
| 4324 | |
| 4325 | case 172: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4326 | #line 1894 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4327 | { |
| 4328 | if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4329 | GEN_ERROR("Select condition must be of boolean type"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4330 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4331 | GEN_ERROR("Select operand types must match"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4332 | (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] | 4333 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4334 | ;} |
| 4335 | break; |
| 4336 | |
| 4337 | case 173: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4338 | #line 1902 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4339 | { |
| 4340 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4341 | GEN_ERROR("Binary operator types must match"); |
| 4342 | CHECK_FOR_ERROR; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4343 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4344 | ;} |
| 4345 | break; |
| 4346 | |
| 4347 | case 174: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4348 | #line 1908 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4349 | { |
| 4350 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4351 | GEN_ERROR("Logical operator types must match"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4352 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) { |
| 4353 | if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) || |
| 4354 | !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4355 | GEN_ERROR("Logical operator requires integral operands"); |
| 4356 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4357 | (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] | 4358 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4359 | ;} |
| 4360 | break; |
| 4361 | |
| 4362 | case 175: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4363 | #line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4364 | { |
| 4365 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4366 | GEN_ERROR("icmp operand types must match"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4367 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4368 | ;} |
| 4369 | break; |
| 4370 | |
| 4371 | case 176: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4372 | #line 1924 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4373 | { |
| 4374 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4375 | GEN_ERROR("fcmp operand types must match"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4376 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4377 | ;} |
| 4378 | break; |
| 4379 | |
| 4380 | case 177: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4381 | #line 1929 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4382 | { |
| 4383 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4384 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4385 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4386 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4387 | ;} |
| 4388 | break; |
| 4389 | |
| 4390 | case 178: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4391 | #line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4392 | { |
| 4393 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4394 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4395 | (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] | 4396 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4397 | ;} |
| 4398 | break; |
| 4399 | |
| 4400 | case 179: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4401 | #line 1941 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4402 | { |
| 4403 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4404 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4405 | (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] | 4406 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4407 | ;} |
| 4408 | break; |
| 4409 | |
| 4410 | case 180: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4411 | #line 1950 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4412 | { |
| 4413 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4414 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4415 | ;} |
| 4416 | break; |
| 4417 | |
| 4418 | case 181: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4419 | #line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4420 | { |
| 4421 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4422 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4423 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4424 | ;} |
| 4425 | break; |
| 4426 | |
| 4427 | case 182: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4428 | #line 1962 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4429 | { (yyval.BoolVal) = false; ;} |
| 4430 | break; |
| 4431 | |
| 4432 | case 183: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4433 | #line 1962 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4434 | { (yyval.BoolVal) = true; ;} |
| 4435 | break; |
| 4436 | |
| 4437 | case 184: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4438 | #line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4439 | { (yyval.BoolVal) = true; ;} |
| 4440 | break; |
| 4441 | |
| 4442 | case 185: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4443 | #line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4444 | { (yyval.BoolVal) = false; ;} |
| 4445 | break; |
| 4446 | |
| 4447 | case 186: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4448 | #line 1968 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4449 | { |
| 4450 | const Type* VTy = (yyvsp[-1].TypeVal)->get(); |
| 4451 | Value *V = getVal(VTy, (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4452 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 4453 | if (!Aliasee) |
| 4454 | GEN_ERROR("Aliases can be created only to global values"); |
| 4455 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4456 | (yyval.ConstVal) = Aliasee; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4457 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4458 | delete (yyvsp[-1].TypeVal); |
| 4459 | ;} |
| 4460 | break; |
| 4461 | |
| 4462 | case 187: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4463 | #line 1979 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4464 | { |
| 4465 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4466 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4467 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4468 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4469 | Val->getType()->getDescription() + "' to '" + |
| 4470 | DestTy->getDescription() + "'"); |
| 4471 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4472 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4473 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4474 | delete (yyvsp[-1].TypeVal); |
| 4475 | ;} |
| 4476 | break; |
| 4477 | |
| 4478 | case 188: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4479 | #line 2000 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4480 | { |
| 4481 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4482 | CurModule.ModuleDone(); |
| 4483 | CHECK_FOR_ERROR; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4484 | ;} |
| 4485 | break; |
| 4486 | |
| 4487 | case 189: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4488 | #line 2005 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4489 | { |
| 4490 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4491 | CurModule.ModuleDone(); |
| 4492 | CHECK_FOR_ERROR; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4493 | ;} |
| 4494 | break; |
| 4495 | |
| 4496 | case 192: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4497 | #line 2018 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4498 | { CurFun.isDeclare = false; ;} |
| 4499 | break; |
| 4500 | |
| 4501 | case 193: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4502 | #line 2018 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4503 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4504 | CurFun.FunctionDone(); |
| 4505 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4506 | ;} |
| 4507 | break; |
| 4508 | |
| 4509 | case 194: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4510 | #line 2022 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4511 | { CurFun.isDeclare = true; ;} |
| 4512 | break; |
| 4513 | |
| 4514 | case 195: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4515 | #line 2022 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4516 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4517 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4518 | ;} |
| 4519 | break; |
| 4520 | |
| 4521 | case 196: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4522 | #line 2025 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4523 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4524 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4525 | ;} |
| 4526 | break; |
| 4527 | |
| 4528 | case 197: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4529 | #line 2028 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4530 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4531 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4532 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4533 | // Eagerly resolve types. This is not an optimization, this is a |
| 4534 | // requirement that is due to the fact that we could have this: |
| 4535 | // |
| 4536 | // %list = type { %list * } |
| 4537 | // %list = type { %list * } ; repeated type decl |
| 4538 | // |
| 4539 | // If types are not resolved eagerly, then the two types will not be |
| 4540 | // determined to be the same type! |
| 4541 | // |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4542 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4543 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4544 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4545 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4546 | // If this is a named type that is not a redefinition, add it to the slot |
| 4547 | // table. |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4548 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4549 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4550 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4551 | delete (yyvsp[0].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4552 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4553 | ;} |
| 4554 | break; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 4555 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4556 | case 198: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4557 | #line 2052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4558 | { |
| 4559 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); |
| 4560 | |
| 4561 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4562 | CHECK_FOR_ERROR |
| 4563 | // If this is a named type that is not a redefinition, add it to the slot |
| 4564 | // table. |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4565 | CurModule.Types.push_back((yyvsp[0].PrimType)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4566 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4567 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4568 | ;} |
| 4569 | break; |
| 4570 | |
| 4571 | case 199: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4572 | #line 2063 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4573 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4574 | /* "Externally Visible" Linkage */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4575 | if ((yyvsp[0].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4576 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4577 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), GlobalValue::ExternalLinkage, |
| 4578 | (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] | 4579 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4580 | ;} |
| 4581 | break; |
| 4582 | |
| 4583 | case 200: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4584 | #line 2070 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4585 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4586 | CurGV = 0; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4587 | ;} |
| 4588 | break; |
| 4589 | |
| 4590 | case 201: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4591 | #line 2074 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4592 | { |
| 4593 | if ((yyvsp[0].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4594 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4595 | 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] | 4596 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4597 | ;} |
| 4598 | break; |
| 4599 | |
| 4600 | case 202: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4601 | #line 2079 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4602 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4603 | CurGV = 0; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4604 | ;} |
| 4605 | break; |
| 4606 | |
| 4607 | case 203: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4608 | #line 2083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4609 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4610 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4611 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 4612 | 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] | 4613 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4614 | delete (yyvsp[0].TypeVal); |
| 4615 | ;} |
| 4616 | break; |
| 4617 | |
| 4618 | case 204: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4619 | #line 2089 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4620 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4621 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4622 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4623 | ;} |
| 4624 | break; |
| 4625 | |
| 4626 | case 205: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4627 | #line 2093 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4628 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4629 | std::string Name; |
| 4630 | if ((yyvsp[-4].StrVal)) { |
| 4631 | Name = *(yyvsp[-4].StrVal); |
| 4632 | delete (yyvsp[-4].StrVal); |
| 4633 | } |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4634 | if (Name.empty()) |
| 4635 | GEN_ERROR("Alias name cannot be empty"); |
| 4636 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4637 | Constant* Aliasee = (yyvsp[0].ConstVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4638 | if (Aliasee == 0) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4639 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4640 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4641 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[-1].Linkage), Name, Aliasee, |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4642 | CurModule.CurrentModule); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4643 | GA->setVisibility((yyvsp[-3].Visibility)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4644 | InsertValue(GA, CurModule.Values); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4645 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4646 | ;} |
| 4647 | break; |
| 4648 | |
| 4649 | case 206: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4650 | #line 2112 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4651 | { |
Anton Korobeynikov | 77d0f97 | 2007-04-25 14:29:12 +0000 | [diff] [blame] | 4652 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4653 | ;} |
| 4654 | break; |
| 4655 | |
| 4656 | case 207: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4657 | #line 2115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4658 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4659 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4660 | ;} |
| 4661 | break; |
| 4662 | |
| 4663 | case 208: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4664 | #line 2121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4665 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4666 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4667 | if (AsmSoFar.empty()) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4668 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4669 | else |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4670 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[0].StrVal)); |
| 4671 | delete (yyvsp[0].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4672 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4673 | ;} |
| 4674 | break; |
| 4675 | |
| 4676 | case 209: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4677 | #line 2131 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4678 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4679 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[0].StrVal)); |
| 4680 | delete (yyvsp[0].StrVal); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4681 | ;} |
| 4682 | break; |
| 4683 | |
| 4684 | case 210: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4685 | #line 2135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4686 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4687 | CurModule.CurrentModule->setDataLayout(*(yyvsp[0].StrVal)); |
| 4688 | delete (yyvsp[0].StrVal); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4689 | ;} |
| 4690 | break; |
| 4691 | |
| 4692 | case 212: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4693 | #line 2142 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4694 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4695 | CurModule.CurrentModule->addLibrary(*(yyvsp[0].StrVal)); |
| 4696 | delete (yyvsp[0].StrVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4697 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4698 | ;} |
| 4699 | break; |
| 4700 | |
| 4701 | case 213: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4702 | #line 2147 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4703 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4704 | CurModule.CurrentModule->addLibrary(*(yyvsp[0].StrVal)); |
| 4705 | delete (yyvsp[0].StrVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4706 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4707 | ;} |
| 4708 | break; |
| 4709 | |
| 4710 | case 214: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4711 | #line 2152 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4712 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4713 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4714 | ;} |
| 4715 | break; |
| 4716 | |
| 4717 | case 215: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4718 | #line 2161 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4719 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4720 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4721 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4722 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4723 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4724 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4725 | (yyval.ArgList) = (yyvsp[-4].ArgList); |
| 4726 | (yyvsp[-4].ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4727 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4728 | ;} |
| 4729 | break; |
| 4730 | |
| 4731 | case 216: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4732 | #line 2171 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4733 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4734 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4735 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4736 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4737 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4738 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4739 | (yyval.ArgList) = new ArgListType; |
| 4740 | (yyval.ArgList)->push_back(E); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4741 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4742 | ;} |
| 4743 | break; |
| 4744 | |
| 4745 | case 217: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4746 | #line 2182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4747 | { |
| 4748 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4749 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4750 | ;} |
| 4751 | break; |
| 4752 | |
| 4753 | case 218: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4754 | #line 2186 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4755 | { |
| 4756 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4757 | struct ArgListEntry E; |
| 4758 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4759 | E.Name = 0; |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 4760 | E.Attrs = ParamAttr::None; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4761 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4762 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4763 | ;} |
| 4764 | break; |
| 4765 | |
| 4766 | case 219: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4767 | #line 2195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4768 | { |
| 4769 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4770 | struct ArgListEntry E; |
| 4771 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4772 | E.Name = 0; |
| 4773 | E.Attrs = ParamAttr::None; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4774 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4775 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4776 | ;} |
| 4777 | break; |
| 4778 | |
| 4779 | case 220: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4780 | #line 2204 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4781 | { |
| 4782 | (yyval.ArgList) = 0; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4783 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4784 | ;} |
| 4785 | break; |
| 4786 | |
| 4787 | case 221: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4788 | #line 2210 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4789 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4790 | std::string FunctionName(*(yyvsp[-6].StrVal)); |
| 4791 | delete (yyvsp[-6].StrVal); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4792 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4793 | // Check the function result for abstractness if this is a define. We should |
| 4794 | // have no abstract types at this point |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4795 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal))) |
| 4796 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4797 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4798 | std::vector<const Type*> ParamTypeList; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4799 | ParamAttrsVector Attrs; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4800 | if ((yyvsp[-2].ParamAttrs) != ParamAttr::None) { |
| 4801 | ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-2].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4802 | Attrs.push_back(PAWI); |
| 4803 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4804 | if ((yyvsp[-4].ArgList)) { // If there are arguments... |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 4805 | unsigned index = 1; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4806 | 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] | 4807 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4808 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4809 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4810 | ParamTypeList.push_back(Ty); |
| 4811 | if (Ty != Type::VoidTy) |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4812 | if (I->Attrs != ParamAttr::None) { |
| 4813 | ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; |
| 4814 | Attrs.push_back(PAWI); |
| 4815 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4816 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4817 | } |
| 4818 | |
| 4819 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4820 | if (isVarArg) ParamTypeList.pop_back(); |
| 4821 | |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 4822 | ParamAttrsList *PAL = 0; |
| 4823 | if (!Attrs.empty()) |
| 4824 | PAL = ParamAttrsList::get(Attrs); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 4825 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4826 | FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, PAL); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4827 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4828 | delete (yyvsp[-7].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4829 | |
| 4830 | ValID ID; |
| 4831 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4832 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4833 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4834 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4835 | } |
| 4836 | |
| 4837 | Function *Fn = 0; |
| 4838 | // See if this function was forward referenced. If so, recycle the object. |
| 4839 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4840 | // Move the function to the end of the list, from whereever it was |
| 4841 | // previously inserted. |
| 4842 | Fn = cast<Function>(FWRef); |
| 4843 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4844 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4845 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4846 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4847 | if (Fn->getFunctionType() != FT) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4848 | // The existing function doesn't have the same type. This is an overload |
| 4849 | // error. |
| 4850 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
| 4851 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4852 | // Neither the existing or the current function is a declaration and they |
| 4853 | // have the same name and same type. Clearly this is a redefinition. |
| 4854 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4855 | } if (Fn->isDeclaration()) { |
| 4856 | // 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] | 4857 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4858 | AI != AE; ++AI) |
| 4859 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4860 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4861 | } else { // Not already defined? |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4862 | Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4863 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4864 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4865 | InsertValue(Fn, CurModule.Values); |
| 4866 | } |
| 4867 | |
| 4868 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4869 | |
| 4870 | if (CurFun.isDeclare) { |
| 4871 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4872 | // correctly handle cases, when pointer to function is passed as argument to |
| 4873 | // another function. |
| 4874 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4875 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4876 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4877 | Fn->setCallingConv((yyvsp[-8].UIntVal)); |
| 4878 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4879 | if ((yyvsp[-1].StrVal)) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4880 | Fn->setSection(*(yyvsp[-1].StrVal)); |
| 4881 | delete (yyvsp[-1].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4882 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4883 | |
| 4884 | // Add all of the arguments we parsed to the function... |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4885 | if ((yyvsp[-4].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4886 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4887 | 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] | 4888 | "Not a varargs marker!"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4889 | delete (yyvsp[-4].ArgList)->back().Ty; |
| 4890 | (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4891 | } |
| 4892 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4893 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4894 | unsigned Idx = 1; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4895 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); |
| 4896 | I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4897 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4898 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4899 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4900 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4901 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4902 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4903 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4904 | delete (yyvsp[-4].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4905 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4906 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4907 | ;} |
| 4908 | break; |
| 4909 | |
| 4910 | case 224: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4911 | #line 2332 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4912 | { |
| 4913 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4914 | |
| 4915 | // Make sure that we keep track of the linkage type even if there was a |
| 4916 | // previous "declare". |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4917 | (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage)); |
| 4918 | (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility)); |
| 4919 | ;} |
| 4920 | break; |
| 4921 | |
| 4922 | case 227: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4923 | #line 2343 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4924 | { |
| 4925 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4926 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4927 | ;} |
| 4928 | break; |
| 4929 | |
| 4930 | case 228: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4931 | #line 2348 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4932 | { |
| 4933 | CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); |
| 4934 | CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); |
| 4935 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4936 | CurFun.FunctionDone(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4937 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4938 | ;} |
| 4939 | break; |
| 4940 | |
| 4941 | case 229: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4942 | #line 2360 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4943 | { |
| 4944 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4945 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4946 | ;} |
| 4947 | break; |
| 4948 | |
| 4949 | case 230: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4950 | #line 2364 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4951 | { |
| 4952 | (yyval.BoolVal) = true; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4953 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4954 | ;} |
| 4955 | break; |
| 4956 | |
| 4957 | case 231: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4958 | #line 2369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4959 | { // A reference to a direct constant |
| 4960 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4961 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4962 | ;} |
| 4963 | break; |
| 4964 | |
| 4965 | case 232: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4966 | #line 2373 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4967 | { |
| 4968 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 4969 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4970 | ;} |
| 4971 | break; |
| 4972 | |
| 4973 | case 233: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4974 | #line 2377 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4975 | { // Perhaps it's an FP constant? |
| 4976 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4977 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4978 | ;} |
| 4979 | break; |
| 4980 | |
| 4981 | case 234: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4982 | #line 2381 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4983 | { |
| 4984 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4985 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4986 | ;} |
| 4987 | break; |
| 4988 | |
| 4989 | case 235: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4990 | #line 2385 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4991 | { |
| 4992 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4993 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4994 | ;} |
| 4995 | break; |
| 4996 | |
| 4997 | case 236: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 4998 | #line 2389 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 4999 | { |
| 5000 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5001 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5002 | ;} |
| 5003 | break; |
| 5004 | |
| 5005 | case 237: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5006 | #line 2393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5007 | { |
| 5008 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5009 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5010 | ;} |
| 5011 | break; |
| 5012 | |
| 5013 | case 238: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5014 | #line 2397 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5015 | { // A vector zero constant. |
| 5016 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5017 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5018 | ;} |
| 5019 | break; |
| 5020 | |
| 5021 | case 239: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5022 | #line 2401 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5023 | { // Nonempty unsized packed vector |
| 5024 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
| 5025 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5026 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5027 | VectorType* pt = VectorType::get(ETy, NumElements); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5028 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5029 | HandleUpRefs( |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5030 | VectorType::get( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5031 | ETy, |
| 5032 | NumElements) |
| 5033 | ) |
| 5034 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5035 | |
| 5036 | // Verify all elements are correct type! |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5037 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 5038 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5039 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5040 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5041 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5042 | } |
| 5043 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5044 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector))); |
| 5045 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5046 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5047 | ;} |
| 5048 | break; |
| 5049 | |
| 5050 | case 240: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5051 | #line 2426 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5052 | { |
| 5053 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5054 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5055 | ;} |
| 5056 | break; |
| 5057 | |
| 5058 | case 241: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5059 | #line 2430 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5060 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5061 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[-2].StrVal), *(yyvsp[0].StrVal), (yyvsp[-3].BoolVal)); |
| 5062 | delete (yyvsp[-2].StrVal); |
| 5063 | delete (yyvsp[0].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5064 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5065 | ;} |
| 5066 | break; |
| 5067 | |
| 5068 | case 242: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5069 | #line 2440 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5070 | { // Is it an integer reference...? |
| 5071 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5072 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5073 | ;} |
| 5074 | break; |
| 5075 | |
| 5076 | case 243: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5077 | #line 2444 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5078 | { |
| 5079 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5080 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5081 | ;} |
| 5082 | break; |
| 5083 | |
| 5084 | case 244: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5085 | #line 2448 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5086 | { // Is it a named reference...? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5087 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[0].StrVal)); |
| 5088 | delete (yyvsp[0].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5089 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5090 | ;} |
| 5091 | break; |
| 5092 | |
| 5093 | case 245: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5094 | #line 2453 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5095 | { // Is it a named reference...? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5096 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[0].StrVal)); |
| 5097 | delete (yyvsp[0].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5098 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5099 | ;} |
| 5100 | break; |
| 5101 | |
| 5102 | case 248: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5103 | #line 2466 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5104 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5105 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5106 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5107 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
| 5108 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5109 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5110 | ;} |
| 5111 | break; |
| 5112 | |
| 5113 | case 249: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5114 | #line 2475 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5115 | { |
| 5116 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5117 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5118 | ;} |
| 5119 | break; |
| 5120 | |
| 5121 | case 250: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5122 | #line 2479 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5123 | { // Do not allow functions with 0 basic blocks |
| 5124 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5125 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5126 | ;} |
| 5127 | break; |
| 5128 | |
| 5129 | case 251: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5130 | #line 2488 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5131 | { |
| 5132 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5133 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5134 | InsertValue((yyvsp[0].TermInstVal)); |
| 5135 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 5136 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5137 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5138 | ;} |
| 5139 | break; |
| 5140 | |
| 5141 | case 252: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5142 | #line 2497 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5143 | { |
| 5144 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5145 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 5146 | if (CI2->getParent() == 0) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5147 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
| 5148 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 5149 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5150 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5151 | ;} |
| 5152 | break; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5153 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5154 | case 253: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5155 | #line 2506 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5156 | { // Empty space between instruction lists |
| 5157 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
| 5158 | CHECK_FOR_ERROR |
| 5159 | ;} |
| 5160 | break; |
| 5161 | |
| 5162 | case 254: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5163 | #line 2510 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5164 | { // Labelled (named) basic block |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5165 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[0].StrVal))); |
| 5166 | delete (yyvsp[0].StrVal); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5167 | CHECK_FOR_ERROR |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5168 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5169 | ;} |
| 5170 | break; |
| 5171 | |
| 5172 | case 255: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5173 | #line 2517 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5174 | { // Return with a result... |
| 5175 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
| 5176 | CHECK_FOR_ERROR |
| 5177 | ;} |
| 5178 | break; |
| 5179 | |
| 5180 | case 256: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5181 | #line 2521 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5182 | { // Return with no result... |
| 5183 | (yyval.TermInstVal) = new ReturnInst(); |
| 5184 | CHECK_FOR_ERROR |
| 5185 | ;} |
| 5186 | break; |
| 5187 | |
| 5188 | case 257: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5189 | #line 2525 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5190 | { // Unconditional Branch... |
| 5191 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5192 | CHECK_FOR_ERROR |
| 5193 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 5194 | ;} |
| 5195 | break; |
| 5196 | |
| 5197 | case 258: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5198 | #line 2530 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5199 | { |
| 5200 | assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 5201 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 5202 | CHECK_FOR_ERROR |
| 5203 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5204 | CHECK_FOR_ERROR |
| 5205 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); |
| 5206 | CHECK_FOR_ERROR |
| 5207 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 5208 | ;} |
| 5209 | break; |
| 5210 | |
| 5211 | case 259: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5212 | #line 2540 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5213 | { |
| 5214 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
| 5215 | CHECK_FOR_ERROR |
| 5216 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 5217 | CHECK_FOR_ERROR |
| 5218 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 5219 | (yyval.TermInstVal) = S; |
| 5220 | |
| 5221 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 5222 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5223 | for (; I != E; ++I) { |
| 5224 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5225 | S->addCase(CI, I->second); |
| 5226 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5227 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5228 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5229 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5230 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5231 | ;} |
| 5232 | break; |
| 5233 | |
| 5234 | case 260: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5235 | #line 2559 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5236 | { |
| 5237 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5238 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5239 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5240 | CHECK_FOR_ERROR |
| 5241 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5242 | (yyval.TermInstVal) = S; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5243 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5244 | ;} |
| 5245 | break; |
| 5246 | |
| 5247 | case 261: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5248 | #line 2569 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5249 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5250 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5251 | // Handle the short syntax |
| 5252 | const PointerType *PFTy = 0; |
| 5253 | const FunctionType *Ty = 0; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5254 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5255 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5256 | // Pull out the types of all of the arguments... |
| 5257 | std::vector<const Type*> ParamTypes; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5258 | ParamAttrsVector Attrs; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5259 | if ((yyvsp[-6].ParamAttrs) != ParamAttr::None) { |
| 5260 | ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-6].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5261 | Attrs.push_back(PAWI); |
| 5262 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5263 | ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5264 | unsigned index = 1; |
| 5265 | for (; I != E; ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5266 | const Type *Ty = I->Val->getType(); |
| 5267 | if (Ty == Type::VoidTy) |
| 5268 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5269 | ParamTypes.push_back(Ty); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5270 | if (I->Attrs != ParamAttr::None) { |
| 5271 | ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; |
| 5272 | Attrs.push_back(PAWI); |
| 5273 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5274 | } |
| 5275 | |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5276 | ParamAttrsList *PAL = 0; |
| 5277 | if (!Attrs.empty()) |
| 5278 | PAL = ParamAttrsList::get(Attrs); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5279 | Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, PAL); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5280 | PFTy = PointerType::get(Ty); |
| 5281 | } |
| 5282 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5283 | delete (yyvsp[-11].TypeVal); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5284 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5285 | 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] | 5286 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5287 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5288 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5289 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5290 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5291 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5292 | // Check the arguments |
| 5293 | ValueList Args; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5294 | if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5295 | // Make sure no arguments is a good thing! |
| 5296 | if (Ty->getNumParams() != 0) |
| 5297 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5298 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5299 | } else { // Has arguments? |
| 5300 | // Loop through FunctionType's arguments and ensure they are specified |
| 5301 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5302 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5303 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5304 | ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5305 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5306 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5307 | if (ArgI->Val->getType() != *I) |
| 5308 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5309 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5310 | Args.push_back(ArgI->Val); |
| 5311 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5312 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5313 | if (Ty->isVarArg()) { |
| 5314 | if (I == E) |
| 5315 | for (; ArgI != ArgE; ++ArgI) |
| 5316 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5317 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5318 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5319 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5320 | |
| 5321 | // Create the InvokeInst |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5322 | InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size()); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5323 | II->setCallingConv((yyvsp[-12].UIntVal)); |
| 5324 | (yyval.TermInstVal) = II; |
| 5325 | delete (yyvsp[-8].ValueRefList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5326 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5327 | ;} |
| 5328 | break; |
| 5329 | |
| 5330 | case 262: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5331 | #line 2648 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5332 | { |
| 5333 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5334 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5335 | ;} |
| 5336 | break; |
| 5337 | |
| 5338 | case 263: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5339 | #line 2652 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5340 | { |
| 5341 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5342 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5343 | ;} |
| 5344 | break; |
| 5345 | |
| 5346 | case 264: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5347 | #line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5348 | { |
| 5349 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
| 5350 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5351 | CHECK_FOR_ERROR |
| 5352 | if (V == 0) |
| 5353 | GEN_ERROR("May only switch on a constant pool value"); |
| 5354 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5355 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5356 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5357 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5358 | ;} |
| 5359 | break; |
| 5360 | |
| 5361 | case 265: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5362 | #line 2670 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5363 | { |
| 5364 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5365 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5366 | CHECK_FOR_ERROR |
| 5367 | |
| 5368 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5369 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5370 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5371 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5372 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5373 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5374 | ;} |
| 5375 | break; |
| 5376 | |
| 5377 | case 266: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5378 | #line 2683 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5379 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5380 | // Is this definition named?? if so, assign the name... |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5381 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5382 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5383 | InsertValue((yyvsp[0].InstVal)); |
| 5384 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5385 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5386 | ;} |
| 5387 | break; |
| 5388 | |
| 5389 | case 267: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5390 | #line 2693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5391 | { // Used for PHI nodes |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5392 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5393 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); |
| 5394 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5395 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5396 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5397 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5398 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5399 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5400 | delete (yyvsp[-5].TypeVal); |
| 5401 | ;} |
| 5402 | break; |
| 5403 | |
| 5404 | case 268: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5405 | #line 2704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5406 | { |
| 5407 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5408 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5409 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5410 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5411 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5412 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5413 | ;} |
| 5414 | break; |
| 5415 | |
| 5416 | case 269: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5417 | #line 2714 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5418 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5419 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5420 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5421 | // Used for call and invoke instructions |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5422 | (yyval.ValueRefList) = new ValueRefList(); |
| 5423 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5424 | (yyval.ValueRefList)->push_back(E); |
| 5425 | delete (yyvsp[-2].TypeVal); |
| 5426 | ;} |
| 5427 | break; |
| 5428 | |
| 5429 | case 270: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5430 | #line 2723 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5431 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5432 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5433 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5434 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); |
| 5435 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5436 | (yyval.ValueRefList)->push_back(E); |
| 5437 | delete (yyvsp[-2].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5438 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5439 | ;} |
| 5440 | break; |
| 5441 | |
| 5442 | case 271: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5443 | #line 2732 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5444 | { (yyval.ValueRefList) = new ValueRefList(); ;} |
| 5445 | break; |
| 5446 | |
| 5447 | case 272: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5448 | #line 2735 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5449 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5450 | break; |
| 5451 | |
| 5452 | case 273: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5453 | #line 2736 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5454 | { |
| 5455 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5456 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5457 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5458 | ;} |
| 5459 | break; |
| 5460 | |
| 5461 | case 274: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5462 | #line 2743 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5463 | { |
| 5464 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5465 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5466 | ;} |
| 5467 | break; |
| 5468 | |
| 5469 | case 275: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5470 | #line 2747 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5471 | { |
| 5472 | (yyval.BoolVal) = false; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5473 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5474 | ;} |
| 5475 | break; |
| 5476 | |
| 5477 | case 276: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5478 | #line 2752 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5479 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5480 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5481 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5482 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5483 | !isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5484 | GEN_ERROR( |
| 5485 | "Arithmetic operator requires integer, FP, or packed operands"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5486 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5487 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5488 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5489 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5490 | GEN_ERROR("Remainder not supported on vector types"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5491 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5492 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5493 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5494 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5495 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
| 5496 | if ((yyval.InstVal) == 0) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5497 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5498 | delete (yyvsp[-3].TypeVal); |
| 5499 | ;} |
| 5500 | break; |
| 5501 | |
| 5502 | case 277: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5503 | #line 2773 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5504 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5505 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5506 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5507 | if (!(*(yyvsp[-3].TypeVal))->isInteger()) { |
| 5508 | if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) || |
| 5509 | !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5510 | GEN_ERROR("Logical operator requires integral operands"); |
| 5511 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5512 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5513 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5514 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5515 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5516 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
| 5517 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5518 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5519 | delete (yyvsp[-3].TypeVal); |
| 5520 | ;} |
| 5521 | break; |
| 5522 | |
| 5523 | case 278: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5524 | #line 2790 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5525 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5526 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5527 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5528 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5529 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5530 | Value* tmpVal1 = 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 | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5532 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5533 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5534 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5535 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5536 | GEN_ERROR("icmp operator returned null"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5537 | delete (yyvsp[-3].TypeVal); |
| 5538 | ;} |
| 5539 | break; |
| 5540 | |
| 5541 | case 279: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5542 | #line 2804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5543 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5544 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5545 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5546 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5547 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5548 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5549 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5550 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5551 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5552 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5553 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5554 | GEN_ERROR("fcmp operator returned null"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5555 | delete (yyvsp[-3].TypeVal); |
| 5556 | ;} |
| 5557 | break; |
| 5558 | |
| 5559 | case 280: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5560 | #line 2818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5561 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5562 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5563 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5564 | Value* Val = (yyvsp[-2].ValueVal); |
| 5565 | const Type* DestTy = (yyvsp[0].TypeVal)->get(); |
| 5566 | if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5567 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5568 | Val->getType()->getDescription() + "' to '" + |
| 5569 | DestTy->getDescription() + "'"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5570 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy); |
| 5571 | delete (yyvsp[0].TypeVal); |
| 5572 | ;} |
| 5573 | break; |
| 5574 | |
| 5575 | case 281: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5576 | #line 2830 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5577 | { |
| 5578 | if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5579 | GEN_ERROR("select condition must be boolean"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5580 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5581 | GEN_ERROR("select value types should match"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5582 | (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] | 5583 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5584 | ;} |
| 5585 | break; |
| 5586 | |
| 5587 | case 282: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5588 | #line 2838 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5589 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5590 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5591 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5592 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5593 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5594 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5595 | ;} |
| 5596 | break; |
| 5597 | |
| 5598 | case 283: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5599 | #line 2845 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5600 | { |
| 5601 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5602 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5603 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5604 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5605 | ;} |
| 5606 | break; |
| 5607 | |
| 5608 | case 284: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5609 | #line 2851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5610 | { |
| 5611 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5612 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5613 | (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] | 5614 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5615 | ;} |
| 5616 | break; |
| 5617 | |
| 5618 | case 285: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5619 | #line 2857 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5620 | { |
| 5621 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5622 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5623 | (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] | 5624 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5625 | ;} |
| 5626 | break; |
| 5627 | |
| 5628 | case 286: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5629 | #line 2863 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5630 | { |
| 5631 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5632 | if (!Ty->isFirstClassType()) |
| 5633 | GEN_ERROR("PHI node operands must be of first class type"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5634 | (yyval.InstVal) = new PHINode(Ty); |
| 5635 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5636 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5637 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5638 | GEN_ERROR("All elements of a PHI node must be of the same type"); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5639 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5640 | (yyvsp[0].PHIList)->pop_front(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5641 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5642 | delete (yyvsp[0].PHIList); // Free the list... |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5643 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5644 | ;} |
| 5645 | break; |
| 5646 | |
| 5647 | case 287: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5648 | #line 2879 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5649 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5650 | |
| 5651 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5652 | const PointerType *PFTy = 0; |
| 5653 | const FunctionType *Ty = 0; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5654 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5655 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5656 | // Pull out the types of all of the arguments... |
| 5657 | std::vector<const Type*> ParamTypes; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5658 | ParamAttrsVector Attrs; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5659 | if ((yyvsp[0].ParamAttrs) != ParamAttr::None) { |
| 5660 | ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[0].ParamAttrs); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5661 | Attrs.push_back(PAWI); |
| 5662 | } |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5663 | unsigned index = 1; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5664 | ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5665 | for (; I != E; ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5666 | const Type *Ty = I->Val->getType(); |
| 5667 | if (Ty == Type::VoidTy) |
| 5668 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5669 | ParamTypes.push_back(Ty); |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5670 | if (I->Attrs != ParamAttr::None) { |
| 5671 | ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; |
| 5672 | Attrs.push_back(PAWI); |
| 5673 | } |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5674 | } |
| 5675 | |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5676 | ParamAttrsList *PAL = 0; |
| 5677 | if (!Attrs.empty()) |
| 5678 | PAL = ParamAttrsList::get(Attrs); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5679 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5680 | Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, PAL); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5681 | PFTy = PointerType::get(Ty); |
| 5682 | } |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5683 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5684 | 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] | 5685 | CHECK_FOR_ERROR |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5686 | |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 5687 | // Check for call to invalid intrinsic to avoid crashing later. |
| 5688 | if (Function *theF = dyn_cast<Function>(V)) { |
Reid Spencer | ed48de2 | 2007-04-16 22:02:23 +0000 | [diff] [blame] | 5689 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
Reid Spencer | 36fdde1 | 2007-04-16 20:35:38 +0000 | [diff] [blame] | 5690 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 5691 | !theF->getIntrinsicID(true)) |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 5692 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 5693 | theF->getName() + "'"); |
| 5694 | } |
| 5695 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5696 | // Check the arguments |
| 5697 | ValueList Args; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5698 | if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5699 | // Make sure no arguments is a good thing! |
| 5700 | if (Ty->getNumParams() != 0) |
| 5701 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5702 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5703 | } else { // Has arguments? |
| 5704 | // Loop through FunctionType's arguments and ensure they are specified |
| 5705 | // correctly! |
| 5706 | // |
| 5707 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5708 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5709 | ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5710 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5711 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5712 | if (ArgI->Val->getType() != *I) |
| 5713 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5714 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5715 | Args.push_back(ArgI->Val); |
| 5716 | } |
| 5717 | if (Ty->isVarArg()) { |
| 5718 | if (I == E) |
| 5719 | for (; ArgI != ArgE; ++ArgI) |
| 5720 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5721 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5722 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5723 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5724 | // Create the call node |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5725 | CallInst *CI = new CallInst(V, &Args[0], Args.size()); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5726 | CI->setTailCall((yyvsp[-7].BoolVal)); |
| 5727 | CI->setCallingConv((yyvsp[-6].UIntVal)); |
| 5728 | (yyval.InstVal) = CI; |
| 5729 | delete (yyvsp[-2].ValueRefList); |
| 5730 | delete (yyvsp[-5].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5731 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5732 | ;} |
| 5733 | break; |
| 5734 | |
| 5735 | case 288: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5736 | #line 2963 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5737 | { |
| 5738 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5739 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5740 | ;} |
| 5741 | break; |
| 5742 | |
| 5743 | case 289: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5744 | #line 2968 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5745 | { |
| 5746 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5747 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5748 | ;} |
| 5749 | break; |
| 5750 | |
| 5751 | case 290: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5752 | #line 2972 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5753 | { |
| 5754 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5755 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5756 | ;} |
| 5757 | break; |
| 5758 | |
| 5759 | case 291: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5760 | #line 2979 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5761 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5762 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5763 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5764 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5765 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5766 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5767 | ;} |
| 5768 | break; |
| 5769 | |
| 5770 | case 292: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5771 | #line 2986 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5772 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5773 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5774 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5775 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5776 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5777 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5778 | delete (yyvsp[-4].TypeVal); |
| 5779 | ;} |
| 5780 | break; |
| 5781 | |
| 5782 | case 293: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5783 | #line 2994 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5784 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5785 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5786 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5787 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5788 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5789 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5790 | ;} |
| 5791 | break; |
| 5792 | |
| 5793 | case 294: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5794 | #line 3001 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5795 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5796 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5797 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5798 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5799 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5800 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5801 | delete (yyvsp[-4].TypeVal); |
| 5802 | ;} |
| 5803 | break; |
| 5804 | |
| 5805 | case 295: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5806 | #line 3009 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5807 | { |
| 5808 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5809 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5810 | (yyvsp[0].ValueVal)->getType()->getDescription() + ""); |
| 5811 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5812 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5813 | ;} |
| 5814 | break; |
| 5815 | |
| 5816 | case 296: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5817 | #line 3017 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5818 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5819 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5820 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5821 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5822 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5823 | (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5824 | if (!cast<PointerType>((yyvsp[-2].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5825 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5826 | (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5827 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5828 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5829 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-4].BoolVal), (yyvsp[0].UIntVal)); |
| 5830 | delete (yyvsp[-2].TypeVal); |
| 5831 | ;} |
| 5832 | break; |
| 5833 | |
| 5834 | case 297: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5835 | #line 3031 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5836 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5837 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5838 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5839 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5840 | if (!PT) |
| 5841 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5842 | (*(yyvsp[-2].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5843 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5844 | if (ElTy != (yyvsp[-4].ValueVal)->getType()) |
| 5845 | GEN_ERROR("Can't store '" + (yyvsp[-4].ValueVal)->getType()->getDescription() + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5846 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 5847 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5848 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5849 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5850 | (yyval.InstVal) = new StoreInst((yyvsp[-4].ValueVal), tmpVal, (yyvsp[-6].BoolVal), (yyvsp[0].UIntVal)); |
| 5851 | delete (yyvsp[-2].TypeVal); |
| 5852 | ;} |
| 5853 | break; |
| 5854 | |
| 5855 | case 298: |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5856 | #line 3048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5857 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5858 | if (!UpRefs.empty()) |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5859 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5860 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5861 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5862 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5863 | 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] | 5864 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5865 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'"); |
| 5866 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5867 | CHECK_FOR_ERROR |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5868 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size()); |
| 5869 | delete (yyvsp[-2].TypeVal); |
| 5870 | delete (yyvsp[0].ValueList); |
| 5871 | ;} |
| 5872 | break; |
| 5873 | |
| 5874 | |
| 5875 | default: break; |
| 5876 | } |
| 5877 | |
| 5878 | /* Line 1126 of yacc.c. */ |
| 5879 | #line 5880 "llvmAsmParser.tab.c" |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5880 | |
| 5881 | yyvsp -= yylen; |
| 5882 | yyssp -= yylen; |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 5883 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5884 | |
| 5885 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5886 | |
| 5887 | *++yyvsp = yyval; |
| 5888 | |
| 5889 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5890 | /* Now `shift' the result of the reduction. Determine what state |
| 5891 | that goes to, based on the state we popped back to and the rule |
| 5892 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5893 | |
| 5894 | yyn = yyr1[yyn]; |
| 5895 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5896 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5897 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5898 | yystate = yytable[yystate]; |
| 5899 | else |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5900 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5901 | |
| 5902 | goto yynewstate; |
| 5903 | |
| 5904 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5905 | /*------------------------------------. |
| 5906 | | yyerrlab -- here on detecting error | |
| 5907 | `------------------------------------*/ |
| 5908 | yyerrlab: |
| 5909 | /* If not already recovering from an error, report this error. */ |
| 5910 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5911 | { |
| 5912 | ++yynerrs; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5913 | #if YYERROR_VERBOSE |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5914 | yyn = yypact[yystate]; |
| 5915 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5916 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5917 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5918 | int yytype = YYTRANSLATE (yychar); |
| 5919 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5920 | YYSIZE_T yysize = yysize0; |
| 5921 | YYSIZE_T yysize1; |
| 5922 | int yysize_overflow = 0; |
| 5923 | char *yymsg = 0; |
| 5924 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5925 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5926 | int yyx; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5927 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5928 | #if 0 |
| 5929 | /* This is so xgettext sees the translatable formats that are |
| 5930 | constructed on the fly. */ |
| 5931 | YY_("syntax error, unexpected %s"); |
| 5932 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5933 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5934 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5935 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5936 | #endif |
| 5937 | char *yyfmt; |
| 5938 | char const *yyf; |
| 5939 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5940 | static char const yyexpecting[] = ", expecting %s"; |
| 5941 | static char const yyor[] = " or %s"; |
| 5942 | char yyformat[sizeof yyunexpected |
| 5943 | + sizeof yyexpecting - 1 |
| 5944 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5945 | * (sizeof yyor - 1))]; |
| 5946 | char const *yyprefix = yyexpecting; |
| 5947 | |
| 5948 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5949 | YYCHECK. */ |
| 5950 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5951 | |
| 5952 | /* Stay within bounds of both yycheck and yytname. */ |
| 5953 | int yychecklim = YYLAST - yyn; |
| 5954 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5955 | int yycount = 1; |
| 5956 | |
| 5957 | yyarg[0] = yytname[yytype]; |
| 5958 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5959 | |
| 5960 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5961 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5962 | { |
| 5963 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 5964 | { |
| 5965 | yycount = 1; |
| 5966 | yysize = yysize0; |
| 5967 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 5968 | break; |
| 5969 | } |
| 5970 | yyarg[yycount++] = yytname[yyx]; |
| 5971 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5972 | yysize_overflow |= yysize1 < yysize; |
| 5973 | yysize = yysize1; |
| 5974 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5975 | yyprefix = yyor; |
| 5976 | } |
| 5977 | |
| 5978 | yyf = YY_(yyformat); |
| 5979 | yysize1 = yysize + yystrlen (yyf); |
| 5980 | yysize_overflow |= yysize1 < yysize; |
| 5981 | yysize = yysize1; |
| 5982 | |
| 5983 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5984 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5985 | if (yymsg) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5986 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5987 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5988 | Don't have undefined behavior even if the translation |
| 5989 | produced a string with the wrong number of "%s"s. */ |
| 5990 | char *yyp = yymsg; |
| 5991 | int yyi = 0; |
| 5992 | while ((*yyp = *yyf)) |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 5993 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 5994 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5995 | { |
| 5996 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5997 | yyf += 2; |
| 5998 | } |
| 5999 | else |
| 6000 | { |
| 6001 | yyp++; |
| 6002 | yyf++; |
| 6003 | } |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6004 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6005 | yyerror (yymsg); |
| 6006 | YYSTACK_FREE (yymsg); |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6007 | } |
| 6008 | else |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6009 | { |
| 6010 | yyerror (YY_("syntax error")); |
| 6011 | goto yyexhaustedlab; |
| 6012 | } |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6013 | } |
| 6014 | else |
| 6015 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6016 | yyerror (YY_("syntax error")); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6017 | } |
| 6018 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6019 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6020 | |
| 6021 | if (yyerrstatus == 3) |
| 6022 | { |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6023 | /* If just tried and failed to reuse look-ahead token after an |
| 6024 | error, discard it. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6025 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6026 | if (yychar <= YYEOF) |
| 6027 | { |
| 6028 | /* Return failure if at end of input. */ |
| 6029 | if (yychar == YYEOF) |
| 6030 | YYABORT; |
| 6031 | } |
| 6032 | else |
| 6033 | { |
| 6034 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 6035 | yychar = YYEMPTY; |
| 6036 | } |
| 6037 | } |
| 6038 | |
| 6039 | /* Else will try to reuse look-ahead token after shifting the error |
| 6040 | token. */ |
| 6041 | goto yyerrlab1; |
| 6042 | |
| 6043 | |
| 6044 | /*---------------------------------------------------. |
| 6045 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 6046 | `---------------------------------------------------*/ |
| 6047 | yyerrorlab: |
| 6048 | |
| 6049 | /* Pacify compilers like GCC when the user code never invokes |
| 6050 | YYERROR and the label yyerrorlab therefore never appears in user |
| 6051 | code. */ |
| 6052 | if (0) |
| 6053 | goto yyerrorlab; |
| 6054 | |
| 6055 | yyvsp -= yylen; |
| 6056 | yyssp -= yylen; |
| 6057 | yystate = *yyssp; |
| 6058 | goto yyerrlab1; |
| 6059 | |
| 6060 | |
| 6061 | /*-------------------------------------------------------------. |
| 6062 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 6063 | `-------------------------------------------------------------*/ |
| 6064 | yyerrlab1: |
| 6065 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 6066 | |
| 6067 | for (;;) |
| 6068 | { |
| 6069 | yyn = yypact[yystate]; |
| 6070 | if (yyn != YYPACT_NINF) |
| 6071 | { |
| 6072 | yyn += YYTERROR; |
| 6073 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 6074 | { |
| 6075 | yyn = yytable[yyn]; |
| 6076 | if (0 < yyn) |
| 6077 | break; |
| 6078 | } |
| 6079 | } |
| 6080 | |
| 6081 | /* Pop the current state because it cannot handle the error token. */ |
| 6082 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6083 | YYABORT; |
| 6084 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6085 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6086 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 6087 | YYPOPSTACK; |
| 6088 | yystate = *yyssp; |
| 6089 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6090 | } |
| 6091 | |
| 6092 | if (yyn == YYFINAL) |
| 6093 | YYACCEPT; |
| 6094 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6095 | *++yyvsp = yylval; |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6096 | |
| 6097 | |
| 6098 | /* Shift the error token. */ |
| 6099 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6100 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6101 | yystate = yyn; |
| 6102 | goto yynewstate; |
| 6103 | |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6104 | |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6105 | /*-------------------------------------. |
| 6106 | | yyacceptlab -- YYACCEPT comes here. | |
| 6107 | `-------------------------------------*/ |
| 6108 | yyacceptlab: |
| 6109 | yyresult = 0; |
| 6110 | goto yyreturn; |
| 6111 | |
| 6112 | /*-----------------------------------. |
| 6113 | | yyabortlab -- YYABORT comes here. | |
| 6114 | `-----------------------------------*/ |
| 6115 | yyabortlab: |
| 6116 | yyresult = 1; |
| 6117 | goto yyreturn; |
| 6118 | |
| 6119 | #ifndef yyoverflow |
| 6120 | /*-------------------------------------------------. |
| 6121 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 6122 | `-------------------------------------------------*/ |
| 6123 | yyexhaustedlab: |
| 6124 | yyerror (YY_("memory exhausted")); |
| 6125 | yyresult = 2; |
| 6126 | /* Fall through. */ |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 6127 | #endif |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6128 | |
| 6129 | yyreturn: |
| 6130 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 6131 | yydestruct ("Cleanup: discarding lookahead", |
| 6132 | yytoken, &yylval); |
| 6133 | while (yyssp != yyss) |
| 6134 | { |
| 6135 | yydestruct ("Cleanup: popping", |
| 6136 | yystos[*yyssp], yyvsp); |
| 6137 | YYPOPSTACK; |
Chris Lattner | 39b2e8b | 2007-05-04 04:01:37 +0000 | [diff] [blame] | 6138 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6139 | #ifndef yyoverflow |
| 6140 | if (yyss != yyssa) |
| 6141 | YYSTACK_FREE (yyss); |
| 6142 | #endif |
| 6143 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6144 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6145 | |
| 6146 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 6147 | #line 3065 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6148 | |
| 6149 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6150 | // common code from the two 'RunVMAsmParser' functions |
| 6151 | static Module* RunParser(Module * M) { |
| 6152 | |
| 6153 | llvmAsmlineno = 1; // Reset the current line number... |
| 6154 | CurModule.CurrentModule = M; |
| 6155 | #if YYDEBUG |
| 6156 | yydebug = Debug; |
| 6157 | #endif |
| 6158 | |
| 6159 | // Check to make sure the parser succeeded |
| 6160 | if (yyparse()) { |
| 6161 | if (ParserResult) |
| 6162 | delete ParserResult; |
| 6163 | return 0; |
| 6164 | } |
| 6165 | |
Reid Spencer | 0d60b5a | 2007-03-30 01:37:39 +0000 | [diff] [blame] | 6166 | // Emit an error if there are any unresolved types left. |
| 6167 | if (!CurModule.LateResolveTypes.empty()) { |
| 6168 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 6169 | if (DID.Type == ValID::LocalName) { |
| 6170 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 6171 | } else { |
| 6172 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 6173 | } |
| 6174 | if (ParserResult) |
| 6175 | delete ParserResult; |
| 6176 | return 0; |
| 6177 | } |
| 6178 | |
| 6179 | // Emit an error if there are any unresolved values left. |
| 6180 | if (!CurModule.LateResolveValues.empty()) { |
| 6181 | Value *V = CurModule.LateResolveValues.back(); |
| 6182 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 6183 | CurModule.PlaceHolderInfo.find(V); |
| 6184 | |
| 6185 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 6186 | ValID &DID = I->second.first; |
| 6187 | if (DID.Type == ValID::LocalName) { |
| 6188 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 6189 | } else { |
| 6190 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 6191 | } |
| 6192 | if (ParserResult) |
| 6193 | delete ParserResult; |
| 6194 | return 0; |
| 6195 | } |
| 6196 | } |
| 6197 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6198 | // Check to make sure that parsing produced a result |
| 6199 | if (!ParserResult) |
| 6200 | return 0; |
| 6201 | |
| 6202 | // Reset ParserResult variable while saving its value for the result. |
| 6203 | Module *Result = ParserResult; |
| 6204 | ParserResult = 0; |
| 6205 | |
| 6206 | return Result; |
| 6207 | } |
| 6208 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6209 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 6210 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 6211 | // TODO: column number in exception |
| 6212 | if (TheParseError) |
| 6213 | TheParseError->setError(CurFilename, message, LineNo); |
| 6214 | TriggerError = 1; |
| 6215 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6216 | |
| 6217 | int yyerror(const char *ErrorMsg) { |
| 6218 | std::string where |
| 6219 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 6220 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 6221 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
| 6222 | if (yychar != YYEMPTY && yychar != 0) |
| 6223 | errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ |
| 6224 | "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6225 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6226 | return 0; |
| 6227 | } |
Reid Spencer | ed951ea | 2007-05-19 07:22:10 +0000 | [diff] [blame] | 6228 | |