Reid Spencer | 832254e | 2007-02-02 02:16:23 +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 | 832254e | 2007-02-02 02:16:23 +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 | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 5 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +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 | 832254e | 2007-02-02 02:16:23 +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 | 832254e | 2007-02-02 02:16:23 +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 | 832254e | 2007-02-02 02:16:23 +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 | 832254e | 2007-02-02 02:16:23 +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 | LOCALVAL_ID = 260, |
| 70 | GLOBALVAL_ID = 261, |
| 71 | FPVAL = 262, |
| 72 | VOID = 263, |
| 73 | INTTYPE = 264, |
| 74 | FLOAT = 265, |
| 75 | DOUBLE = 266, |
| 76 | LABEL = 267, |
| 77 | TYPE = 268, |
| 78 | LOCALVAR = 269, |
| 79 | GLOBALVAR = 270, |
| 80 | LABELSTR = 271, |
| 81 | STRINGCONSTANT = 272, |
| 82 | ATSTRINGCONSTANT = 273, |
| 83 | IMPLEMENTATION = 274, |
| 84 | ZEROINITIALIZER = 275, |
| 85 | TRUETOK = 276, |
| 86 | FALSETOK = 277, |
| 87 | BEGINTOK = 278, |
| 88 | ENDTOK = 279, |
| 89 | DECLARE = 280, |
| 90 | DEFINE = 281, |
| 91 | GLOBAL = 282, |
| 92 | CONSTANT = 283, |
| 93 | SECTION = 284, |
| 94 | VOLATILE = 285, |
| 95 | TO = 286, |
| 96 | DOTDOTDOT = 287, |
| 97 | NULL_TOK = 288, |
| 98 | UNDEF = 289, |
| 99 | INTERNAL = 290, |
| 100 | LINKONCE = 291, |
| 101 | WEAK = 292, |
| 102 | APPENDING = 293, |
| 103 | DLLIMPORT = 294, |
| 104 | DLLEXPORT = 295, |
| 105 | EXTERN_WEAK = 296, |
| 106 | OPAQUE = 297, |
| 107 | EXTERNAL = 298, |
| 108 | TARGET = 299, |
| 109 | TRIPLE = 300, |
| 110 | ALIGN = 301, |
| 111 | DEPLIBS = 302, |
| 112 | CALL = 303, |
| 113 | TAIL = 304, |
| 114 | ASM_TOK = 305, |
| 115 | MODULE = 306, |
| 116 | SIDEEFFECT = 307, |
| 117 | CC_TOK = 308, |
| 118 | CCC_TOK = 309, |
| 119 | FASTCC_TOK = 310, |
| 120 | COLDCC_TOK = 311, |
| 121 | X86_STDCALLCC_TOK = 312, |
| 122 | X86_FASTCALLCC_TOK = 313, |
| 123 | DATALAYOUT = 314, |
| 124 | RET = 315, |
| 125 | BR = 316, |
| 126 | SWITCH = 317, |
| 127 | INVOKE = 318, |
| 128 | UNWIND = 319, |
| 129 | UNREACHABLE = 320, |
| 130 | ADD = 321, |
| 131 | SUB = 322, |
| 132 | MUL = 323, |
| 133 | UDIV = 324, |
| 134 | SDIV = 325, |
| 135 | FDIV = 326, |
| 136 | UREM = 327, |
| 137 | SREM = 328, |
| 138 | FREM = 329, |
| 139 | AND = 330, |
| 140 | OR = 331, |
| 141 | XOR = 332, |
| 142 | SHL = 333, |
| 143 | LSHR = 334, |
| 144 | ASHR = 335, |
| 145 | ICMP = 336, |
| 146 | FCMP = 337, |
| 147 | EQ = 338, |
| 148 | NE = 339, |
| 149 | SLT = 340, |
| 150 | SGT = 341, |
| 151 | SLE = 342, |
| 152 | SGE = 343, |
| 153 | ULT = 344, |
| 154 | UGT = 345, |
| 155 | ULE = 346, |
| 156 | UGE = 347, |
| 157 | OEQ = 348, |
| 158 | ONE = 349, |
| 159 | OLT = 350, |
| 160 | OGT = 351, |
| 161 | OLE = 352, |
| 162 | OGE = 353, |
| 163 | ORD = 354, |
| 164 | UNO = 355, |
| 165 | UEQ = 356, |
| 166 | UNE = 357, |
| 167 | MALLOC = 358, |
| 168 | ALLOCA = 359, |
| 169 | FREE = 360, |
| 170 | LOAD = 361, |
| 171 | STORE = 362, |
| 172 | GETELEMENTPTR = 363, |
| 173 | TRUNC = 364, |
| 174 | ZEXT = 365, |
| 175 | SEXT = 366, |
| 176 | FPTRUNC = 367, |
| 177 | FPEXT = 368, |
| 178 | BITCAST = 369, |
| 179 | UITOFP = 370, |
| 180 | SITOFP = 371, |
| 181 | FPTOUI = 372, |
| 182 | FPTOSI = 373, |
| 183 | INTTOPTR = 374, |
| 184 | PTRTOINT = 375, |
| 185 | PHI_TOK = 376, |
| 186 | SELECT = 377, |
| 187 | VAARG = 378, |
| 188 | EXTRACTELEMENT = 379, |
| 189 | INSERTELEMENT = 380, |
| 190 | SHUFFLEVECTOR = 381, |
| 191 | NORETURN = 382, |
| 192 | INREG = 383, |
| 193 | SRET = 384, |
| 194 | DEFAULT = 385, |
| 195 | HIDDEN = 386 |
| 196 | }; |
| 197 | #endif |
| 198 | /* Tokens. */ |
| 199 | #define ESINT64VAL 258 |
| 200 | #define EUINT64VAL 259 |
| 201 | #define LOCALVAL_ID 260 |
| 202 | #define GLOBALVAL_ID 261 |
| 203 | #define FPVAL 262 |
| 204 | #define VOID 263 |
| 205 | #define INTTYPE 264 |
| 206 | #define FLOAT 265 |
| 207 | #define DOUBLE 266 |
| 208 | #define LABEL 267 |
| 209 | #define TYPE 268 |
| 210 | #define LOCALVAR 269 |
| 211 | #define GLOBALVAR 270 |
| 212 | #define LABELSTR 271 |
| 213 | #define STRINGCONSTANT 272 |
| 214 | #define ATSTRINGCONSTANT 273 |
| 215 | #define IMPLEMENTATION 274 |
| 216 | #define ZEROINITIALIZER 275 |
| 217 | #define TRUETOK 276 |
| 218 | #define FALSETOK 277 |
| 219 | #define BEGINTOK 278 |
| 220 | #define ENDTOK 279 |
| 221 | #define DECLARE 280 |
| 222 | #define DEFINE 281 |
| 223 | #define GLOBAL 282 |
| 224 | #define CONSTANT 283 |
| 225 | #define SECTION 284 |
| 226 | #define VOLATILE 285 |
| 227 | #define TO 286 |
| 228 | #define DOTDOTDOT 287 |
| 229 | #define NULL_TOK 288 |
| 230 | #define UNDEF 289 |
| 231 | #define INTERNAL 290 |
| 232 | #define LINKONCE 291 |
| 233 | #define WEAK 292 |
| 234 | #define APPENDING 293 |
| 235 | #define DLLIMPORT 294 |
| 236 | #define DLLEXPORT 295 |
| 237 | #define EXTERN_WEAK 296 |
| 238 | #define OPAQUE 297 |
| 239 | #define EXTERNAL 298 |
| 240 | #define TARGET 299 |
| 241 | #define TRIPLE 300 |
| 242 | #define ALIGN 301 |
| 243 | #define DEPLIBS 302 |
| 244 | #define CALL 303 |
| 245 | #define TAIL 304 |
| 246 | #define ASM_TOK 305 |
| 247 | #define MODULE 306 |
| 248 | #define SIDEEFFECT 307 |
| 249 | #define CC_TOK 308 |
| 250 | #define CCC_TOK 309 |
| 251 | #define FASTCC_TOK 310 |
| 252 | #define COLDCC_TOK 311 |
| 253 | #define X86_STDCALLCC_TOK 312 |
| 254 | #define X86_FASTCALLCC_TOK 313 |
| 255 | #define DATALAYOUT 314 |
| 256 | #define RET 315 |
| 257 | #define BR 316 |
| 258 | #define SWITCH 317 |
| 259 | #define INVOKE 318 |
| 260 | #define UNWIND 319 |
| 261 | #define UNREACHABLE 320 |
| 262 | #define ADD 321 |
| 263 | #define SUB 322 |
| 264 | #define MUL 323 |
| 265 | #define UDIV 324 |
| 266 | #define SDIV 325 |
| 267 | #define FDIV 326 |
| 268 | #define UREM 327 |
| 269 | #define SREM 328 |
| 270 | #define FREM 329 |
| 271 | #define AND 330 |
| 272 | #define OR 331 |
| 273 | #define XOR 332 |
| 274 | #define SHL 333 |
| 275 | #define LSHR 334 |
| 276 | #define ASHR 335 |
| 277 | #define ICMP 336 |
| 278 | #define FCMP 337 |
| 279 | #define EQ 338 |
| 280 | #define NE 339 |
| 281 | #define SLT 340 |
| 282 | #define SGT 341 |
| 283 | #define SLE 342 |
| 284 | #define SGE 343 |
| 285 | #define ULT 344 |
| 286 | #define UGT 345 |
| 287 | #define ULE 346 |
| 288 | #define UGE 347 |
| 289 | #define OEQ 348 |
| 290 | #define ONE 349 |
| 291 | #define OLT 350 |
| 292 | #define OGT 351 |
| 293 | #define OLE 352 |
| 294 | #define OGE 353 |
| 295 | #define ORD 354 |
| 296 | #define UNO 355 |
| 297 | #define UEQ 356 |
| 298 | #define UNE 357 |
| 299 | #define MALLOC 358 |
| 300 | #define ALLOCA 359 |
| 301 | #define FREE 360 |
| 302 | #define LOAD 361 |
| 303 | #define STORE 362 |
| 304 | #define GETELEMENTPTR 363 |
| 305 | #define TRUNC 364 |
| 306 | #define ZEXT 365 |
| 307 | #define SEXT 366 |
| 308 | #define FPTRUNC 367 |
| 309 | #define FPEXT 368 |
| 310 | #define BITCAST 369 |
| 311 | #define UITOFP 370 |
| 312 | #define SITOFP 371 |
| 313 | #define FPTOUI 372 |
| 314 | #define FPTOSI 373 |
| 315 | #define INTTOPTR 374 |
| 316 | #define PTRTOINT 375 |
| 317 | #define PHI_TOK 376 |
| 318 | #define SELECT 377 |
| 319 | #define VAARG 378 |
| 320 | #define EXTRACTELEMENT 379 |
| 321 | #define INSERTELEMENT 380 |
| 322 | #define SHUFFLEVECTOR 381 |
| 323 | #define NORETURN 382 |
| 324 | #define INREG 383 |
| 325 | #define SRET 384 |
| 326 | #define DEFAULT 385 |
| 327 | #define HIDDEN 386 |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | /* Copy the first part of user declarations. */ |
| 333 | #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 334 | |
| 335 | #include "ParserInternals.h" |
| 336 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 337 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 338 | #include "llvm/Instructions.h" |
| 339 | #include "llvm/Module.h" |
| 340 | #include "llvm/SymbolTable.h" |
| 341 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 342 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 343 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 344 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 345 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 346 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 347 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 348 | #include <list> |
| 349 | #include <utility> |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 350 | #ifndef NDEBUG |
| 351 | #define YYDEBUG 1 |
| 352 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 353 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 354 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 355 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 356 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 357 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 358 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 359 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 360 | // GenerateError are made from inside productions and they must simulate the |
| 361 | // previous exception behavior by exiting the production immediately. We have |
| 362 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 363 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 364 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 365 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 366 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 367 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 368 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 369 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 370 | int yylex(); // declaration" of xxx warnings. |
| 371 | int yyparse(); |
| 372 | |
| 373 | namespace llvm { |
| 374 | std::string CurFilename; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 375 | #if YYDEBUG |
| 376 | static cl::opt<bool> |
| 377 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), |
| 378 | cl::Hidden, cl::init(false)); |
| 379 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 380 | } |
| 381 | using namespace llvm; |
| 382 | |
| 383 | static Module *ParserResult; |
| 384 | |
| 385 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 386 | // relating to upreferences in the input stream. |
| 387 | // |
| 388 | //#define DEBUG_UPREFS 1 |
| 389 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 390 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 391 | #else |
| 392 | #define UR_OUT(X) |
| 393 | #endif |
| 394 | |
| 395 | #define YYERROR_VERBOSE 1 |
| 396 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 397 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 398 | |
| 399 | |
| 400 | // This contains info used when building the body of a function. It is |
| 401 | // destroyed when the function is completed. |
| 402 | // |
| 403 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 404 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 405 | static void |
| 406 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 407 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 408 | |
| 409 | static struct PerModuleInfo { |
| 410 | Module *CurrentModule; |
| 411 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 412 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 413 | std::vector<PATypeHolder> Types; |
| 414 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 415 | |
| 416 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 417 | /// 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] | 418 | /// that we can resolve them later and print error messages as appropriate. |
| 419 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 420 | |
| 421 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 422 | // references to global values. Global values may be referenced before they |
| 423 | // are defined, and if so, the temporary object that they represent is held |
| 424 | // here. This is used for forward references of GlobalValues. |
| 425 | // |
| 426 | typedef std::map<std::pair<const PointerType *, |
| 427 | ValID>, GlobalValue*> GlobalRefsType; |
| 428 | GlobalRefsType GlobalRefs; |
| 429 | |
| 430 | void ModuleDone() { |
| 431 | // If we could not resolve some functions at function compilation time |
| 432 | // (calls to functions before they are defined), resolve them now... Types |
| 433 | // are resolved when the constant pool has been completely parsed. |
| 434 | // |
| 435 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 436 | if (TriggerError) |
| 437 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 438 | |
| 439 | // Check to make sure that all global value forward references have been |
| 440 | // resolved! |
| 441 | // |
| 442 | if (!GlobalRefs.empty()) { |
| 443 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 444 | |
| 445 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 446 | I != E; ++I) { |
| 447 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 448 | I->first.second.getName() + "\n"; |
| 449 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 450 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 451 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | Values.clear(); // Clear out function local definitions |
| 455 | Types.clear(); |
| 456 | CurrentModule = 0; |
| 457 | } |
| 458 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 459 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 460 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 461 | // If not, just return null. |
| 462 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 463 | // Check to see if there is a forward reference to this global variable... |
| 464 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 465 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 466 | GlobalValue *Ret = 0; |
| 467 | if (I != GlobalRefs.end()) { |
| 468 | Ret = I->second; |
| 469 | GlobalRefs.erase(I); |
| 470 | } |
| 471 | return Ret; |
| 472 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 473 | |
| 474 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 475 | // If it isn't abstract, its resolved |
| 476 | const Type* Ty = PATy->get(); |
| 477 | if (!Ty->isAbstract()) |
| 478 | return false; |
| 479 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 480 | // we don't need to traverse that leg of the type. |
| 481 | std::vector<const Type*> WorkList, SeenList; |
| 482 | WorkList.push_back(Ty); |
| 483 | while (!WorkList.empty()) { |
| 484 | const Type* Ty = WorkList.back(); |
| 485 | SeenList.push_back(Ty); |
| 486 | WorkList.pop_back(); |
| 487 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 488 | // Check to see if this is an unresolved type |
| 489 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 490 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 491 | for ( ; I != E; ++I) { |
| 492 | if (I->second.get() == OpTy) |
| 493 | return true; |
| 494 | } |
| 495 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 496 | const Type* TheTy = SeqTy->getElementType(); |
| 497 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 498 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 499 | E = SeenList.end(); |
| 500 | for ( ; I != E; ++I) |
| 501 | if (*I == TheTy) |
| 502 | break; |
| 503 | if (I == E) |
| 504 | WorkList.push_back(TheTy); |
| 505 | } |
| 506 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 507 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 508 | const Type* TheTy = StrTy->getElementType(i); |
| 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 | } |
| 519 | } |
| 520 | } |
| 521 | return false; |
| 522 | } |
| 523 | |
| 524 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 525 | } CurModule; |
| 526 | |
| 527 | static struct PerFunctionInfo { |
| 528 | Function *CurrentFunction; // Pointer to current function being created |
| 529 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 530 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 531 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 532 | bool isDeclare; // Is this function a forward declararation? |
| 533 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 534 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 535 | |
| 536 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 537 | /// track of them here. |
| 538 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 539 | std::vector<BasicBlock*> NumberedBlocks; |
| 540 | unsigned NextBBNum; |
| 541 | |
| 542 | inline PerFunctionInfo() { |
| 543 | CurrentFunction = 0; |
| 544 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 545 | Linkage = GlobalValue::ExternalLinkage; |
| 546 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | inline void FunctionStart(Function *M) { |
| 550 | CurrentFunction = M; |
| 551 | NextBBNum = 0; |
| 552 | } |
| 553 | |
| 554 | void FunctionDone() { |
| 555 | NumberedBlocks.clear(); |
| 556 | |
| 557 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 558 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 559 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 560 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 561 | return; |
| 562 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 563 | |
| 564 | // Resolve all forward references now. |
| 565 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 566 | |
| 567 | Values.clear(); // Clear out function local definitions |
| 568 | CurrentFunction = 0; |
| 569 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 570 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 571 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 572 | } |
| 573 | } CurFun; // Info for the current function... |
| 574 | |
| 575 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 576 | |
| 577 | |
| 578 | //===----------------------------------------------------------------------===// |
| 579 | // Code to handle definitions of all the types |
| 580 | //===----------------------------------------------------------------------===// |
| 581 | |
| 582 | static int InsertValue(Value *V, |
| 583 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 584 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 585 | |
| 586 | // Yes, insert the value into the value table... |
| 587 | ValueList &List = ValueTab[V->getType()]; |
| 588 | List.push_back(V); |
| 589 | return List.size()-1; |
| 590 | } |
| 591 | |
| 592 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 593 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 594 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 595 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 596 | if (D.Num < CurModule.Types.size()) |
| 597 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 598 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 599 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 600 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 601 | D.destroy(); // Free old strdup'd memory... |
| 602 | return N; |
| 603 | } |
| 604 | break; |
| 605 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 606 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 607 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | // If we reached here, we referenced either a symbol that we don't know about |
| 611 | // or an id number that hasn't been read yet. We may be referencing something |
| 612 | // forward, so just create an entry to be resolved later and get to it... |
| 613 | // |
| 614 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 615 | |
| 616 | |
| 617 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 618 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 619 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 620 | return 0; |
| 621 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 622 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 623 | return 0; |
| 624 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 625 | } |
| 626 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 627 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 628 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 629 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 630 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 631 | Type *Typ = OpaqueType::get(); |
| 632 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 633 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 634 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 635 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 636 | // getValNonImprovising - Look up the value specified by the provided type and |
| 637 | // the provided ValID. If the value exists and has already been defined, return |
| 638 | // it. Otherwise return null. |
| 639 | // |
| 640 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 641 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 642 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 643 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 644 | return 0; |
| 645 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 646 | |
| 647 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 648 | case ValID::LocalID: { // Is it a numbered definition? |
| 649 | // Module constants occupy the lowest numbered slots. |
| 650 | std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty); |
| 651 | // Make sure that our type is within bounds. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 652 | if (VI == CurFun.Values.end()) return 0; |
| 653 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 654 | // Check that the number is within bounds. |
| 655 | if (D.Num >= VI->second.size()) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 656 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 657 | return VI->second[D.Num]; |
| 658 | } |
| 659 | case ValID::GlobalID: { // Is it a numbered definition? |
| 660 | unsigned Num = D.Num; |
| 661 | |
| 662 | // Module constants occupy the lowest numbered slots... |
| 663 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 664 | if (VI == CurModule.Values.end()) return 0; |
| 665 | if (D.Num >= VI->second.size()) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 666 | return VI->second[Num]; |
| 667 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 668 | |
| 669 | case ValID::LocalName: { // Is it a named definition? |
| 670 | if (!inFunctionScope()) return 0; |
| 671 | SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
| 672 | Value *N = SymTab.lookup(Ty, D.Name); |
| 673 | if (N == 0) return 0; |
| 674 | |
| 675 | D.destroy(); // Free old strdup'd memory... |
| 676 | return N; |
| 677 | } |
| 678 | case ValID::GlobalName: { // Is it a named definition? |
| 679 | SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
| 680 | Value *N = SymTab.lookup(Ty, D.Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 681 | if (N == 0) return 0; |
| 682 | |
| 683 | D.destroy(); // Free old strdup'd memory... |
| 684 | return N; |
| 685 | } |
| 686 | |
| 687 | // Check to make sure that "Ty" is an integral type, and that our |
| 688 | // value will fit into the specified type... |
| 689 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 690 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 691 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 692 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 693 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 694 | return 0; |
| 695 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 696 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 697 | |
| 698 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 699 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 700 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 701 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 702 | "' is invalid or out of range"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 703 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 704 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 705 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 706 | } |
| 707 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 708 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 709 | } |
| 710 | |
| 711 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 712 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 713 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 714 | return 0; |
| 715 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 716 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 717 | |
| 718 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 719 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 720 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 721 | return 0; |
| 722 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 723 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 724 | |
| 725 | case ValID::ConstUndefVal: // Is it an undef value? |
| 726 | return UndefValue::get(Ty); |
| 727 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 728 | case ValID::ConstZeroVal: // Is it a zero value? |
| 729 | return Constant::getNullValue(Ty); |
| 730 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 731 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 732 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 733 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 734 | return 0; |
| 735 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 736 | return D.ConstantValue; |
| 737 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 738 | case ValID::InlineAsmVal: { // Inline asm expression |
| 739 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 740 | const FunctionType *FTy = |
| 741 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 742 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 743 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 744 | return 0; |
| 745 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 746 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 747 | D.IAD->HasSideEffects); |
| 748 | D.destroy(); // Free InlineAsmDescriptor. |
| 749 | return IA; |
| 750 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 751 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 752 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 753 | return 0; |
| 754 | } // End of switch |
| 755 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 756 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 757 | return 0; |
| 758 | } |
| 759 | |
| 760 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 761 | // value is not already defined, it "improvises" by creating a placeholder var |
| 762 | // that looks and acts just like the requested variable. When the value is |
| 763 | // defined later, all uses of the placeholder variable are replaced with the |
| 764 | // real thing. |
| 765 | // |
| 766 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 767 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 768 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 769 | return 0; |
| 770 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 771 | |
| 772 | // See if the value has already been defined. |
| 773 | Value *V = getValNonImprovising(Ty, ID); |
| 774 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 775 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 776 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 777 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 778 | GenerateError("Invalid use of a composite type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 779 | return 0; |
| 780 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 781 | |
| 782 | // If we reached here, we referenced either a symbol that we don't know about |
| 783 | // or an id number that hasn't been read yet. We may be referencing something |
| 784 | // forward, so just create an entry to be resolved later and get to it... |
| 785 | // |
| 786 | V = new Argument(Ty); |
| 787 | |
| 788 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 789 | // to recycle these things?? |
| 790 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 791 | llvmAsmlineno))); |
| 792 | |
| 793 | if (inFunctionScope()) |
| 794 | InsertValue(V, CurFun.LateResolveValues); |
| 795 | else |
| 796 | InsertValue(V, CurModule.LateResolveValues); |
| 797 | return V; |
| 798 | } |
| 799 | |
| 800 | /// getBBVal - This is used for two purposes: |
| 801 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 802 | /// defined. |
| 803 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 804 | /// or may not be a forward reference. |
| 805 | /// |
| 806 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 807 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 808 | |
| 809 | std::string Name; |
| 810 | BasicBlock *BB = 0; |
| 811 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 812 | default: |
| 813 | GenerateError("Illegal label reference " + ID.getName()); |
| 814 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 815 | case ValID::LocalID: // Is it a numbered definition? |
| 816 | if (ID.Num >= CurFun.NumberedBlocks.size()) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 817 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 818 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 819 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 820 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 821 | Name = ID.Name; |
| 822 | if (Value *N = CurFun.CurrentFunction-> |
Reid Spencer | 78d033e | 2007-01-06 07:24:44 +0000 | [diff] [blame] | 823 | getValueSymbolTable().lookup(Type::LabelTy, Name)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 824 | BB = cast<BasicBlock>(N); |
| 825 | break; |
| 826 | } |
| 827 | |
| 828 | // See if the block has already been defined. |
| 829 | if (BB) { |
| 830 | // If this is the definition of the block, make sure the existing value was |
| 831 | // just a forward reference. If it was a forward reference, there will be |
| 832 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 833 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 834 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 835 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 836 | return 0; |
| 837 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 838 | |
| 839 | ID.destroy(); // Free strdup'd memory. |
| 840 | return BB; |
| 841 | } |
| 842 | |
| 843 | // Otherwise this block has not been seen before. |
| 844 | BB = new BasicBlock("", CurFun.CurrentFunction); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 845 | if (ID.Type == ValID::LocalName) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 846 | BB->setName(ID.Name); |
| 847 | } else { |
| 848 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 849 | } |
| 850 | |
| 851 | // If this is not a definition, keep track of it so we can use it as a forward |
| 852 | // reference. |
| 853 | if (!isDefinition) { |
| 854 | // Remember where this forward reference came from. |
| 855 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 856 | } else { |
| 857 | // The forward declaration could have been inserted anywhere in the |
| 858 | // function: insert it into the correct place now. |
| 859 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 860 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 861 | } |
| 862 | ID.destroy(); |
| 863 | return BB; |
| 864 | } |
| 865 | |
| 866 | |
| 867 | //===----------------------------------------------------------------------===// |
| 868 | // Code to handle forward references in instructions |
| 869 | //===----------------------------------------------------------------------===// |
| 870 | // |
| 871 | // This code handles the late binding needed with statements that reference |
| 872 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 873 | // a loop body. |
| 874 | // |
| 875 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 876 | // and back patchs after we are done. |
| 877 | // |
| 878 | |
| 879 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 880 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 881 | // defs now... |
| 882 | // |
| 883 | static void |
| 884 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 885 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 886 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 887 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 888 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 889 | ValueList &List = LRI->second; |
| 890 | while (!List.empty()) { |
| 891 | Value *V = List.back(); |
| 892 | List.pop_back(); |
| 893 | |
| 894 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 895 | CurModule.PlaceHolderInfo.find(V); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 896 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 897 | |
| 898 | ValID &DID = PHI->second.first; |
| 899 | |
| 900 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 901 | if (TriggerError) |
| 902 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 903 | if (TheRealValue) { |
| 904 | V->replaceAllUsesWith(TheRealValue); |
| 905 | delete V; |
| 906 | CurModule.PlaceHolderInfo.erase(PHI); |
| 907 | } else if (FutureLateResolvers) { |
| 908 | // Functions have their unresolved items forwarded to the module late |
| 909 | // resolver table |
| 910 | InsertValue(V, *FutureLateResolvers); |
| 911 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 912 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 913 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 914 | "' of type '" + V->getType()->getDescription() + "'", |
| 915 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 916 | return; |
| 917 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 918 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 919 | itostr(DID.Num) + " of type '" + |
| 920 | V->getType()->getDescription() + "'", |
| 921 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 922 | return; |
| 923 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 924 | } |
| 925 | } |
| 926 | } |
| 927 | |
| 928 | LateResolvers.clear(); |
| 929 | } |
| 930 | |
| 931 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 932 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 933 | // refering to the number can be resolved. Do this now. |
| 934 | // |
| 935 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 936 | ValID D; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 937 | if (Name) D = ValID::createLocalName(Name); |
| 938 | else D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 939 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 940 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 941 | CurModule.LateResolveTypes.find(D); |
| 942 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 943 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 944 | CurModule.LateResolveTypes.erase(I); |
| 945 | } |
| 946 | } |
| 947 | |
| 948 | // setValueName - Set the specified value to the name given. The name may be |
| 949 | // null potentially, in which case this is a noop. The string passed in is |
| 950 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 951 | // |
| 952 | static void setValueName(Value *V, char *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 953 | if (!NameStr) return; |
| 954 | std::string Name(NameStr); // Copy string |
| 955 | free(NameStr); // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 956 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 957 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 958 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 959 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 960 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 961 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 962 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 963 | SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 964 | if (ST.lookup(V->getType(), Name)) { |
| 965 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 966 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 967 | return; |
| 968 | } |
| 969 | |
| 970 | // Set the name. |
| 971 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 972 | } |
| 973 | |
| 974 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 975 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 976 | static GlobalVariable * |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 977 | ParseGlobalVariable(char *NameStr, |
| 978 | GlobalValue::LinkageTypes Linkage, |
| 979 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 980 | bool isConstantGlobal, const Type *Ty, |
| 981 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 982 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 983 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 984 | return 0; |
| 985 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 986 | |
| 987 | const PointerType *PTy = PointerType::get(Ty); |
| 988 | |
| 989 | std::string Name; |
| 990 | if (NameStr) { |
| 991 | Name = NameStr; // Copy string |
| 992 | free(NameStr); // Free old string |
| 993 | } |
| 994 | |
| 995 | // See if this global value was forward referenced. If so, recycle the |
| 996 | // object. |
| 997 | ValID ID; |
| 998 | if (!Name.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 999 | ID = ValID::createGlobalName((char*)Name.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1000 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1001 | ID = ValID::createGlobalID(CurModule.Values[PTy].size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1005 | // Move the global to the end of the list, from whereever it was |
| 1006 | // previously inserted. |
| 1007 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1008 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1009 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1010 | GV->setInitializer(Initializer); |
| 1011 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1012 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1013 | GV->setConstant(isConstantGlobal); |
| 1014 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1015 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1016 | } |
| 1017 | |
| 1018 | // If this global has a name, check to see if there is already a definition |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1019 | // of this global in the module. If so, it is an error. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1020 | if (!Name.empty()) { |
| 1021 | // We are a simple redefinition of a value, check to see if it is defined |
| 1022 | // the same as the old one. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1023 | if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1024 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1025 | "' of type '" + Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1026 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | // Otherwise there is no existing GV to use, create one now. |
| 1031 | GlobalVariable *GV = |
| 1032 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1033 | CurModule.CurrentModule); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1034 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1035 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1036 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1037 | } |
| 1038 | |
| 1039 | // setTypeName - Set the specified type to the name given. The name may be |
| 1040 | // null potentially, in which case this is a noop. The string passed in is |
| 1041 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1042 | // |
| 1043 | // This function returns true if the type has already been defined, but is |
| 1044 | // allowed to be redefined in the specified context. If the name is a new name |
| 1045 | // for the type plane, it is inserted and false is returned. |
| 1046 | static bool setTypeName(const Type *T, char *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 1047 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1048 | if (NameStr == 0) return false; |
| 1049 | |
| 1050 | std::string Name(NameStr); // Copy string |
| 1051 | free(NameStr); // Free old string |
| 1052 | |
| 1053 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1054 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1055 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1056 | return false; |
| 1057 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1058 | |
| 1059 | // Set the type name, checking for conflicts as we do so. |
| 1060 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1061 | |
| 1062 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1063 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 1064 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1065 | |
| 1066 | // There is only one case where this is allowed: when we are refining an |
| 1067 | // opaque type. In this case, Existing will be an opaque type. |
| 1068 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1069 | // We ARE replacing an opaque type! |
| 1070 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1071 | return true; |
| 1072 | } |
| 1073 | |
| 1074 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1075 | // the redefinition is identical to the original. This will be so if |
| 1076 | // Existing and T point to the same Type object. In this one case we |
| 1077 | // allow the equivalent redefinition. |
| 1078 | if (Existing == T) return true; // Yes, it's equal. |
| 1079 | |
| 1080 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1081 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1082 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1083 | } |
| 1084 | |
| 1085 | return false; |
| 1086 | } |
| 1087 | |
| 1088 | //===----------------------------------------------------------------------===// |
| 1089 | // Code for handling upreferences in type names... |
| 1090 | // |
| 1091 | |
| 1092 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1093 | // |
| 1094 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1095 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1096 | E) != Ty->subtype_end(); |
| 1097 | } |
| 1098 | |
| 1099 | namespace { |
| 1100 | struct UpRefRecord { |
| 1101 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1102 | // this type is resolved. |
| 1103 | unsigned NestingLevel; |
| 1104 | |
| 1105 | // LastContainedTy - This is the type at the current binding level for the |
| 1106 | // type. Every time we reduce the nesting level, this gets updated. |
| 1107 | const Type *LastContainedTy; |
| 1108 | |
| 1109 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1110 | // represented with. |
| 1111 | OpaqueType *UpRefTy; |
| 1112 | |
| 1113 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1114 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1115 | }; |
| 1116 | } |
| 1117 | |
| 1118 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1119 | static std::vector<UpRefRecord> UpRefs; |
| 1120 | |
| 1121 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1122 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1123 | /// currently active types. For each type, if the up reference is contained in |
| 1124 | /// the newly completed type, we decrement the level count. When the level |
| 1125 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1126 | /// thus we can complete the cycle. |
| 1127 | /// |
| 1128 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1129 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1130 | // nothing to resolve here. |
| 1131 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1132 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1133 | PATypeHolder Ty(ty); |
| 1134 | UR_OUT("Type '" << Ty->getDescription() << |
| 1135 | "' newly formed. Resolving upreferences.\n" << |
| 1136 | UpRefs.size() << " upreferences active!\n"); |
| 1137 | |
| 1138 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1139 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1140 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1141 | // this variable. |
| 1142 | OpaqueType *TypeToResolve = 0; |
| 1143 | |
| 1144 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1145 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1146 | << UpRefs[i].second->getDescription() << ") = " |
| 1147 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1148 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1149 | // Decrement level of upreference |
| 1150 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1151 | UpRefs[i].LastContainedTy = Ty; |
| 1152 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1153 | if (Level == 0) { // Upreference should be resolved! |
| 1154 | if (!TypeToResolve) { |
| 1155 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1156 | } else { |
| 1157 | UR_OUT(" * Resolving upreference for " |
| 1158 | << UpRefs[i].second->getDescription() << "\n"; |
| 1159 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1160 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1161 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1162 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1163 | } |
| 1164 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1165 | --i; // Do not skip the next element... |
| 1166 | } |
| 1167 | } |
| 1168 | } |
| 1169 | |
| 1170 | if (TypeToResolve) { |
| 1171 | UR_OUT(" * Resolving upreference for " |
| 1172 | << UpRefs[i].second->getDescription() << "\n"; |
| 1173 | std::string OldName = TypeToResolve->getDescription()); |
| 1174 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1175 | } |
| 1176 | |
| 1177 | return Ty; |
| 1178 | } |
| 1179 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1180 | //===----------------------------------------------------------------------===// |
| 1181 | // RunVMAsmParser - Define an interface to this parser |
| 1182 | //===----------------------------------------------------------------------===// |
| 1183 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1184 | static Module* RunParser(Module * M); |
| 1185 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1186 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1187 | set_scan_file(F); |
| 1188 | |
| 1189 | CurFilename = Filename; |
| 1190 | return RunParser(new Module(CurFilename)); |
| 1191 | } |
| 1192 | |
| 1193 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1194 | set_scan_string(AsmString); |
| 1195 | |
| 1196 | CurFilename = "from_memory"; |
| 1197 | if (M == NULL) { |
| 1198 | return RunParser(new Module (CurFilename)); |
| 1199 | } else { |
| 1200 | return RunParser(M); |
| 1201 | } |
| 1202 | } |
| 1203 | |
| 1204 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1205 | |
| 1206 | /* Enabling traces. */ |
| 1207 | #ifndef YYDEBUG |
| 1208 | # define YYDEBUG 0 |
| 1209 | #endif |
| 1210 | |
| 1211 | /* Enabling verbose error messages. */ |
| 1212 | #ifdef YYERROR_VERBOSE |
| 1213 | # undef YYERROR_VERBOSE |
| 1214 | # define YYERROR_VERBOSE 1 |
| 1215 | #else |
| 1216 | # define YYERROR_VERBOSE 0 |
| 1217 | #endif |
| 1218 | |
| 1219 | /* Enabling the token table. */ |
| 1220 | #ifndef YYTOKEN_TABLE |
| 1221 | # define YYTOKEN_TABLE 0 |
| 1222 | #endif |
| 1223 | |
| 1224 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
| 1225 | #line 886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 1226 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1227 | llvm::Module *ModuleVal; |
| 1228 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1229 | llvm::BasicBlock *BasicBlockVal; |
| 1230 | llvm::TerminatorInst *TermInstVal; |
| 1231 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1232 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1233 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1234 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1235 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1236 | llvm::PATypeHolder *TypeVal; |
| 1237 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1238 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1239 | llvm::ArgListType *ArgList; |
| 1240 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1241 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1242 | llvm::ValueRefList *ValueRefList; |
| 1243 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1244 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1245 | std::list<std::pair<llvm::Value*, |
| 1246 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1247 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1248 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1249 | |
| 1250 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1251 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1252 | llvm::FunctionType::ParameterAttributes ParamAttrs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1253 | int64_t SInt64Val; |
| 1254 | uint64_t UInt64Val; |
| 1255 | int SIntVal; |
| 1256 | unsigned UIntVal; |
| 1257 | double FPVal; |
| 1258 | bool BoolVal; |
| 1259 | |
| 1260 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1261 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1262 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1263 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1264 | llvm::Instruction::TermOps TermOpVal; |
| 1265 | llvm::Instruction::MemoryOps MemOpVal; |
| 1266 | llvm::Instruction::CastOps CastOpVal; |
| 1267 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1268 | llvm::ICmpInst::Predicate IPredicate; |
| 1269 | llvm::FCmpInst::Predicate FPredicate; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1270 | } YYSTYPE; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1271 | /* Line 196 of yacc.c. */ |
| 1272 | #line 1273 "llvmAsmParser.tab.c" |
| 1273 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1274 | # define YYSTYPE_IS_DECLARED 1 |
| 1275 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1276 | #endif |
| 1277 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1278 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1279 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1280 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1281 | |
| 1282 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1283 | /* Line 219 of yacc.c. */ |
| 1284 | #line 1285 "llvmAsmParser.tab.c" |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1285 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1286 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1287 | # define YYSIZE_T __SIZE_TYPE__ |
| 1288 | #endif |
| 1289 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1290 | # define YYSIZE_T size_t |
| 1291 | #endif |
| 1292 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1293 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1294 | # define YYSIZE_T size_t |
| 1295 | #endif |
| 1296 | #if ! defined (YYSIZE_T) |
| 1297 | # define YYSIZE_T unsigned int |
| 1298 | #endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1299 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1300 | #ifndef YY_ |
| 1301 | # if YYENABLE_NLS |
| 1302 | # if ENABLE_NLS |
| 1303 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1304 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1305 | # endif |
| 1306 | # endif |
| 1307 | # ifndef YY_ |
| 1308 | # define YY_(msgid) msgid |
| 1309 | # endif |
| 1310 | #endif |
| 1311 | |
| 1312 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1313 | |
| 1314 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1315 | |
| 1316 | # ifdef YYSTACK_USE_ALLOCA |
| 1317 | # if YYSTACK_USE_ALLOCA |
| 1318 | # ifdef __GNUC__ |
| 1319 | # define YYSTACK_ALLOC __builtin_alloca |
| 1320 | # else |
| 1321 | # define YYSTACK_ALLOC alloca |
| 1322 | # if defined (__STDC__) || defined (__cplusplus) |
| 1323 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1324 | # define YYINCLUDED_STDLIB_H |
| 1325 | # endif |
| 1326 | # endif |
| 1327 | # endif |
| 1328 | # endif |
| 1329 | |
| 1330 | # ifdef YYSTACK_ALLOC |
| 1331 | /* Pacify GCC's `empty if-body' warning. */ |
| 1332 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1333 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1334 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1335 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1336 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1337 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1338 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1339 | # endif |
| 1340 | # else |
| 1341 | # define YYSTACK_ALLOC YYMALLOC |
| 1342 | # define YYSTACK_FREE YYFREE |
| 1343 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1344 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1345 | # endif |
| 1346 | # ifdef __cplusplus |
| 1347 | extern "C" { |
| 1348 | # endif |
| 1349 | # ifndef YYMALLOC |
| 1350 | # define YYMALLOC malloc |
| 1351 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1352 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1353 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1354 | # endif |
| 1355 | # endif |
| 1356 | # ifndef YYFREE |
| 1357 | # define YYFREE free |
| 1358 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1359 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1360 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1361 | # endif |
| 1362 | # endif |
| 1363 | # ifdef __cplusplus |
| 1364 | } |
| 1365 | # endif |
| 1366 | # endif |
| 1367 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1368 | |
| 1369 | |
| 1370 | #if (! defined (yyoverflow) \ |
| 1371 | && (! defined (__cplusplus) \ |
| 1372 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1373 | |
| 1374 | /* A type that is properly aligned for any stack member. */ |
| 1375 | union yyalloc |
| 1376 | { |
| 1377 | short int yyss; |
| 1378 | YYSTYPE yyvs; |
| 1379 | }; |
| 1380 | |
| 1381 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1382 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1383 | |
| 1384 | /* The size of an array large to enough to hold all stacks, each with |
| 1385 | N elements. */ |
| 1386 | # define YYSTACK_BYTES(N) \ |
| 1387 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1388 | + YYSTACK_GAP_MAXIMUM) |
| 1389 | |
| 1390 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1391 | not overlap. */ |
| 1392 | # ifndef YYCOPY |
| 1393 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1394 | # define YYCOPY(To, From, Count) \ |
| 1395 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1396 | # else |
| 1397 | # define YYCOPY(To, From, Count) \ |
| 1398 | do \ |
| 1399 | { \ |
| 1400 | YYSIZE_T yyi; \ |
| 1401 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1402 | (To)[yyi] = (From)[yyi]; \ |
| 1403 | } \ |
| 1404 | while (0) |
| 1405 | # endif |
| 1406 | # endif |
| 1407 | |
| 1408 | /* Relocate STACK from its old location to the new one. The |
| 1409 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1410 | elements in the stack, and YYPTR gives the new location of the |
| 1411 | stack. Advance YYPTR to a properly aligned location for the next |
| 1412 | stack. */ |
| 1413 | # define YYSTACK_RELOCATE(Stack) \ |
| 1414 | do \ |
| 1415 | { \ |
| 1416 | YYSIZE_T yynewbytes; \ |
| 1417 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1418 | Stack = &yyptr->Stack; \ |
| 1419 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1420 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1421 | } \ |
| 1422 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1423 | |
| 1424 | #endif |
| 1425 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1426 | #if defined (__STDC__) || defined (__cplusplus) |
| 1427 | typedef signed char yysigned_char; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1428 | #else |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1429 | typedef short int yysigned_char; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1430 | #endif |
| 1431 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1432 | /* YYFINAL -- State number of the termination state. */ |
| 1433 | #define YYFINAL 40 |
| 1434 | /* YYLAST -- Last index in YYTABLE. */ |
| 1435 | #define YYLAST 1439 |
| 1436 | |
| 1437 | /* YYNTOKENS -- Number of terminals. */ |
| 1438 | #define YYNTOKENS 146 |
| 1439 | /* YYNNTS -- Number of nonterminals. */ |
| 1440 | #define YYNNTS 78 |
| 1441 | /* YYNRULES -- Number of rules. */ |
| 1442 | #define YYNRULES 284 |
| 1443 | /* YYNRULES -- Number of states. */ |
| 1444 | #define YYNSTATES 557 |
| 1445 | |
| 1446 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1447 | #define YYUNDEFTOK 2 |
| 1448 | #define YYMAXUTOK 386 |
| 1449 | |
| 1450 | #define YYTRANSLATE(YYX) \ |
| 1451 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1452 | |
| 1453 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1454 | static const unsigned char yytranslate[] = |
| 1455 | { |
| 1456 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1457 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1458 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1459 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1460 | 136, 137, 134, 2, 133, 2, 2, 2, 2, 2, |
| 1461 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1462 | 141, 132, 142, 2, 2, 2, 2, 2, 2, 2, |
| 1463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1464 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1465 | 2, 138, 135, 140, 2, 2, 2, 2, 2, 145, |
| 1466 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1467 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1468 | 139, 2, 2, 143, 2, 144, 2, 2, 2, 2, |
| 1469 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1470 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1471 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1475 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1478 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1479 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1480 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1481 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1482 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1483 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1484 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1485 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1486 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1487 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1488 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1489 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1490 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1491 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1492 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1493 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1494 | 125, 126, 127, 128, 129, 130, 131 |
| 1495 | }; |
| 1496 | |
| 1497 | #if YYDEBUG |
| 1498 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1499 | YYRHS. */ |
| 1500 | static const unsigned short int yyprhs[] = |
| 1501 | { |
| 1502 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1503 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1504 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1505 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1506 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1507 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1508 | 119, 121, 122, 125, 126, 128, 130, 133, 134, 136, |
| 1509 | 138, 140, 142, 144, 146, 148, 150, 151, 153, 154, |
| 1510 | 156, 158, 159, 161, 163, 165, 167, 168, 170, 172, |
| 1511 | 174, 176, 178, 181, 183, 185, 187, 189, 190, 193, |
| 1512 | 195, 197, 198, 201, 202, 205, 206, 210, 213, 214, |
| 1513 | 216, 217, 221, 223, 226, 228, 230, 232, 234, 236, |
| 1514 | 238, 241, 243, 246, 252, 258, 264, 270, 274, 277, |
| 1515 | 283, 288, 291, 293, 295, 297, 301, 303, 307, 309, |
| 1516 | 310, 312, 316, 321, 325, 329, 334, 339, 343, 350, |
| 1517 | 356, 359, 362, 365, 368, 371, 374, 377, 380, 383, |
| 1518 | 386, 393, 399, 408, 415, 422, 430, 438, 445, 454, |
| 1519 | 463, 467, 469, 471, 473, 475, 476, 478, 481, 482, |
| 1520 | 486, 487, 491, 495, 497, 501, 505, 506, 513, 514, |
| 1521 | 522, 523, 531, 534, 538, 540, 544, 548, 552, 556, |
| 1522 | 558, 559, 565, 569, 571, 575, 577, 578, 588, 590, |
| 1523 | 592, 597, 599, 601, 604, 608, 609, 611, 613, 615, |
| 1524 | 617, 619, 621, 623, 625, 627, 631, 633, 639, 641, |
| 1525 | 643, 645, 647, 649, 651, 654, 657, 660, 664, 667, |
| 1526 | 668, 670, 673, 676, 680, 690, 700, 709, 724, 726, |
| 1527 | 728, 735, 741, 744, 751, 759, 763, 769, 770, 771, |
| 1528 | 775, 778, 780, 786, 792, 799, 806, 811, 818, 823, |
| 1529 | 828, 835, 842, 845, 854, 856, 858, 859, 863, 870, |
| 1530 | 874, 881, 884, 889, 896 |
| 1531 | }; |
| 1532 | |
| 1533 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1534 | static const short int yyrhs[] = |
| 1535 | { |
| 1536 | 186, 0, -1, 66, -1, 67, -1, 68, -1, 69, |
| 1537 | -1, 70, -1, 71, -1, 72, -1, 73, -1, 74, |
| 1538 | -1, 78, -1, 79, -1, 80, -1, 75, -1, 76, |
| 1539 | -1, 77, -1, 109, -1, 110, -1, 111, -1, 112, |
| 1540 | -1, 113, -1, 114, -1, 115, -1, 116, -1, 117, |
| 1541 | -1, 118, -1, 119, -1, 120, -1, 83, -1, 84, |
| 1542 | -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, |
| 1543 | -1, 90, -1, 91, -1, 92, -1, 93, -1, 94, |
| 1544 | -1, 95, -1, 96, -1, 97, -1, 98, -1, 99, |
| 1545 | -1, 100, -1, 101, -1, 102, -1, 89, -1, 90, |
| 1546 | -1, 91, -1, 92, -1, 21, -1, 22, -1, 9, |
| 1547 | -1, 10, -1, 11, -1, 14, -1, 17, -1, 154, |
| 1548 | -1, -1, 154, 132, -1, -1, 15, -1, 18, -1, |
| 1549 | 157, 132, -1, -1, 35, -1, 37, -1, 36, -1, |
| 1550 | 38, -1, 40, -1, 39, -1, 41, -1, 43, -1, |
| 1551 | -1, 131, -1, -1, 39, -1, 41, -1, -1, 35, |
| 1552 | -1, 36, -1, 37, -1, 40, -1, -1, 54, -1, |
| 1553 | 55, -1, 56, -1, 57, -1, 58, -1, 53, 4, |
| 1554 | -1, 110, -1, 111, -1, 128, -1, 129, -1, -1, |
| 1555 | 166, 165, -1, 127, -1, 165, -1, -1, 168, 167, |
| 1556 | -1, -1, 46, 4, -1, -1, 133, 46, 4, -1, |
| 1557 | 29, 17, -1, -1, 171, -1, -1, 133, 174, 173, |
| 1558 | -1, 171, -1, 46, 4, -1, 9, -1, 10, -1, |
| 1559 | 11, -1, 12, -1, 42, -1, 175, -1, 176, 134, |
| 1560 | -1, 208, -1, 135, 4, -1, 176, 136, 180, 137, |
| 1561 | 168, -1, 8, 136, 180, 137, 168, -1, 138, 4, |
| 1562 | 139, 176, 140, -1, 141, 4, 139, 176, 142, -1, |
| 1563 | 143, 181, 144, -1, 143, 144, -1, 141, 143, 181, |
| 1564 | 144, 142, -1, 141, 143, 144, 142, -1, 176, 166, |
| 1565 | -1, 176, -1, 8, -1, 177, -1, 179, 133, 177, |
| 1566 | -1, 179, -1, 179, 133, 32, -1, 32, -1, -1, |
| 1567 | 176, -1, 181, 133, 176, -1, 176, 138, 184, 140, |
| 1568 | -1, 176, 138, 140, -1, 176, 145, 17, -1, 176, |
| 1569 | 141, 184, 142, -1, 176, 143, 184, 144, -1, 176, |
| 1570 | 143, 144, -1, 176, 141, 143, 184, 144, 142, -1, |
| 1571 | 176, 141, 143, 144, 142, -1, 176, 33, -1, 176, |
| 1572 | 34, -1, 176, 208, -1, 176, 183, -1, 176, 20, |
| 1573 | -1, 152, 3, -1, 152, 4, -1, 9, 21, -1, |
| 1574 | 9, 22, -1, 153, 7, -1, 149, 136, 182, 31, |
| 1575 | 176, 137, -1, 108, 136, 182, 219, 137, -1, 122, |
| 1576 | 136, 182, 133, 182, 133, 182, 137, -1, 147, 136, |
| 1577 | 182, 133, 182, 137, -1, 148, 136, 182, 133, 182, |
| 1578 | 137, -1, 81, 150, 136, 182, 133, 182, 137, -1, |
| 1579 | 82, 151, 136, 182, 133, 182, 137, -1, 124, 136, |
| 1580 | 182, 133, 182, 137, -1, 125, 136, 182, 133, 182, |
| 1581 | 133, 182, 137, -1, 126, 136, 182, 133, 182, 133, |
| 1582 | 182, 137, -1, 184, 133, 182, -1, 182, -1, 27, |
| 1583 | -1, 28, -1, 187, -1, -1, 188, -1, 187, 188, |
| 1584 | -1, -1, 26, 189, 204, -1, -1, 25, 190, 205, |
| 1585 | -1, 51, 50, 194, -1, 19, -1, 156, 13, 176, |
| 1586 | -1, 156, 13, 8, -1, -1, 158, 161, 185, 182, |
| 1587 | 191, 173, -1, -1, 158, 159, 161, 185, 182, 192, |
| 1588 | 173, -1, -1, 158, 160, 161, 185, 176, 193, 173, |
| 1589 | -1, 44, 195, -1, 47, 132, 196, -1, 17, -1, |
| 1590 | 45, 132, 17, -1, 59, 132, 17, -1, 138, 197, |
| 1591 | 140, -1, 197, 133, 17, -1, 17, -1, -1, 198, |
| 1592 | 133, 176, 166, 155, -1, 176, 166, 155, -1, 198, |
| 1593 | -1, 198, 133, 32, -1, 32, -1, -1, 164, 178, |
| 1594 | 157, 136, 199, 137, 168, 172, 169, -1, 23, -1, |
| 1595 | 143, -1, 163, 161, 200, 201, -1, 24, -1, 144, |
| 1596 | -1, 211, 203, -1, 162, 161, 200, -1, -1, 52, |
| 1597 | -1, 3, -1, 4, -1, 7, -1, 21, -1, 22, |
| 1598 | -1, 33, -1, 34, -1, 20, -1, 141, 184, 142, |
| 1599 | -1, 183, -1, 50, 206, 17, 133, 17, -1, 5, |
| 1600 | -1, 6, -1, 154, -1, 157, -1, 208, -1, 207, |
| 1601 | -1, 176, 209, -1, 211, 212, -1, 202, 212, -1, |
| 1602 | 213, 156, 214, -1, 213, 216, -1, -1, 16, -1, |
| 1603 | 60, 210, -1, 60, 8, -1, 61, 12, 209, -1, |
| 1604 | 61, 9, 209, 133, 12, 209, 133, 12, 209, -1, |
| 1605 | 62, 152, 209, 133, 12, 209, 138, 215, 140, -1, |
| 1606 | 62, 152, 209, 133, 12, 209, 138, 140, -1, 63, |
| 1607 | 164, 178, 209, 136, 218, 137, 168, 31, 12, 209, |
| 1608 | 64, 12, 209, -1, 64, -1, 65, -1, 215, 152, |
| 1609 | 207, 133, 12, 209, -1, 152, 207, 133, 12, 209, |
| 1610 | -1, 156, 221, -1, 176, 138, 209, 133, 209, 140, |
| 1611 | -1, 217, 133, 138, 209, 133, 209, 140, -1, 176, |
| 1612 | 209, 166, -1, 218, 133, 176, 209, 166, -1, -1, |
| 1613 | -1, 219, 133, 210, -1, 49, 48, -1, 48, -1, |
| 1614 | 147, 176, 209, 133, 209, -1, 148, 176, 209, 133, |
| 1615 | 209, -1, 81, 150, 176, 209, 133, 209, -1, 82, |
| 1616 | 151, 176, 209, 133, 209, -1, 149, 210, 31, 176, |
| 1617 | -1, 122, 210, 133, 210, 133, 210, -1, 123, 210, |
| 1618 | 133, 176, -1, 124, 210, 133, 210, -1, 125, 210, |
| 1619 | 133, 210, 133, 210, -1, 126, 210, 133, 210, 133, |
| 1620 | 210, -1, 121, 217, -1, 220, 164, 178, 209, 136, |
| 1621 | 218, 137, 168, -1, 223, -1, 30, -1, -1, 103, |
| 1622 | 176, 170, -1, 103, 176, 133, 9, 209, 170, -1, |
| 1623 | 104, 176, 170, -1, 104, 176, 133, 9, 209, 170, |
| 1624 | -1, 105, 210, -1, 222, 106, 176, 209, -1, 222, |
| 1625 | 107, 210, 133, 176, 209, -1, 108, 176, 209, 219, |
| 1626 | -1 |
| 1627 | }; |
| 1628 | |
| 1629 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1630 | static const unsigned short int yyrline[] = |
| 1631 | { |
| 1632 | 0, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, |
| 1633 | 1033, 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035, |
| 1634 | 1035, 1035, 1035, 1036, 1036, 1036, 1036, 1036, 1036, 1039, |
| 1635 | 1039, 1040, 1040, 1041, 1041, 1042, 1042, 1043, 1043, 1047, |
| 1636 | 1047, 1048, 1048, 1049, 1049, 1050, 1050, 1051, 1051, 1052, |
| 1637 | 1052, 1053, 1053, 1054, 1055, 1060, 1061, 1061, 1063, 1063, |
| 1638 | 1064, 1064, 1068, 1072, 1077, 1077, 1079, 1083, 1089, 1090, |
| 1639 | 1091, 1092, 1093, 1097, 1098, 1099, 1103, 1104, 1108, 1109, |
| 1640 | 1110, 1114, 1115, 1116, 1117, 1118, 1121, 1122, 1123, 1124, |
| 1641 | 1125, 1126, 1127, 1134, 1135, 1136, 1137, 1140, 1141, 1146, |
| 1642 | 1147, 1150, 1151, 1158, 1159, 1165, 1166, 1174, 1182, 1183, |
| 1643 | 1188, 1189, 1190, 1195, 1208, 1208, 1208, 1208, 1211, 1215, |
| 1644 | 1219, 1226, 1231, 1239, 1257, 1275, 1280, 1292, 1302, 1306, |
| 1645 | 1316, 1323, 1330, 1337, 1342, 1347, 1354, 1355, 1362, 1369, |
| 1646 | 1377, 1382, 1393, 1421, 1437, 1466, 1494, 1519, 1538, 1563, |
| 1647 | 1582, 1594, 1601, 1667, 1677, 1687, 1693, 1699, 1704, 1709, |
| 1648 | 1717, 1729, 1750, 1758, 1764, 1775, 1780, 1785, 1791, 1797, |
| 1649 | 1806, 1810, 1818, 1818, 1829, 1834, 1842, 1843, 1847, 1847, |
| 1650 | 1851, 1851, 1854, 1857, 1869, 1893, 1904, 1904, 1914, 1914, |
| 1651 | 1922, 1922, 1932, 1935, 1941, 1954, 1958, 1963, 1965, 1970, |
| 1652 | 1975, 1984, 1994, 2005, 2009, 2018, 2027, 2032, 2138, 2138, |
| 1653 | 2140, 2149, 2149, 2151, 2156, 2168, 2172, 2177, 2181, 2185, |
| 1654 | 2189, 2193, 2197, 2201, 2205, 2209, 2234, 2238, 2252, 2256, |
| 1655 | 2260, 2264, 2270, 2270, 2276, 2285, 2289, 2298, 2309, 2318, |
| 1656 | 2330, 2343, 2347, 2351, 2356, 2366, 2385, 2394, 2461, 2465, |
| 1657 | 2472, 2483, 2496, 2505, 2516, 2526, 2534, 2542, 2545, 2546, |
| 1658 | 2553, 2557, 2562, 2583, 2600, 2613, 2626, 2638, 2646, 2653, |
| 1659 | 2659, 2665, 2671, 2686, 2750, 2755, 2759, 2766, 2773, 2781, |
| 1660 | 2788, 2796, 2804, 2818, 2835 |
| 1661 | }; |
| 1662 | #endif |
| 1663 | |
| 1664 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1665 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1666 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1667 | static const char *const yytname[] = |
| 1668 | { |
| 1669 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", |
| 1670 | "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", "FLOAT", |
| 1671 | "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR", |
| 1672 | "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION", |
| 1673 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1674 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1675 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
| 1676 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1677 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL", |
| 1678 | "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK", |
| 1679 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1680 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", |
| 1681 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", |
| 1682 | "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", |
| 1683 | "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", |
| 1684 | "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", |
| 1685 | "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", |
| 1686 | "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", |
| 1687 | "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", |
| 1688 | "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT", |
| 1689 | "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", |
| 1690 | "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", |
| 1691 | "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType", |
| 1692 | "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName", |
| 1693 | "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage", |
| 1694 | "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", |
| 1695 | "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr", |
| 1696 | "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection", |
| 1697 | "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", |
| 1698 | "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI", |
| 1699 | "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module", |
| 1700 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1701 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1702 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1703 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1704 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", |
| 1705 | "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", |
| 1706 | "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal", |
| 1707 | "OptVolatile", "MemoryInst", 0 |
| 1708 | }; |
| 1709 | #endif |
| 1710 | |
| 1711 | # ifdef YYPRINT |
| 1712 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1713 | token YYLEX-NUM. */ |
| 1714 | static const unsigned short int yytoknum[] = |
| 1715 | { |
| 1716 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1717 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1718 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1719 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1720 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1721 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1722 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1723 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1724 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1725 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1726 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1727 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1728 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1729 | 385, 386, 61, 44, 42, 92, 40, 41, 91, 120, |
| 1730 | 93, 60, 62, 123, 125, 99 |
| 1731 | }; |
| 1732 | # endif |
| 1733 | |
| 1734 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1735 | static const unsigned char yyr1[] = |
| 1736 | { |
| 1737 | 0, 146, 147, 147, 147, 147, 147, 147, 147, 147, |
| 1738 | 147, 148, 148, 148, 148, 148, 148, 149, 149, 149, |
| 1739 | 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, |
| 1740 | 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, |
| 1741 | 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, |
| 1742 | 151, 151, 151, 151, 151, 152, 153, 153, 154, 154, |
| 1743 | 155, 155, 156, 156, 157, 157, 158, 158, 159, 159, |
| 1744 | 159, 159, 159, 160, 160, 160, 161, 161, 162, 162, |
| 1745 | 162, 163, 163, 163, 163, 163, 164, 164, 164, 164, |
| 1746 | 164, 164, 164, 165, 165, 165, 165, 166, 166, 167, |
| 1747 | 167, 168, 168, 169, 169, 170, 170, 171, 172, 172, |
| 1748 | 173, 173, 174, 174, 175, 175, 175, 175, 176, 176, |
| 1749 | 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, |
| 1750 | 176, 177, 178, 178, 179, 179, 180, 180, 180, 180, |
| 1751 | 181, 181, 182, 182, 182, 182, 182, 182, 182, 182, |
| 1752 | 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, |
| 1753 | 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, |
| 1754 | 184, 184, 185, 185, 186, 186, 187, 187, 189, 188, |
| 1755 | 190, 188, 188, 188, 188, 188, 191, 188, 192, 188, |
| 1756 | 193, 188, 188, 188, 194, 195, 195, 196, 197, 197, |
| 1757 | 197, 198, 198, 199, 199, 199, 199, 200, 201, 201, |
| 1758 | 202, 203, 203, 204, 205, 206, 206, 207, 207, 207, |
| 1759 | 207, 207, 207, 207, 207, 207, 207, 207, 208, 208, |
| 1760 | 208, 208, 209, 209, 210, 211, 211, 212, 213, 213, |
| 1761 | 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, |
| 1762 | 215, 215, 216, 217, 217, 218, 218, 218, 219, 219, |
| 1763 | 220, 220, 221, 221, 221, 221, 221, 221, 221, 221, |
| 1764 | 221, 221, 221, 221, 221, 222, 222, 223, 223, 223, |
| 1765 | 223, 223, 223, 223, 223 |
| 1766 | }; |
| 1767 | |
| 1768 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1769 | static const unsigned char yyr2[] = |
| 1770 | { |
| 1771 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1772 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1773 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1774 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1775 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1776 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1777 | 1, 0, 2, 0, 1, 1, 2, 0, 1, 1, |
| 1778 | 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, |
| 1779 | 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, |
| 1780 | 1, 1, 2, 1, 1, 1, 1, 0, 2, 1, |
| 1781 | 1, 0, 2, 0, 2, 0, 3, 2, 0, 1, |
| 1782 | 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, |
| 1783 | 2, 1, 2, 5, 5, 5, 5, 3, 2, 5, |
| 1784 | 4, 2, 1, 1, 1, 3, 1, 3, 1, 0, |
| 1785 | 1, 3, 4, 3, 3, 4, 4, 3, 6, 5, |
| 1786 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1787 | 6, 5, 8, 6, 6, 7, 7, 6, 8, 8, |
| 1788 | 3, 1, 1, 1, 1, 0, 1, 2, 0, 3, |
| 1789 | 0, 3, 3, 1, 3, 3, 0, 6, 0, 7, |
| 1790 | 0, 7, 2, 3, 1, 3, 3, 3, 3, 1, |
| 1791 | 0, 5, 3, 1, 3, 1, 0, 9, 1, 1, |
| 1792 | 4, 1, 1, 2, 3, 0, 1, 1, 1, 1, |
| 1793 | 1, 1, 1, 1, 1, 3, 1, 5, 1, 1, |
| 1794 | 1, 1, 1, 1, 2, 2, 2, 3, 2, 0, |
| 1795 | 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, |
| 1796 | 6, 5, 2, 6, 7, 3, 5, 0, 0, 3, |
| 1797 | 2, 1, 5, 5, 6, 6, 4, 6, 4, 4, |
| 1798 | 6, 6, 2, 8, 1, 1, 0, 3, 6, 3, |
| 1799 | 6, 2, 4, 6, 4 |
| 1800 | }; |
| 1801 | |
| 1802 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1803 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1804 | means the default is an error. */ |
| 1805 | static const unsigned short int yydefact[] = |
| 1806 | { |
| 1807 | 67, 58, 64, 59, 65, 183, 180, 178, 0, 0, |
| 1808 | 0, 0, 0, 0, 76, 0, 67, 176, 78, 81, |
| 1809 | 0, 0, 192, 0, 0, 62, 0, 66, 68, 70, |
| 1810 | 69, 71, 73, 72, 74, 75, 77, 76, 76, 0, |
| 1811 | 1, 177, 79, 80, 76, 181, 82, 83, 84, 85, |
| 1812 | 76, 239, 179, 239, 0, 0, 200, 193, 194, 182, |
| 1813 | 228, 229, 185, 114, 115, 116, 117, 118, 0, 0, |
| 1814 | 0, 0, 230, 231, 119, 184, 121, 0, 0, 172, |
| 1815 | 173, 0, 86, 86, 240, 236, 63, 211, 212, 213, |
| 1816 | 235, 195, 196, 199, 0, 139, 122, 0, 0, 0, |
| 1817 | 0, 128, 140, 0, 120, 139, 0, 0, 114, 115, |
| 1818 | 116, 0, 0, 0, 186, 0, 87, 88, 89, 90, |
| 1819 | 91, 0, 214, 0, 276, 238, 0, 197, 138, 97, |
| 1820 | 134, 136, 0, 0, 0, 0, 0, 0, 127, 0, |
| 1821 | 188, 190, 157, 158, 155, 156, 159, 154, 150, 151, |
| 1822 | 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, |
| 1823 | 15, 16, 11, 12, 13, 0, 0, 0, 17, 18, |
| 1824 | 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, |
| 1825 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1826 | 0, 153, 152, 110, 92, 133, 132, 0, 208, 209, |
| 1827 | 210, 275, 261, 0, 0, 0, 0, 86, 248, 249, |
| 1828 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1829 | 0, 0, 0, 0, 0, 237, 86, 252, 0, 274, |
| 1830 | 198, 131, 0, 101, 0, 0, 130, 0, 141, 101, |
| 1831 | 110, 110, 29, 30, 31, 32, 33, 34, 35, 36, |
| 1832 | 37, 38, 0, 53, 54, 49, 50, 51, 52, 39, |
| 1833 | 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, |
| 1834 | 0, 0, 0, 0, 0, 143, 171, 0, 0, 0, |
| 1835 | 147, 0, 144, 0, 0, 0, 0, 187, 0, 260, |
| 1836 | 242, 0, 241, 0, 0, 55, 0, 0, 0, 0, |
| 1837 | 105, 105, 281, 0, 0, 272, 0, 0, 0, 0, |
| 1838 | 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, |
| 1839 | 96, 98, 137, 135, 124, 125, 126, 129, 123, 189, |
| 1840 | 191, 0, 0, 258, 0, 0, 0, 0, 0, 142, |
| 1841 | 128, 140, 0, 145, 146, 0, 0, 0, 0, 0, |
| 1842 | 112, 110, 206, 217, 218, 219, 224, 220, 221, 222, |
| 1843 | 223, 215, 0, 226, 233, 232, 234, 0, 243, 0, |
| 1844 | 0, 0, 0, 0, 277, 0, 279, 258, 0, 0, |
| 1845 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1846 | 0, 99, 100, 102, 0, 0, 0, 0, 0, 0, |
| 1847 | 0, 170, 149, 0, 0, 0, 0, 107, 113, 111, |
| 1848 | 205, 97, 203, 0, 216, 0, 0, 0, 0, 0, |
| 1849 | 0, 0, 0, 0, 0, 284, 0, 0, 0, 268, |
| 1850 | 269, 0, 0, 0, 0, 266, 0, 282, 0, 0, |
| 1851 | 0, 0, 161, 0, 0, 0, 0, 148, 0, 0, |
| 1852 | 0, 61, 0, 101, 0, 225, 0, 0, 257, 0, |
| 1853 | 0, 105, 106, 105, 0, 0, 0, 0, 0, 262, |
| 1854 | 263, 257, 0, 0, 0, 259, 0, 167, 0, 0, |
| 1855 | 163, 164, 160, 60, 202, 204, 97, 108, 0, 0, |
| 1856 | 0, 0, 0, 264, 265, 0, 278, 280, 0, 0, |
| 1857 | 267, 270, 271, 0, 283, 165, 166, 0, 0, 0, |
| 1858 | 61, 109, 103, 227, 0, 0, 97, 0, 101, 253, |
| 1859 | 0, 101, 162, 168, 169, 201, 0, 207, 0, 246, |
| 1860 | 0, 0, 255, 0, 0, 254, 273, 104, 244, 0, |
| 1861 | 245, 0, 97, 0, 0, 0, 256, 0, 0, 0, |
| 1862 | 0, 251, 0, 0, 250, 0, 247 |
| 1863 | }; |
| 1864 | |
| 1865 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1866 | static const short int yydefgoto[] = |
| 1867 | { |
| 1868 | -1, 188, 189, 190, 252, 269, 111, 112, 72, 484, |
| 1869 | 12, 73, 14, 37, 38, 39, 44, 50, 121, 321, |
| 1870 | 231, 393, 324, 527, 374, 350, 512, 287, 351, 74, |
| 1871 | 113, 130, 197, 131, 132, 103, 276, 363, 277, 81, |
| 1872 | 15, 16, 17, 19, 18, 193, 240, 241, 59, 22, |
| 1873 | 57, 94, 412, 413, 122, 200, 51, 89, 52, 45, |
| 1874 | 415, 364, 76, 366, 292, 53, 85, 86, 225, 531, |
| 1875 | 125, 305, 492, 396, 226, 227, 228, 229 |
| 1876 | }; |
| 1877 | |
| 1878 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1879 | STATE-NUM. */ |
| 1880 | #define YYPACT_NINF -399 |
| 1881 | static const short int yypact[] = |
| 1882 | { |
| 1883 | 406, -399, -399, -399, -399, -399, -399, -399, -26, -114, |
| 1884 | -16, -53, 92, -11, 54, 136, 526, -399, 247, 173, |
| 1885 | 43, 49, -399, 62, 194, -399, 814, -399, -399, -399, |
| 1886 | -399, -399, -399, -399, -399, -399, -399, 134, 134, 99, |
| 1887 | -399, -399, -399, -399, 134, -399, -399, -399, -399, -399, |
| 1888 | 134, 212, -399, -1, 219, 225, 253, -399, -399, -399, |
| 1889 | -399, -399, 135, -399, -399, -399, -399, -399, 271, 275, |
| 1890 | 3, 33, -399, -399, -399, 160, -399, 99, 99, -399, |
| 1891 | -399, 1029, 287, 287, -399, -399, 220, -399, -399, -399, |
| 1892 | -399, -399, -399, -399, 20, 1071, -399, 141, 148, 105, |
| 1893 | 135, -399, 160, -75, -399, 1071, 1029, 1174, 32, 286, |
| 1894 | 293, 151, 294, 590, -399, 298, -399, -399, -399, -399, |
| 1895 | -399, 1190, -399, -13, 1313, -399, 289, -399, -399, 160, |
| 1896 | -399, 170, 167, 1174, 1174, 165, -68, 1174, -399, 174, |
| 1897 | -399, 160, -399, -399, -399, -399, -399, -399, -399, -399, |
| 1898 | -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, |
| 1899 | -399, -399, -399, -399, -399, 495, 591, 176, -399, -399, |
| 1900 | -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, |
| 1901 | 177, 178, 182, 183, 776, 1212, 123, 305, 187, 188, |
| 1902 | 189, -399, -399, 193, -399, 135, 160, 266, -399, -399, |
| 1903 | -399, -399, -399, 284, 1229, 283, 325, 287, -399, -399, |
| 1904 | 495, 591, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174, |
| 1905 | 1174, 1174, 1174, 1174, 1174, -399, 287, -399, 144, -399, |
| 1906 | -399, -4, 1110, -399, -63, -110, -399, 204, 160, -399, |
| 1907 | 193, 193, -399, -399, -399, -399, -399, -399, -399, -399, |
| 1908 | -399, -399, 211, -399, -399, -399, -399, -399, -399, -399, |
| 1909 | -399, -399, -399, -399, -399, -399, -399, -399, -399, 214, |
| 1910 | 1029, 1029, 1029, 1029, 1029, -399, -399, 79, 494, -111, |
| 1911 | -399, -66, -399, 1029, 1029, 1029, 39, -399, 216, -399, |
| 1912 | 135, 733, -399, 858, 858, -399, 858, 1190, 1174, 1174, |
| 1913 | 50, 111, -399, 733, 97, 215, 230, 231, 232, 233, |
| 1914 | 234, 733, 733, 322, 1190, 1174, 1174, -399, -399, -399, |
| 1915 | -399, -399, -399, -399, -27, -399, -399, -399, -27, -399, |
| 1916 | -399, 1029, 1029, -399, 235, 236, 239, 240, 1029, -399, |
| 1917 | 237, 590, 26, -399, -399, 241, 242, 345, 360, 374, |
| 1918 | -399, 193, 1126, -399, -399, -399, -399, -399, -399, -399, |
| 1919 | -399, 328, 1029, -399, -399, -399, -399, 249, -399, 252, |
| 1920 | 858, 733, 733, 11, -399, 18, -399, -399, 858, 250, |
| 1921 | 1174, 1174, 1174, 1174, 1174, 256, 257, 1174, 858, 733, |
| 1922 | 259, -399, -399, -399, 262, 264, -34, 1029, 1029, 1029, |
| 1923 | 1029, -399, -399, 258, 1029, 1029, 1174, -399, -399, -399, |
| 1924 | -399, 160, 265, 267, -399, 384, -61, 390, 393, 272, |
| 1925 | 281, 282, 858, 413, 858, 295, 296, 858, 297, 160, |
| 1926 | -399, 301, 302, 858, 858, 160, 300, -399, 1174, 1029, |
| 1927 | 1029, 1174, -399, 304, 285, 306, 307, -399, 308, 310, |
| 1928 | 118, 38, 1145, -399, 311, -399, 858, 858, 1174, 858, |
| 1929 | 858, 315, -399, 315, 858, 316, 1174, 1174, 1174, -399, |
| 1930 | -399, 1174, 733, 317, 319, -399, 1029, -399, 1029, 1029, |
| 1931 | -399, -399, -399, -399, -399, -399, 160, 149, 421, 326, |
| 1932 | 314, 733, 19, -399, -399, 412, -399, -399, 321, 858, |
| 1933 | -399, -399, -399, 36, -399, -399, -399, 327, 329, 330, |
| 1934 | 38, -399, 416, -399, 451, 2, -399, 1174, -399, -399, |
| 1935 | 333, -399, -399, -399, -399, -399, 461, -399, 858, -399, |
| 1936 | 982, 5, -4, 733, 210, -399, -27, -399, -399, 335, |
| 1937 | -399, 982, -399, 457, 464, 344, -4, 858, 858, 468, |
| 1938 | 417, -399, 858, 471, -399, 858, -399 |
| 1939 | }; |
| 1940 | |
| 1941 | /* YYPGOTO[NTERM-NUM]. */ |
| 1942 | static const short int yypgoto[] = |
| 1943 | { |
| 1944 | -399, 361, 362, 363, 274, 279, -198, -399, 0, -19, |
| 1945 | 407, 9, -399, -399, -399, 113, -399, -399, -177, -307, |
| 1946 | -398, -399, -236, -399, -299, 7, -399, -212, -399, -399, |
| 1947 | -25, 263, -210, -399, 391, 398, -69, -109, -180, 179, |
| 1948 | -399, -399, 482, -399, -399, -399, -399, -399, -399, -399, |
| 1949 | -399, -399, -399, -399, 418, -399, -399, -399, -399, -399, |
| 1950 | -399, -369, -73, 100, -158, -399, 454, -399, -399, -399, |
| 1951 | -399, -399, 42, 137, -399, -399, -399, -399 |
| 1952 | }; |
| 1953 | |
| 1954 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 1955 | positive, shift that token. If negative, reduce the rule which |
| 1956 | number is the opposite. If zero, do what YYDEFACT says. |
| 1957 | If YYTABLE_NINF, syntax error. */ |
| 1958 | #define YYTABLE_NINF -176 |
| 1959 | static const short int yytable[] = |
| 1960 | { |
| 1961 | 11, 75, 376, 328, 191, 279, 281, 98, 296, 13, |
| 1962 | 198, 295, 114, 451, 295, 84, 11, 392, 23, 20, |
| 1963 | 422, 392, 338, 87, 104, 13, 105, 424, 329, 330, |
| 1964 | 297, 343, 326, 21, 24, -55, -55, 140, 60, 61, |
| 1965 | 192, 100, 63, 64, 65, 66, 102, 1, 2, 314, |
| 1966 | 3, 4, 1, 142, 143, 3, 302, 423, 137, 306, |
| 1967 | 307, 308, 309, 310, 423, 137, 313, 338, 348, 138, |
| 1968 | 129, 104, 338, 105, 102, 67, 237, 325, 344, 25, |
| 1969 | 129, 455, 141, 317, 318, 349, 11, 370, 510, 28, |
| 1970 | 29, 30, 31, 32, 33, 34, 196, 35, 342, 441, |
| 1971 | 391, 319, 320, 442, 388, 26, 317, 318, 234, 235, |
| 1972 | 60, 61, 238, 100, 63, 64, 65, 66, 532, 1, |
| 1973 | 2, 27, 3, 4, 319, 320, 79, 80, 60, 61, |
| 1974 | 199, 100, 108, 109, 110, 66, 40, 1, 2, 409, |
| 1975 | 3, 4, 529, 88, 546, 540, 99, 67, 317, 318, |
| 1976 | 77, 78, 517, 126, 144, 145, 518, 82, 390, 338, |
| 1977 | 127, 539, 496, 83, 497, 67, 319, 320, 68, 517, |
| 1978 | 403, 69, 545, 521, 70, 54, 71, 101, 348, 291, |
| 1979 | 392, 55, 416, 373, 104, 36, 105, 300, 301, 291, |
| 1980 | 303, 304, 291, 291, 291, 291, 291, 311, 312, 291, |
| 1981 | 56, 333, 334, 335, 336, 337, 288, 129, 46, 47, |
| 1982 | 48, 58, 338, 49, 345, 346, 347, 487, 365, 339, |
| 1983 | 365, 365, 428, 365, 430, 431, 432, 392, 84, 392, |
| 1984 | 365, 104, 191, 105, 1, 378, 91, 3, 365, 365, |
| 1985 | 68, 543, 92, 69, 375, 104, 70, 105, 71, 135, |
| 1986 | 315, 316, 104, 341, 105, 482, 106, 107, 68, 317, |
| 1987 | 318, 69, 394, 395, 70, 36, 71, 280, 192, 401, |
| 1988 | 93, 95, 196, 371, 372, 96, 391, 319, 320, 97, |
| 1989 | 133, 2, 534, 475, 4, 536, 42, 134, 43, 196, |
| 1990 | 389, 291, 293, -56, 104, 294, 105, 365, 365, 365, |
| 1991 | -57, 146, 194, 232, 233, 365, 230, 236, 500, 501, |
| 1992 | 502, 239, 270, 271, 272, 365, 365, 530, 273, 274, |
| 1993 | 317, 318, 282, 283, 284, 285, 286, 411, 443, 444, |
| 1994 | 445, 446, 289, 541, 295, 448, 449, 391, 319, 320, |
| 1995 | 115, 116, 117, 118, 119, 120, 327, 331, 379, 365, |
| 1996 | 332, 365, 352, 387, 365, 291, 429, 291, 291, 291, |
| 1997 | 365, 365, 435, 380, 381, 382, 383, 384, 397, 398, |
| 1998 | 473, 474, 399, 400, 404, 405, 406, 407, 408, 402, |
| 1999 | 414, 450, 417, 365, 365, 418, 365, 365, 427, 433, |
| 2000 | 434, 365, 438, 367, 368, 439, 369, 440, 452, 365, |
| 2001 | 447, 454, 456, 377, 453, 457, -175, 507, 458, 508, |
| 2002 | 509, 385, 386, 472, 459, 460, 291, 462, 365, -63, |
| 2003 | 1, 2, 477, 3, 4, 5, 365, 486, 441, 464, |
| 2004 | 466, 6, 7, 491, 467, 468, 471, 476, 513, 478, |
| 2005 | 479, 291, 291, 291, 488, 480, 491, 481, 495, 499, |
| 2006 | 8, 483, 515, 9, 505, 365, 506, 10, 423, 514, |
| 2007 | 365, 519, 526, 528, 522, 537, 523, 524, 544, 547, |
| 2008 | 419, 420, 421, 535, 365, 365, 548, 549, 426, 365, |
| 2009 | 552, 553, 365, 555, 298, 222, 223, 224, 436, 437, |
| 2010 | 299, 525, 533, 124, 511, 323, 139, 136, 41, 60, |
| 2011 | 61, 123, 100, 108, 109, 110, 66, 90, 1, 2, |
| 2012 | 483, 3, 4, 503, 425, 0, 0, 0, 0, 0, |
| 2013 | 0, 0, 461, 0, 463, 0, -174, 465, 0, 0, |
| 2014 | 0, 0, 0, 469, 470, 0, 67, 0, 0, -63, |
| 2015 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2016 | 0, 6, 7, 0, 0, 0, 489, 490, 0, 493, |
| 2017 | 494, 0, 0, 0, 498, 0, 0, 0, 0, 0, |
| 2018 | 8, 0, 504, 9, 0, 0, 0, 10, 242, 243, |
| 2019 | 244, 245, 246, 247, 248, 249, 250, 251, 0, 0, |
| 2020 | 0, 516, 0, 0, 0, 60, 61, 0, 0, 520, |
| 2021 | 0, 0, 0, 0, 1, 2, 0, 3, 4, 0, |
| 2022 | 147, 0, 253, 254, 0, 0, 0, 0, 0, 0, |
| 2023 | 0, 0, 0, 148, 149, 0, 0, 0, 538, 68, |
| 2024 | 0, 0, 69, 542, 0, 70, 0, 71, 340, 0, |
| 2025 | 0, 0, 0, 0, 0, 0, 0, 550, 551, 0, |
| 2026 | 0, 0, 554, 0, 0, 556, 150, 151, 152, 153, |
| 2027 | 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, |
| 2028 | 164, 165, 166, 0, 0, 0, 0, 0, 0, 0, |
| 2029 | 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 2030 | 265, 266, 267, 268, 0, 0, 0, 0, 167, 168, |
| 2031 | 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, |
| 2032 | 179, 0, 180, 0, 181, 182, 183, 0, 0, 0, |
| 2033 | 0, 0, 0, 0, 104, 0, 105, 0, 184, 0, |
| 2034 | 0, 185, 0, 186, 0, 187, 353, 354, 60, 61, |
| 2035 | 355, 0, 0, 0, 0, 0, 0, 1, 2, 0, |
| 2036 | 3, 4, 0, 356, 357, 358, 0, 0, 0, 0, |
| 2037 | 0, 0, 0, 0, 0, 0, 359, 360, 0, 0, |
| 2038 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2039 | 0, 60, 61, 361, 100, 108, 109, 110, 66, 0, |
| 2040 | 1, 2, 0, 3, 4, 0, 0, 0, 0, 150, |
| 2041 | 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, |
| 2042 | 161, 162, 163, 164, 165, 166, 0, 0, 67, 60, |
| 2043 | 61, 0, 62, 63, 64, 65, 66, 0, 1, 2, |
| 2044 | 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, |
| 2045 | 0, 167, 168, 169, 170, 171, 172, 173, 174, 175, |
| 2046 | 176, 177, 178, 179, 0, 180, 67, 181, 182, 183, |
| 2047 | 0, 353, 354, 60, 61, 355, 0, 104, 0, 105, |
| 2048 | 0, 0, 1, 2, 362, 3, 4, 0, 356, 357, |
| 2049 | 358, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2050 | 0, 359, 360, 0, 0, 0, 0, 0, 0, 0, |
| 2051 | 0, 0, 0, 0, 0, 0, 0, 0, 361, 0, |
| 2052 | 0, 68, 0, 0, 69, 0, 275, 70, 0, 71, |
| 2053 | 0, 0, 0, 0, 150, 151, 152, 153, 154, 155, |
| 2054 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2055 | 166, 0, 0, 0, 0, 0, 0, 0, 0, 68, |
| 2056 | 0, 0, 69, 0, 0, 70, 0, 71, 0, 0, |
| 2057 | 0, 0, 0, 0, 0, 0, 167, 168, 169, 170, |
| 2058 | 171, 172, 173, 174, 175, 176, 177, 178, 179, 0, |
| 2059 | 180, 0, 181, 182, 183, 353, 354, 0, 0, 355, |
| 2060 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, |
| 2061 | 0, 0, 356, 357, 358, 0, 0, 0, 0, 0, |
| 2062 | 0, 0, 0, 0, 0, 359, 360, 0, 0, 0, |
| 2063 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2064 | 0, 0, 361, 0, 60, 61, 0, 100, 108, 109, |
| 2065 | 110, 66, 0, 1, 2, 0, 3, 4, 150, 151, |
| 2066 | 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, |
| 2067 | 162, 163, 164, 165, 166, 0, 0, 0, 0, 0, |
| 2068 | 0, 67, 0, 0, 0, 0, 60, 61, 0, 100, |
| 2069 | 63, 64, 65, 66, 0, 1, 2, 0, 3, 4, |
| 2070 | 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, |
| 2071 | 177, 178, 179, 128, 180, 0, 181, 182, 183, 0, |
| 2072 | 0, 0, 0, 67, 0, 60, 61, 0, 100, 63, |
| 2073 | 64, 65, 66, 362, 1, 2, 0, 3, 4, 0, |
| 2074 | 0, 60, 61, 0, 100, 63, 64, 65, 66, 0, |
| 2075 | 1, 2, 322, 3, 4, 0, 0, 0, 0, 0, |
| 2076 | 60, 61, 67, 100, 63, 64, 65, 66, 410, 1, |
| 2077 | 2, 0, 3, 4, 68, 0, 0, 69, 67, 0, |
| 2078 | 70, 0, 71, 0, 0, 0, 0, 485, 0, 60, |
| 2079 | 61, 0, 100, 63, 64, 65, 66, 67, 1, 2, |
| 2080 | 0, 3, 4, 0, 0, 60, 61, 0, 195, 63, |
| 2081 | 64, 65, 66, 0, 1, 2, 68, 3, 4, 69, |
| 2082 | 0, 0, 70, 0, 71, 0, 67, 60, 61, 0, |
| 2083 | 100, 108, 109, 110, 66, 0, 1, 2, 0, 3, |
| 2084 | 4, 0, 67, 0, 60, 61, 0, 290, 63, 64, |
| 2085 | 65, 66, 0, 1, 2, 68, 3, 4, 69, 0, |
| 2086 | 0, 70, 0, 71, 67, 0, 0, 0, 0, 0, |
| 2087 | 0, 68, 0, 0, 69, 0, 0, 70, 0, 71, |
| 2088 | 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2089 | 68, 0, 0, 69, 0, 0, 70, 0, 71, 0, |
| 2090 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2091 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, |
| 2092 | 0, 0, 69, 0, 0, 70, 0, 71, 0, 0, |
| 2093 | 0, 0, 0, 0, 0, 68, 0, 0, 69, 0, |
| 2094 | 0, 70, 0, 71, 0, 0, 0, 0, 0, 0, |
| 2095 | 0, 0, 0, 201, 0, 0, 0, 68, 0, 0, |
| 2096 | 69, 0, 0, 70, 0, 278, 0, 0, 0, 0, |
| 2097 | 0, 202, 203, 0, 68, 0, 0, 69, 0, 0, |
| 2098 | 70, 0, 71, 204, 205, 206, 207, 208, 209, 150, |
| 2099 | 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, |
| 2100 | 161, 162, 163, 164, 210, 211, 0, 0, 0, 0, |
| 2101 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2102 | 0, 0, 0, 0, 0, 0, 212, 213, 214, 0, |
| 2103 | 0, 215, 168, 169, 170, 171, 172, 173, 174, 175, |
| 2104 | 176, 177, 178, 179, 216, 217, 218, 219, 220, 221 |
| 2105 | }; |
| 2106 | |
| 2107 | static const short int yycheck[] = |
| 2108 | { |
| 2109 | 0, 26, 301, 239, 113, 185, 186, 4, 206, 0, |
| 2110 | 23, 9, 81, 411, 9, 16, 16, 324, 132, 45, |
| 2111 | 9, 328, 133, 24, 134, 16, 136, 9, 240, 241, |
| 2112 | 207, 142, 142, 59, 50, 3, 4, 106, 5, 6, |
| 2113 | 113, 8, 9, 10, 11, 12, 71, 14, 15, 226, |
| 2114 | 17, 18, 14, 21, 22, 17, 214, 46, 133, 217, |
| 2115 | 218, 219, 220, 221, 46, 133, 224, 133, 29, 144, |
| 2116 | 95, 134, 133, 136, 99, 42, 144, 140, 144, 132, |
| 2117 | 105, 142, 107, 110, 111, 46, 86, 297, 486, 35, |
| 2118 | 36, 37, 38, 39, 40, 41, 121, 43, 278, 133, |
| 2119 | 127, 128, 129, 137, 314, 13, 110, 111, 133, 134, |
| 2120 | 5, 6, 137, 8, 9, 10, 11, 12, 516, 14, |
| 2121 | 15, 132, 17, 18, 128, 129, 27, 28, 5, 6, |
| 2122 | 143, 8, 9, 10, 11, 12, 0, 14, 15, 351, |
| 2123 | 17, 18, 140, 144, 542, 140, 143, 42, 110, 111, |
| 2124 | 37, 38, 133, 133, 3, 4, 137, 44, 316, 133, |
| 2125 | 140, 530, 461, 50, 463, 42, 128, 129, 135, 133, |
| 2126 | 144, 138, 541, 137, 141, 132, 143, 144, 29, 204, |
| 2127 | 487, 132, 362, 133, 134, 131, 136, 212, 213, 214, |
| 2128 | 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
| 2129 | 138, 270, 271, 272, 273, 274, 197, 232, 35, 36, |
| 2130 | 37, 17, 133, 40, 283, 284, 285, 453, 291, 140, |
| 2131 | 293, 294, 380, 296, 382, 383, 384, 534, 16, 536, |
| 2132 | 303, 134, 341, 136, 14, 138, 17, 17, 311, 312, |
| 2133 | 135, 31, 17, 138, 133, 134, 141, 136, 143, 144, |
| 2134 | 106, 107, 134, 278, 136, 137, 77, 78, 135, 110, |
| 2135 | 111, 138, 331, 332, 141, 131, 143, 144, 341, 338, |
| 2136 | 17, 136, 297, 298, 299, 4, 127, 128, 129, 4, |
| 2137 | 139, 15, 518, 441, 18, 521, 39, 139, 41, 314, |
| 2138 | 315, 316, 9, 7, 134, 12, 136, 370, 371, 372, |
| 2139 | 7, 7, 4, 133, 137, 378, 17, 142, 466, 467, |
| 2140 | 468, 137, 136, 136, 136, 388, 389, 515, 136, 136, |
| 2141 | 110, 111, 17, 136, 136, 136, 133, 352, 397, 398, |
| 2142 | 399, 400, 48, 531, 9, 404, 405, 127, 128, 129, |
| 2143 | 53, 54, 55, 56, 57, 58, 142, 136, 133, 422, |
| 2144 | 136, 424, 136, 31, 427, 380, 381, 382, 383, 384, |
| 2145 | 433, 434, 387, 133, 133, 133, 133, 133, 133, 133, |
| 2146 | 439, 440, 133, 133, 133, 133, 31, 17, 4, 142, |
| 2147 | 52, 406, 133, 456, 457, 133, 459, 460, 138, 133, |
| 2148 | 133, 464, 133, 293, 294, 133, 296, 133, 133, 472, |
| 2149 | 142, 17, 12, 303, 137, 12, 0, 476, 136, 478, |
| 2150 | 479, 311, 312, 438, 133, 133, 441, 4, 491, 13, |
| 2151 | 14, 15, 137, 17, 18, 19, 499, 452, 133, 133, |
| 2152 | 133, 25, 26, 458, 133, 133, 136, 133, 17, 133, |
| 2153 | 133, 466, 467, 468, 133, 137, 471, 137, 133, 133, |
| 2154 | 44, 451, 138, 47, 137, 528, 137, 51, 46, 133, |
| 2155 | 533, 140, 46, 12, 137, 4, 137, 137, 133, 12, |
| 2156 | 370, 371, 372, 140, 547, 548, 12, 133, 378, 552, |
| 2157 | 12, 64, 555, 12, 210, 124, 124, 124, 388, 389, |
| 2158 | 211, 510, 517, 86, 487, 232, 105, 99, 16, 5, |
| 2159 | 6, 83, 8, 9, 10, 11, 12, 53, 14, 15, |
| 2160 | 510, 17, 18, 471, 377, -1, -1, -1, -1, -1, |
| 2161 | -1, -1, 422, -1, 424, -1, 0, 427, -1, -1, |
| 2162 | -1, -1, -1, 433, 434, -1, 42, -1, -1, 13, |
| 2163 | 14, 15, -1, 17, 18, 19, -1, -1, -1, -1, |
| 2164 | -1, 25, 26, -1, -1, -1, 456, 457, -1, 459, |
| 2165 | 460, -1, -1, -1, 464, -1, -1, -1, -1, -1, |
| 2166 | 44, -1, 472, 47, -1, -1, -1, 51, 83, 84, |
| 2167 | 85, 86, 87, 88, 89, 90, 91, 92, -1, -1, |
| 2168 | -1, 491, -1, -1, -1, 5, 6, -1, -1, 499, |
| 2169 | -1, -1, -1, -1, 14, 15, -1, 17, 18, -1, |
| 2170 | 20, -1, 21, 22, -1, -1, -1, -1, -1, -1, |
| 2171 | -1, -1, -1, 33, 34, -1, -1, -1, 528, 135, |
| 2172 | -1, -1, 138, 533, -1, 141, -1, 143, 144, -1, |
| 2173 | -1, -1, -1, -1, -1, -1, -1, 547, 548, -1, |
| 2174 | -1, -1, 552, -1, -1, 555, 66, 67, 68, 69, |
| 2175 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2176 | 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, |
| 2177 | 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, |
| 2178 | 99, 100, 101, 102, -1, -1, -1, -1, 108, 109, |
| 2179 | 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
| 2180 | 120, -1, 122, -1, 124, 125, 126, -1, -1, -1, |
| 2181 | -1, -1, -1, -1, 134, -1, 136, -1, 138, -1, |
| 2182 | -1, 141, -1, 143, -1, 145, 3, 4, 5, 6, |
| 2183 | 7, -1, -1, -1, -1, -1, -1, 14, 15, -1, |
| 2184 | 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, |
| 2185 | -1, -1, -1, -1, -1, -1, 33, 34, -1, -1, |
| 2186 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2187 | -1, 5, 6, 50, 8, 9, 10, 11, 12, -1, |
| 2188 | 14, 15, -1, 17, 18, -1, -1, -1, -1, 66, |
| 2189 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2190 | 77, 78, 79, 80, 81, 82, -1, -1, 42, 5, |
| 2191 | 6, -1, 8, 9, 10, 11, 12, -1, 14, 15, |
| 2192 | -1, 17, 18, -1, -1, -1, -1, -1, -1, -1, |
| 2193 | -1, 108, 109, 110, 111, 112, 113, 114, 115, 116, |
| 2194 | 117, 118, 119, 120, -1, 122, 42, 124, 125, 126, |
| 2195 | -1, 3, 4, 5, 6, 7, -1, 134, -1, 136, |
| 2196 | -1, -1, 14, 15, 141, 17, 18, -1, 20, 21, |
| 2197 | 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2198 | -1, 33, 34, -1, -1, -1, -1, -1, -1, -1, |
| 2199 | -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, |
| 2200 | -1, 135, -1, -1, 138, -1, 140, 141, -1, 143, |
| 2201 | -1, -1, -1, -1, 66, 67, 68, 69, 70, 71, |
| 2202 | 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, |
| 2203 | 82, -1, -1, -1, -1, -1, -1, -1, -1, 135, |
| 2204 | -1, -1, 138, -1, -1, 141, -1, 143, -1, -1, |
| 2205 | -1, -1, -1, -1, -1, -1, 108, 109, 110, 111, |
| 2206 | 112, 113, 114, 115, 116, 117, 118, 119, 120, -1, |
| 2207 | 122, -1, 124, 125, 126, 3, 4, -1, -1, 7, |
| 2208 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, |
| 2209 | -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, |
| 2210 | -1, -1, -1, -1, -1, 33, 34, -1, -1, -1, |
| 2211 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2212 | -1, -1, 50, -1, 5, 6, -1, 8, 9, 10, |
| 2213 | 11, 12, -1, 14, 15, -1, 17, 18, 66, 67, |
| 2214 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2215 | 78, 79, 80, 81, 82, -1, -1, -1, -1, -1, |
| 2216 | -1, 42, -1, -1, -1, -1, 5, 6, -1, 8, |
| 2217 | 9, 10, 11, 12, -1, 14, 15, -1, 17, 18, |
| 2218 | 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, |
| 2219 | 118, 119, 120, 32, 122, -1, 124, 125, 126, -1, |
| 2220 | -1, -1, -1, 42, -1, 5, 6, -1, 8, 9, |
| 2221 | 10, 11, 12, 141, 14, 15, -1, 17, 18, -1, |
| 2222 | -1, 5, 6, -1, 8, 9, 10, 11, 12, -1, |
| 2223 | 14, 15, 32, 17, 18, -1, -1, -1, -1, -1, |
| 2224 | 5, 6, 42, 8, 9, 10, 11, 12, 32, 14, |
| 2225 | 15, -1, 17, 18, 135, -1, -1, 138, 42, -1, |
| 2226 | 141, -1, 143, -1, -1, -1, -1, 32, -1, 5, |
| 2227 | 6, -1, 8, 9, 10, 11, 12, 42, 14, 15, |
| 2228 | -1, 17, 18, -1, -1, 5, 6, -1, 8, 9, |
| 2229 | 10, 11, 12, -1, 14, 15, 135, 17, 18, 138, |
| 2230 | -1, -1, 141, -1, 143, -1, 42, 5, 6, -1, |
| 2231 | 8, 9, 10, 11, 12, -1, 14, 15, -1, 17, |
| 2232 | 18, -1, 42, -1, 5, 6, -1, 8, 9, 10, |
| 2233 | 11, 12, -1, 14, 15, 135, 17, 18, 138, -1, |
| 2234 | -1, 141, -1, 143, 42, -1, -1, -1, -1, -1, |
| 2235 | -1, 135, -1, -1, 138, -1, -1, 141, -1, 143, |
| 2236 | -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2237 | 135, -1, -1, 138, -1, -1, 141, -1, 143, -1, |
| 2238 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2239 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, |
| 2240 | -1, -1, 138, -1, -1, 141, -1, 143, -1, -1, |
| 2241 | -1, -1, -1, -1, -1, 135, -1, -1, 138, -1, |
| 2242 | -1, 141, -1, 143, -1, -1, -1, -1, -1, -1, |
| 2243 | -1, -1, -1, 30, -1, -1, -1, 135, -1, -1, |
| 2244 | 138, -1, -1, 141, -1, 143, -1, -1, -1, -1, |
| 2245 | -1, 48, 49, -1, 135, -1, -1, 138, -1, -1, |
| 2246 | 141, -1, 143, 60, 61, 62, 63, 64, 65, 66, |
| 2247 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2248 | 77, 78, 79, 80, 81, 82, -1, -1, -1, -1, |
| 2249 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2250 | -1, -1, -1, -1, -1, -1, 103, 104, 105, -1, |
| 2251 | -1, 108, 109, 110, 111, 112, 113, 114, 115, 116, |
| 2252 | 117, 118, 119, 120, 121, 122, 123, 124, 125, 126 |
| 2253 | }; |
| 2254 | |
| 2255 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2256 | symbol of state STATE-NUM. */ |
| 2257 | static const unsigned char yystos[] = |
| 2258 | { |
| 2259 | 0, 14, 15, 17, 18, 19, 25, 26, 44, 47, |
| 2260 | 51, 154, 156, 157, 158, 186, 187, 188, 190, 189, |
| 2261 | 45, 59, 195, 132, 50, 132, 13, 132, 35, 36, |
| 2262 | 37, 38, 39, 40, 41, 43, 131, 159, 160, 161, |
| 2263 | 0, 188, 39, 41, 162, 205, 35, 36, 37, 40, |
| 2264 | 163, 202, 204, 211, 132, 132, 138, 196, 17, 194, |
| 2265 | 5, 6, 8, 9, 10, 11, 12, 42, 135, 138, |
| 2266 | 141, 143, 154, 157, 175, 176, 208, 161, 161, 27, |
| 2267 | 28, 185, 161, 161, 16, 212, 213, 24, 144, 203, |
| 2268 | 212, 17, 17, 17, 197, 136, 4, 4, 4, 143, |
| 2269 | 8, 144, 176, 181, 134, 136, 185, 185, 9, 10, |
| 2270 | 11, 152, 153, 176, 182, 53, 54, 55, 56, 57, |
| 2271 | 58, 164, 200, 200, 156, 216, 133, 140, 32, 176, |
| 2272 | 177, 179, 180, 139, 139, 144, 181, 133, 144, 180, |
| 2273 | 182, 176, 21, 22, 3, 4, 7, 20, 33, 34, |
| 2274 | 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, |
| 2275 | 76, 77, 78, 79, 80, 81, 82, 108, 109, 110, |
| 2276 | 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 2277 | 122, 124, 125, 126, 138, 141, 143, 145, 147, 148, |
| 2278 | 149, 183, 208, 191, 4, 8, 176, 178, 23, 143, |
| 2279 | 201, 30, 48, 49, 60, 61, 62, 63, 64, 65, |
| 2280 | 81, 82, 103, 104, 105, 108, 121, 122, 123, 124, |
| 2281 | 125, 126, 147, 148, 149, 214, 220, 221, 222, 223, |
| 2282 | 17, 166, 133, 137, 176, 176, 142, 144, 176, 137, |
| 2283 | 192, 193, 83, 84, 85, 86, 87, 88, 89, 90, |
| 2284 | 91, 92, 150, 21, 22, 89, 90, 91, 92, 93, |
| 2285 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 151, |
| 2286 | 136, 136, 136, 136, 136, 140, 182, 184, 143, 184, |
| 2287 | 144, 184, 17, 136, 136, 136, 133, 173, 157, 48, |
| 2288 | 8, 176, 210, 9, 12, 9, 152, 164, 150, 151, |
| 2289 | 176, 176, 210, 176, 176, 217, 210, 210, 210, 210, |
| 2290 | 210, 176, 176, 210, 164, 106, 107, 110, 111, 128, |
| 2291 | 129, 165, 32, 177, 168, 140, 142, 142, 168, 173, |
| 2292 | 173, 136, 136, 182, 182, 182, 182, 182, 133, 140, |
| 2293 | 144, 176, 184, 142, 144, 182, 182, 182, 29, 46, |
| 2294 | 171, 174, 136, 3, 4, 7, 20, 21, 22, 33, |
| 2295 | 34, 50, 141, 183, 207, 208, 209, 209, 209, 209, |
| 2296 | 178, 176, 176, 133, 170, 133, 170, 209, 138, 133, |
| 2297 | 133, 133, 133, 133, 133, 209, 209, 31, 178, 176, |
| 2298 | 210, 127, 165, 167, 182, 182, 219, 133, 133, 133, |
| 2299 | 133, 182, 142, 144, 133, 133, 31, 17, 4, 173, |
| 2300 | 32, 176, 198, 199, 52, 206, 184, 133, 133, 209, |
| 2301 | 209, 209, 9, 46, 9, 219, 209, 138, 210, 176, |
| 2302 | 210, 210, 210, 133, 133, 176, 209, 209, 133, 133, |
| 2303 | 133, 133, 137, 182, 182, 182, 182, 142, 182, 182, |
| 2304 | 176, 166, 133, 137, 17, 142, 12, 12, 136, 133, |
| 2305 | 133, 209, 4, 209, 133, 209, 133, 133, 133, 209, |
| 2306 | 209, 136, 176, 182, 182, 210, 133, 137, 133, 133, |
| 2307 | 137, 137, 137, 154, 155, 32, 176, 168, 133, 209, |
| 2308 | 209, 176, 218, 209, 209, 133, 170, 170, 209, 133, |
| 2309 | 210, 210, 210, 218, 209, 137, 137, 182, 182, 182, |
| 2310 | 166, 171, 172, 17, 133, 138, 209, 133, 137, 140, |
| 2311 | 209, 137, 137, 137, 137, 155, 46, 169, 12, 140, |
| 2312 | 152, 215, 166, 176, 168, 140, 168, 4, 209, 207, |
| 2313 | 140, 152, 209, 31, 133, 207, 166, 12, 12, 133, |
| 2314 | 209, 209, 12, 64, 209, 12, 209 |
| 2315 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2316 | |
| 2317 | #define yyerrok (yyerrstatus = 0) |
| 2318 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2319 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2320 | #define YYEOF 0 |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2321 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2322 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2323 | #define YYABORT goto yyabortlab |
| 2324 | #define YYERROR goto yyerrorlab |
| 2325 | |
| 2326 | |
| 2327 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2328 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2329 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2330 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2331 | #define YYFAIL goto yyerrlab |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2332 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2333 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2334 | |
| 2335 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2336 | do \ |
| 2337 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2338 | { \ |
| 2339 | yychar = (Token); \ |
| 2340 | yylval = (Value); \ |
| 2341 | yytoken = YYTRANSLATE (yychar); \ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2342 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2343 | goto yybackup; \ |
| 2344 | } \ |
| 2345 | else \ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2346 | { \ |
| 2347 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2348 | YYERROR; \ |
| 2349 | } \ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2350 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2351 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2352 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2353 | #define YYTERROR 1 |
| 2354 | #define YYERRCODE 256 |
| 2355 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2356 | |
| 2357 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2358 | If N is 0, then set CURRENT to the empty location which ends |
| 2359 | the previous symbol: RHS[0] (always defined). */ |
| 2360 | |
| 2361 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2362 | #ifndef YYLLOC_DEFAULT |
| 2363 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2364 | do \ |
| 2365 | if (N) \ |
| 2366 | { \ |
| 2367 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2368 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2369 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2370 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2371 | } \ |
| 2372 | else \ |
| 2373 | { \ |
| 2374 | (Current).first_line = (Current).last_line = \ |
| 2375 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2376 | (Current).first_column = (Current).last_column = \ |
| 2377 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2378 | } \ |
| 2379 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2380 | #endif |
| 2381 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2382 | |
| 2383 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2384 | This macro was not mandated originally: define only if we know |
| 2385 | we won't break user code: when these are the locations we know. */ |
| 2386 | |
| 2387 | #ifndef YY_LOCATION_PRINT |
| 2388 | # if YYLTYPE_IS_TRIVIAL |
| 2389 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2390 | fprintf (File, "%d.%d-%d.%d", \ |
| 2391 | (Loc).first_line, (Loc).first_column, \ |
| 2392 | (Loc).last_line, (Loc).last_column) |
| 2393 | # else |
| 2394 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2395 | # endif |
| 2396 | #endif |
| 2397 | |
| 2398 | |
| 2399 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2400 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2401 | #ifdef YYLEX_PARAM |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2402 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2403 | #else |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2404 | # define YYLEX yylex () |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2405 | #endif |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2406 | |
| 2407 | /* Enable debugging if requested. */ |
| 2408 | #if YYDEBUG |
| 2409 | |
| 2410 | # ifndef YYFPRINTF |
| 2411 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2412 | # define YYFPRINTF fprintf |
| 2413 | # endif |
| 2414 | |
| 2415 | # define YYDPRINTF(Args) \ |
| 2416 | do { \ |
| 2417 | if (yydebug) \ |
| 2418 | YYFPRINTF Args; \ |
| 2419 | } while (0) |
| 2420 | |
| 2421 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2422 | do { \ |
| 2423 | if (yydebug) \ |
| 2424 | { \ |
| 2425 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2426 | yysymprint (stderr, \ |
| 2427 | Type, Value); \ |
| 2428 | YYFPRINTF (stderr, "\n"); \ |
| 2429 | } \ |
| 2430 | } while (0) |
| 2431 | |
| 2432 | /*------------------------------------------------------------------. |
| 2433 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2434 | | TOP (included). | |
| 2435 | `------------------------------------------------------------------*/ |
| 2436 | |
| 2437 | #if defined (__STDC__) || defined (__cplusplus) |
| 2438 | static void |
| 2439 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2440 | #else |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2441 | static void |
| 2442 | yy_stack_print (bottom, top) |
| 2443 | short int *bottom; |
| 2444 | short int *top; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2445 | #endif |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2446 | { |
| 2447 | YYFPRINTF (stderr, "Stack now"); |
| 2448 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2449 | YYFPRINTF (stderr, " %d", *bottom); |
| 2450 | YYFPRINTF (stderr, "\n"); |
| 2451 | } |
| 2452 | |
| 2453 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2454 | do { \ |
| 2455 | if (yydebug) \ |
| 2456 | yy_stack_print ((Bottom), (Top)); \ |
| 2457 | } while (0) |
| 2458 | |
| 2459 | |
| 2460 | /*------------------------------------------------. |
| 2461 | | Report that the YYRULE is going to be reduced. | |
| 2462 | `------------------------------------------------*/ |
| 2463 | |
| 2464 | #if defined (__STDC__) || defined (__cplusplus) |
| 2465 | static void |
| 2466 | yy_reduce_print (int yyrule) |
| 2467 | #else |
| 2468 | static void |
| 2469 | yy_reduce_print (yyrule) |
| 2470 | int yyrule; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2471 | #endif |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2472 | { |
| 2473 | int yyi; |
| 2474 | unsigned long int yylno = yyrline[yyrule]; |
| 2475 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2476 | yyrule - 1, yylno); |
| 2477 | /* Print the symbols being reduced, and their result. */ |
| 2478 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2479 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2480 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2481 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2482 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2483 | # define YY_REDUCE_PRINT(Rule) \ |
| 2484 | do { \ |
| 2485 | if (yydebug) \ |
| 2486 | yy_reduce_print (Rule); \ |
| 2487 | } while (0) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2488 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2489 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2490 | multiple parsers can coexist. */ |
| 2491 | int yydebug; |
| 2492 | #else /* !YYDEBUG */ |
| 2493 | # define YYDPRINTF(Args) |
| 2494 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2495 | # define YY_STACK_PRINT(Bottom, Top) |
| 2496 | # define YY_REDUCE_PRINT(Rule) |
| 2497 | #endif /* !YYDEBUG */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2498 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2499 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2500 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2501 | #ifndef YYINITDEPTH |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2502 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2503 | #endif |
| 2504 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2505 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2506 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2507 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2508 | Do not make this value too large; the results are undefined if |
| 2509 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2510 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2511 | |
| 2512 | #ifndef YYMAXDEPTH |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2513 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2514 | #endif |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2515 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2516 | |
| 2517 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2518 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2519 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2520 | # ifndef yystrlen |
| 2521 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2522 | # define yystrlen strlen |
| 2523 | # else |
| 2524 | /* Return the length of YYSTR. */ |
| 2525 | static YYSIZE_T |
| 2526 | # if defined (__STDC__) || defined (__cplusplus) |
| 2527 | yystrlen (const char *yystr) |
| 2528 | # else |
| 2529 | yystrlen (yystr) |
| 2530 | const char *yystr; |
| 2531 | # endif |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2532 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2533 | const char *yys = yystr; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2534 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2535 | while (*yys++ != '\0') |
| 2536 | continue; |
| 2537 | |
| 2538 | return yys - yystr - 1; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2539 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2540 | # endif |
| 2541 | # endif |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2542 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2543 | # ifndef yystpcpy |
| 2544 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2545 | # define yystpcpy stpcpy |
| 2546 | # else |
| 2547 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2548 | YYDEST. */ |
| 2549 | static char * |
| 2550 | # if defined (__STDC__) || defined (__cplusplus) |
| 2551 | yystpcpy (char *yydest, const char *yysrc) |
| 2552 | # else |
| 2553 | yystpcpy (yydest, yysrc) |
| 2554 | char *yydest; |
| 2555 | const char *yysrc; |
| 2556 | # endif |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2557 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2558 | char *yyd = yydest; |
| 2559 | const char *yys = yysrc; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2560 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2561 | while ((*yyd++ = *yys++) != '\0') |
| 2562 | continue; |
| 2563 | |
| 2564 | return yyd - 1; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2565 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2566 | # endif |
| 2567 | # endif |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2568 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2569 | # ifndef yytnamerr |
| 2570 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2571 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2572 | heuristic is that double-quoting is unnecessary unless the string |
| 2573 | contains an apostrophe, a comma, or backslash (other than |
| 2574 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2575 | null, do not copy; instead, return the length of what the result |
| 2576 | would have been. */ |
| 2577 | static YYSIZE_T |
| 2578 | yytnamerr (char *yyres, const char *yystr) |
| 2579 | { |
| 2580 | if (*yystr == '"') |
| 2581 | { |
| 2582 | size_t yyn = 0; |
| 2583 | char const *yyp = yystr; |
| 2584 | |
| 2585 | for (;;) |
| 2586 | switch (*++yyp) |
| 2587 | { |
| 2588 | case '\'': |
| 2589 | case ',': |
| 2590 | goto do_not_strip_quotes; |
| 2591 | |
| 2592 | case '\\': |
| 2593 | if (*++yyp != '\\') |
| 2594 | goto do_not_strip_quotes; |
| 2595 | /* Fall through. */ |
| 2596 | default: |
| 2597 | if (yyres) |
| 2598 | yyres[yyn] = *yyp; |
| 2599 | yyn++; |
| 2600 | break; |
| 2601 | |
| 2602 | case '"': |
| 2603 | if (yyres) |
| 2604 | yyres[yyn] = '\0'; |
| 2605 | return yyn; |
| 2606 | } |
| 2607 | do_not_strip_quotes: ; |
| 2608 | } |
| 2609 | |
| 2610 | if (! yyres) |
| 2611 | return yystrlen (yystr); |
| 2612 | |
| 2613 | return yystpcpy (yyres, yystr) - yyres; |
| 2614 | } |
| 2615 | # endif |
| 2616 | |
| 2617 | #endif /* YYERROR_VERBOSE */ |
| 2618 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2619 | |
| 2620 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2621 | #if YYDEBUG |
| 2622 | /*--------------------------------. |
| 2623 | | Print this symbol on YYOUTPUT. | |
| 2624 | `--------------------------------*/ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2625 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2626 | #if defined (__STDC__) || defined (__cplusplus) |
| 2627 | static void |
| 2628 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2629 | #else |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2630 | static void |
| 2631 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2632 | FILE *yyoutput; |
| 2633 | int yytype; |
| 2634 | YYSTYPE *yyvaluep; |
| 2635 | #endif |
| 2636 | { |
| 2637 | /* Pacify ``unused variable'' warnings. */ |
| 2638 | (void) yyvaluep; |
| 2639 | |
| 2640 | if (yytype < YYNTOKENS) |
| 2641 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2642 | else |
| 2643 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2644 | |
| 2645 | |
| 2646 | # ifdef YYPRINT |
| 2647 | if (yytype < YYNTOKENS) |
| 2648 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2649 | # endif |
| 2650 | switch (yytype) |
| 2651 | { |
| 2652 | default: |
| 2653 | break; |
| 2654 | } |
| 2655 | YYFPRINTF (yyoutput, ")"); |
| 2656 | } |
| 2657 | |
| 2658 | #endif /* ! YYDEBUG */ |
| 2659 | /*-----------------------------------------------. |
| 2660 | | Release the memory associated to this symbol. | |
| 2661 | `-----------------------------------------------*/ |
| 2662 | |
| 2663 | #if defined (__STDC__) || defined (__cplusplus) |
| 2664 | static void |
| 2665 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2666 | #else |
| 2667 | static void |
| 2668 | yydestruct (yymsg, yytype, yyvaluep) |
| 2669 | const char *yymsg; |
| 2670 | int yytype; |
| 2671 | YYSTYPE *yyvaluep; |
| 2672 | #endif |
| 2673 | { |
| 2674 | /* Pacify ``unused variable'' warnings. */ |
| 2675 | (void) yyvaluep; |
| 2676 | |
| 2677 | if (!yymsg) |
| 2678 | yymsg = "Deleting"; |
| 2679 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2680 | |
| 2681 | switch (yytype) |
| 2682 | { |
| 2683 | |
| 2684 | default: |
| 2685 | break; |
| 2686 | } |
| 2687 | } |
| 2688 | |
| 2689 | |
| 2690 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2691 | |
| 2692 | #ifdef YYPARSE_PARAM |
| 2693 | # if defined (__STDC__) || defined (__cplusplus) |
| 2694 | int yyparse (void *YYPARSE_PARAM); |
| 2695 | # else |
| 2696 | int yyparse (); |
| 2697 | # endif |
| 2698 | #else /* ! YYPARSE_PARAM */ |
| 2699 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2700 | int yyparse (void); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2701 | #else |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2702 | int yyparse (); |
| 2703 | #endif |
| 2704 | #endif /* ! YYPARSE_PARAM */ |
| 2705 | |
| 2706 | |
| 2707 | |
| 2708 | /* The look-ahead symbol. */ |
| 2709 | int yychar; |
| 2710 | |
| 2711 | /* The semantic value of the look-ahead symbol. */ |
| 2712 | YYSTYPE yylval; |
| 2713 | |
| 2714 | /* Number of syntax errors so far. */ |
| 2715 | int yynerrs; |
| 2716 | |
| 2717 | |
| 2718 | |
| 2719 | /*----------. |
| 2720 | | yyparse. | |
| 2721 | `----------*/ |
| 2722 | |
| 2723 | #ifdef YYPARSE_PARAM |
| 2724 | # if defined (__STDC__) || defined (__cplusplus) |
| 2725 | int yyparse (void *YYPARSE_PARAM) |
| 2726 | # else |
| 2727 | int yyparse (YYPARSE_PARAM) |
| 2728 | void *YYPARSE_PARAM; |
| 2729 | # endif |
| 2730 | #else /* ! YYPARSE_PARAM */ |
| 2731 | #if defined (__STDC__) || defined (__cplusplus) |
| 2732 | int |
| 2733 | yyparse (void) |
| 2734 | #else |
| 2735 | int |
| 2736 | yyparse () |
| 2737 | |
| 2738 | #endif |
| 2739 | #endif |
| 2740 | { |
| 2741 | |
| 2742 | int yystate; |
| 2743 | int yyn; |
| 2744 | int yyresult; |
| 2745 | /* Number of tokens to shift before error messages enabled. */ |
| 2746 | int yyerrstatus; |
| 2747 | /* Look-ahead token as an internal (translated) token number. */ |
| 2748 | int yytoken = 0; |
| 2749 | |
| 2750 | /* Three stacks and their tools: |
| 2751 | `yyss': related to states, |
| 2752 | `yyvs': related to semantic values, |
| 2753 | `yyls': related to locations. |
| 2754 | |
| 2755 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2756 | to reallocate them elsewhere. */ |
| 2757 | |
| 2758 | /* The state stack. */ |
| 2759 | short int yyssa[YYINITDEPTH]; |
| 2760 | short int *yyss = yyssa; |
| 2761 | short int *yyssp; |
| 2762 | |
| 2763 | /* The semantic value stack. */ |
| 2764 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2765 | YYSTYPE *yyvs = yyvsa; |
| 2766 | YYSTYPE *yyvsp; |
| 2767 | |
| 2768 | |
| 2769 | |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2770 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2771 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2772 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2773 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2774 | /* The variables used to return semantic value and location from the |
| 2775 | action routines. */ |
| 2776 | YYSTYPE yyval; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2777 | |
| 2778 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2779 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2780 | rule. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2781 | int yylen; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2782 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2783 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2784 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2785 | yystate = 0; |
| 2786 | yyerrstatus = 0; |
| 2787 | yynerrs = 0; |
| 2788 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2789 | |
| 2790 | /* Initialize stack pointers. |
| 2791 | Waste one element of value and location stack |
| 2792 | so that they stay on the same level as the state stack. |
| 2793 | The wasted elements are never initialized. */ |
| 2794 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2795 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2796 | yyvsp = yyvs; |
| 2797 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2798 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2799 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2800 | /*------------------------------------------------------------. |
| 2801 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2802 | `------------------------------------------------------------*/ |
| 2803 | yynewstate: |
| 2804 | /* In all cases, when you get here, the value and location stacks |
| 2805 | have just been pushed. so pushing a state here evens the stacks. |
| 2806 | */ |
| 2807 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2808 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2809 | yysetstate: |
| 2810 | *yyssp = yystate; |
| 2811 | |
| 2812 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2813 | { |
| 2814 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2815 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2816 | |
| 2817 | #ifdef yyoverflow |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2818 | { |
| 2819 | /* Give user a chance to reallocate the stack. Use copies of |
| 2820 | these so that the &'s don't force the real ones into |
| 2821 | memory. */ |
| 2822 | YYSTYPE *yyvs1 = yyvs; |
| 2823 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2824 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2825 | |
| 2826 | /* Each stack pointer address is followed by the size of the |
| 2827 | data in use in that stack, in bytes. This used to be a |
| 2828 | conditional around just the two extra args, but that might |
| 2829 | be undefined if yyoverflow is a macro. */ |
| 2830 | yyoverflow (YY_("memory exhausted"), |
| 2831 | &yyss1, yysize * sizeof (*yyssp), |
| 2832 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2833 | |
| 2834 | &yystacksize); |
| 2835 | |
| 2836 | yyss = yyss1; |
| 2837 | yyvs = yyvs1; |
| 2838 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2839 | #else /* no yyoverflow */ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2840 | # ifndef YYSTACK_RELOCATE |
| 2841 | goto yyexhaustedlab; |
| 2842 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2843 | /* Extend the stack our own way. */ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2844 | if (YYMAXDEPTH <= yystacksize) |
| 2845 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2846 | yystacksize *= 2; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2847 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2848 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2849 | |
| 2850 | { |
| 2851 | short int *yyss1 = yyss; |
| 2852 | union yyalloc *yyptr = |
| 2853 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2854 | if (! yyptr) |
| 2855 | goto yyexhaustedlab; |
| 2856 | YYSTACK_RELOCATE (yyss); |
| 2857 | YYSTACK_RELOCATE (yyvs); |
| 2858 | |
| 2859 | # undef YYSTACK_RELOCATE |
| 2860 | if (yyss1 != yyssa) |
| 2861 | YYSTACK_FREE (yyss1); |
| 2862 | } |
| 2863 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2864 | #endif /* no yyoverflow */ |
| 2865 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2866 | yyssp = yyss + yysize - 1; |
| 2867 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2868 | |
| 2869 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2870 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2871 | (unsigned long int) yystacksize)); |
| 2872 | |
| 2873 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2874 | YYABORT; |
| 2875 | } |
| 2876 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2877 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2878 | |
| 2879 | goto yybackup; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2880 | |
| 2881 | /*-----------. |
| 2882 | | yybackup. | |
| 2883 | `-----------*/ |
| 2884 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2885 | |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2886 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2887 | /* Read a look-ahead token if we need one and don't already have one. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2888 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2889 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2890 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2891 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2892 | yyn = yypact[yystate]; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2893 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2894 | goto yydefault; |
| 2895 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2896 | /* 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] | 2897 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2898 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2899 | if (yychar == YYEMPTY) |
| 2900 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2901 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2902 | yychar = YYLEX; |
| 2903 | } |
| 2904 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2905 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2906 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2907 | yychar = yytoken = YYEOF; |
| 2908 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2909 | } |
| 2910 | else |
| 2911 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2912 | yytoken = YYTRANSLATE (yychar); |
| 2913 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2914 | } |
| 2915 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2916 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 2917 | detect an error, take that action. */ |
| 2918 | yyn += yytoken; |
| 2919 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2920 | goto yydefault; |
| 2921 | yyn = yytable[yyn]; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2922 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2923 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2924 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2925 | goto yyerrlab; |
| 2926 | yyn = -yyn; |
| 2927 | goto yyreduce; |
| 2928 | } |
| 2929 | |
| 2930 | if (yyn == YYFINAL) |
| 2931 | YYACCEPT; |
| 2932 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2933 | /* Shift the look-ahead token. */ |
| 2934 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2935 | |
| 2936 | /* Discard the token being shifted unless it is eof. */ |
| 2937 | if (yychar != YYEOF) |
| 2938 | yychar = YYEMPTY; |
| 2939 | |
| 2940 | *++yyvsp = yylval; |
| 2941 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2942 | |
| 2943 | /* Count tokens shifted since error; after three, turn off error |
| 2944 | status. */ |
| 2945 | if (yyerrstatus) |
| 2946 | yyerrstatus--; |
Chris Lattner | 0fab59c | 2007-01-12 18:33:30 +0000 | [diff] [blame] | 2947 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2948 | yystate = yyn; |
| 2949 | goto yynewstate; |
| 2950 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 2951 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2952 | /*-----------------------------------------------------------. |
| 2953 | | yydefault -- do the default action for the current state. | |
| 2954 | `-----------------------------------------------------------*/ |
| 2955 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2956 | yyn = yydefact[yystate]; |
| 2957 | if (yyn == 0) |
| 2958 | goto yyerrlab; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2959 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2960 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2961 | |
| 2962 | /*-----------------------------. |
| 2963 | | yyreduce -- Do a reduction. | |
| 2964 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2965 | yyreduce: |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2966 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2967 | yylen = yyr2[yyn]; |
| 2968 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2969 | /* If YYLEN is nonzero, implement the default value of the action: |
| 2970 | `$$ = $1'. |
| 2971 | |
| 2972 | Otherwise, the following line sets YYVAL to garbage. |
| 2973 | This behavior is undocumented and Bison |
| 2974 | users should not rely upon it. Assigning to YYVAL |
| 2975 | unconditionally makes the parser a bit smaller, and it avoids a |
| 2976 | GCC warning that YYVAL may be used uninitialized. */ |
| 2977 | yyval = yyvsp[1-yylen]; |
| 2978 | |
| 2979 | |
| 2980 | YY_REDUCE_PRINT (yyn); |
| 2981 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2982 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2983 | case 29: |
| 2984 | #line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 2985 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 2986 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2987 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2988 | case 30: |
| 2989 | #line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 2990 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 2991 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2992 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2993 | case 31: |
| 2994 | #line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 2995 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 2996 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2997 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 2998 | case 32: |
| 2999 | #line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3000 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3001 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3002 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3003 | case 33: |
| 3004 | #line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3005 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3006 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3007 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3008 | case 34: |
| 3009 | #line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3010 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3011 | break; |
| 3012 | |
| 3013 | case 35: |
| 3014 | #line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3015 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3016 | break; |
| 3017 | |
| 3018 | case 36: |
| 3019 | #line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3020 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3021 | break; |
| 3022 | |
| 3023 | case 37: |
| 3024 | #line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3025 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3026 | break; |
| 3027 | |
| 3028 | case 38: |
| 3029 | #line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3030 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3031 | break; |
| 3032 | |
| 3033 | case 39: |
| 3034 | #line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3035 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3036 | break; |
| 3037 | |
| 3038 | case 40: |
| 3039 | #line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3040 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3041 | break; |
| 3042 | |
| 3043 | case 41: |
| 3044 | #line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3045 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3046 | break; |
| 3047 | |
| 3048 | case 42: |
| 3049 | #line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3050 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3051 | break; |
| 3052 | |
| 3053 | case 43: |
| 3054 | #line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3055 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3056 | break; |
| 3057 | |
| 3058 | case 44: |
| 3059 | #line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3060 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3061 | break; |
| 3062 | |
| 3063 | case 45: |
| 3064 | #line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3065 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3066 | break; |
| 3067 | |
| 3068 | case 46: |
| 3069 | #line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3070 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3071 | break; |
| 3072 | |
| 3073 | case 47: |
| 3074 | #line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3075 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3076 | break; |
| 3077 | |
| 3078 | case 48: |
| 3079 | #line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3080 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3081 | break; |
| 3082 | |
| 3083 | case 49: |
| 3084 | #line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3085 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3086 | break; |
| 3087 | |
| 3088 | case 50: |
| 3089 | #line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3090 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3091 | break; |
| 3092 | |
| 3093 | case 51: |
| 3094 | #line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3095 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3096 | break; |
| 3097 | |
| 3098 | case 52: |
| 3099 | #line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3100 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3101 | break; |
| 3102 | |
| 3103 | case 53: |
| 3104 | #line 1054 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3105 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3106 | break; |
| 3107 | |
| 3108 | case 54: |
| 3109 | #line 1055 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3110 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3111 | break; |
| 3112 | |
| 3113 | case 61: |
| 3114 | #line 1064 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3115 | { (yyval.StrVal) = 0; ;} |
| 3116 | break; |
| 3117 | |
| 3118 | case 62: |
| 3119 | #line 1068 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3120 | { |
| 3121 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3122 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3123 | ;} |
| 3124 | break; |
| 3125 | |
| 3126 | case 63: |
| 3127 | #line 1072 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3128 | { |
| 3129 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3130 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3131 | ;} |
| 3132 | break; |
| 3133 | |
| 3134 | case 66: |
| 3135 | #line 1079 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3136 | { |
| 3137 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3138 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3139 | ;} |
| 3140 | break; |
| 3141 | |
| 3142 | case 67: |
| 3143 | #line 1083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3144 | { |
| 3145 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3146 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3147 | ;} |
| 3148 | break; |
| 3149 | |
| 3150 | case 68: |
| 3151 | #line 1089 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3152 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3153 | break; |
| 3154 | |
| 3155 | case 69: |
| 3156 | #line 1090 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3157 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3158 | break; |
| 3159 | |
| 3160 | case 70: |
| 3161 | #line 1091 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3162 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3163 | break; |
| 3164 | |
| 3165 | case 71: |
| 3166 | #line 1092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3167 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3168 | break; |
| 3169 | |
| 3170 | case 72: |
| 3171 | #line 1093 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3172 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3173 | break; |
| 3174 | |
| 3175 | case 73: |
| 3176 | #line 1097 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3177 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3178 | break; |
| 3179 | |
| 3180 | case 74: |
| 3181 | #line 1098 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3182 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3183 | break; |
| 3184 | |
| 3185 | case 75: |
| 3186 | #line 1099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3187 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3188 | break; |
| 3189 | |
| 3190 | case 76: |
| 3191 | #line 1103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3192 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3193 | break; |
| 3194 | |
| 3195 | case 77: |
| 3196 | #line 1104 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3197 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3198 | break; |
| 3199 | |
| 3200 | case 78: |
| 3201 | #line 1108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3202 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3203 | break; |
| 3204 | |
| 3205 | case 79: |
| 3206 | #line 1109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3207 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3208 | break; |
| 3209 | |
| 3210 | case 80: |
| 3211 | #line 1110 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3212 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3213 | break; |
| 3214 | |
| 3215 | case 81: |
| 3216 | #line 1114 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3217 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3218 | break; |
| 3219 | |
| 3220 | case 82: |
| 3221 | #line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3222 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3223 | break; |
| 3224 | |
| 3225 | case 83: |
| 3226 | #line 1116 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3227 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3228 | break; |
| 3229 | |
| 3230 | case 84: |
| 3231 | #line 1117 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3232 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3233 | break; |
| 3234 | |
| 3235 | case 85: |
| 3236 | #line 1118 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3237 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3238 | break; |
| 3239 | |
| 3240 | case 86: |
| 3241 | #line 1121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3242 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3243 | break; |
| 3244 | |
| 3245 | case 87: |
| 3246 | #line 1122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3247 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3248 | break; |
| 3249 | |
| 3250 | case 88: |
| 3251 | #line 1123 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3252 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3253 | break; |
| 3254 | |
| 3255 | case 89: |
| 3256 | #line 1124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3257 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3258 | break; |
| 3259 | |
| 3260 | case 90: |
| 3261 | #line 1125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3262 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3263 | break; |
| 3264 | |
| 3265 | case 91: |
| 3266 | #line 1126 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3267 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3268 | break; |
| 3269 | |
| 3270 | case 92: |
| 3271 | #line 1127 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3272 | { |
| 3273 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3274 | GEN_ERROR("Calling conv too large"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3275 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3276 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3277 | ;} |
| 3278 | break; |
| 3279 | |
| 3280 | case 93: |
| 3281 | #line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3282 | { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;} |
| 3283 | break; |
| 3284 | |
| 3285 | case 94: |
| 3286 | #line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3287 | { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;} |
| 3288 | break; |
| 3289 | |
| 3290 | case 95: |
| 3291 | #line 1136 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3292 | { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;} |
| 3293 | break; |
| 3294 | |
| 3295 | case 96: |
| 3296 | #line 1137 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3297 | { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;} |
| 3298 | break; |
| 3299 | |
| 3300 | case 97: |
| 3301 | #line 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3302 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
| 3303 | break; |
| 3304 | |
| 3305 | case 98: |
| 3306 | #line 1141 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3307 | { |
| 3308 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3309 | ;} |
| 3310 | break; |
| 3311 | |
| 3312 | case 99: |
| 3313 | #line 1146 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3314 | { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;} |
| 3315 | break; |
| 3316 | |
| 3317 | case 101: |
| 3318 | #line 1150 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3319 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
| 3320 | break; |
| 3321 | |
| 3322 | case 102: |
| 3323 | #line 1151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3324 | { |
| 3325 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3326 | ;} |
| 3327 | break; |
| 3328 | |
| 3329 | case 103: |
| 3330 | #line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3331 | { (yyval.UIntVal) = 0; ;} |
| 3332 | break; |
| 3333 | |
| 3334 | case 104: |
| 3335 | #line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3336 | { |
| 3337 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3338 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3339 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3340 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3341 | ;} |
| 3342 | break; |
| 3343 | |
| 3344 | case 105: |
| 3345 | #line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3346 | { (yyval.UIntVal) = 0; ;} |
| 3347 | break; |
| 3348 | |
| 3349 | case 106: |
| 3350 | #line 1166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3351 | { |
| 3352 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3353 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3354 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3355 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3356 | ;} |
| 3357 | break; |
| 3358 | |
| 3359 | case 107: |
| 3360 | #line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3361 | { |
| 3362 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3363 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3364 | GEN_ERROR("Invalid character in section name"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3365 | (yyval.StrVal) = (yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3366 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3367 | ;} |
| 3368 | break; |
| 3369 | |
| 3370 | case 108: |
| 3371 | #line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3372 | { (yyval.StrVal) = 0; ;} |
| 3373 | break; |
| 3374 | |
| 3375 | case 109: |
| 3376 | #line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3377 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3378 | break; |
| 3379 | |
| 3380 | case 110: |
| 3381 | #line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3382 | {;} |
| 3383 | break; |
| 3384 | |
| 3385 | case 111: |
| 3386 | #line 1189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3387 | {;} |
| 3388 | break; |
| 3389 | |
| 3390 | case 112: |
| 3391 | #line 1190 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3392 | { |
| 3393 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3394 | free((yyvsp[0].StrVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3395 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3396 | ;} |
| 3397 | break; |
| 3398 | |
| 3399 | case 113: |
| 3400 | #line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3401 | { |
| 3402 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3403 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3404 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3405 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3406 | ;} |
| 3407 | break; |
| 3408 | |
| 3409 | case 118: |
| 3410 | #line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3411 | { |
| 3412 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3413 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3414 | ;} |
| 3415 | break; |
| 3416 | |
| 3417 | case 119: |
| 3418 | #line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3419 | { |
| 3420 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3421 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3422 | ;} |
| 3423 | break; |
| 3424 | |
| 3425 | case 120: |
| 3426 | #line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3427 | { // Pointer type? |
| 3428 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3429 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3430 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3431 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3432 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3433 | ;} |
| 3434 | break; |
| 3435 | |
| 3436 | case 121: |
| 3437 | #line 1226 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3438 | { // Named types are also simple types... |
| 3439 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3440 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3441 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 3442 | ;} |
| 3443 | break; |
| 3444 | |
| 3445 | case 122: |
| 3446 | #line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3447 | { // Type UpReference |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3448 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3449 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3450 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3451 | (yyval.TypeVal) = new PATypeHolder(OT); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3452 | UR_OUT("New Upreference!\n"); |
| 3453 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3454 | ;} |
| 3455 | break; |
| 3456 | |
| 3457 | case 123: |
| 3458 | #line 1239 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3459 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3460 | std::vector<const Type*> Params; |
| 3461 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3462 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3463 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3464 | Params.push_back(I->Ty->get()); |
| 3465 | if (I->Ty->get() != Type::VoidTy) |
| 3466 | Attrs.push_back(I->Attrs); |
| 3467 | } |
| 3468 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3469 | if (isVarArg) Params.pop_back(); |
| 3470 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3471 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs); |
| 3472 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3473 | delete (yyvsp[-4].TypeVal); // Delete the return type handle |
| 3474 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3475 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3476 | ;} |
| 3477 | break; |
| 3478 | |
| 3479 | case 124: |
| 3480 | #line 1257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3481 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3482 | std::vector<const Type*> Params; |
| 3483 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3484 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3485 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3486 | Params.push_back(I->Ty->get()); |
| 3487 | if (I->Ty->get() != Type::VoidTy) |
| 3488 | Attrs.push_back(I->Attrs); |
| 3489 | } |
| 3490 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3491 | if (isVarArg) Params.pop_back(); |
| 3492 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3493 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs); |
| 3494 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3495 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3496 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3497 | ;} |
| 3498 | break; |
| 3499 | |
| 3500 | case 125: |
| 3501 | #line 1275 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3502 | { // Sized array type? |
| 3503 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3504 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3505 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3506 | ;} |
| 3507 | break; |
| 3508 | |
| 3509 | case 126: |
| 3510 | #line 1280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3511 | { // Packed array type? |
| 3512 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3513 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3514 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3515 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 3516 | GEN_ERROR("Element type of a PackedType must be primitive"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3517 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3518 | GEN_ERROR("Vector length should be a power of 2"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3519 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3520 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3521 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3522 | ;} |
| 3523 | break; |
| 3524 | |
| 3525 | case 127: |
| 3526 | #line 1292 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3527 | { // Structure type? |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3528 | std::vector<const Type*> Elements; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3529 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3530 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3531 | Elements.push_back(*I); |
| 3532 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3533 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3534 | delete (yyvsp[-1].TypeList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3535 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3536 | ;} |
| 3537 | break; |
| 3538 | |
| 3539 | case 128: |
| 3540 | #line 1302 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3541 | { // Empty structure type? |
| 3542 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3543 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3544 | ;} |
| 3545 | break; |
| 3546 | |
| 3547 | case 129: |
| 3548 | #line 1306 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3549 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3550 | std::vector<const Type*> Elements; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3551 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 3552 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3553 | Elements.push_back(*I); |
| 3554 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3555 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3556 | delete (yyvsp[-2].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3557 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3558 | ;} |
| 3559 | break; |
| 3560 | |
| 3561 | case 130: |
| 3562 | #line 1316 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3563 | { // Empty structure type? |
| 3564 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3565 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3566 | ;} |
| 3567 | break; |
| 3568 | |
| 3569 | case 131: |
| 3570 | #line 1323 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3571 | { |
| 3572 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3573 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3574 | ;} |
| 3575 | break; |
| 3576 | |
| 3577 | case 132: |
| 3578 | #line 1330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3579 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3580 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3581 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 3582 | if (!(*(yyvsp[0].TypeVal))->isFirstClassType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3583 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3584 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
| 3585 | ;} |
| 3586 | break; |
| 3587 | |
| 3588 | case 133: |
| 3589 | #line 1337 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3590 | { |
| 3591 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 3592 | ;} |
| 3593 | break; |
| 3594 | |
| 3595 | case 134: |
| 3596 | #line 1342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3597 | { |
| 3598 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3599 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3600 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3601 | ;} |
| 3602 | break; |
| 3603 | |
| 3604 | case 135: |
| 3605 | #line 1347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3606 | { |
| 3607 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3608 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3609 | ;} |
| 3610 | break; |
| 3611 | |
| 3612 | case 137: |
| 3613 | #line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3614 | { |
| 3615 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3616 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3617 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3618 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3619 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3620 | ;} |
| 3621 | break; |
| 3622 | |
| 3623 | case 138: |
| 3624 | #line 1362 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3625 | { |
| 3626 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3627 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3628 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3629 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3630 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3631 | ;} |
| 3632 | break; |
| 3633 | |
| 3634 | case 139: |
| 3635 | #line 1369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3636 | { |
| 3637 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3638 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3639 | ;} |
| 3640 | break; |
| 3641 | |
| 3642 | case 140: |
| 3643 | #line 1377 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3644 | { |
| 3645 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 3646 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3647 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3648 | ;} |
| 3649 | break; |
| 3650 | |
| 3651 | case 141: |
| 3652 | #line 1382 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3653 | { |
| 3654 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3655 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3656 | ;} |
| 3657 | break; |
| 3658 | |
| 3659 | case 142: |
| 3660 | #line 1393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3661 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3662 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3663 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3664 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3665 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3666 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3667 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3668 | const Type *ETy = ATy->getElementType(); |
| 3669 | int NumElements = ATy->getNumElements(); |
| 3670 | |
| 3671 | // Verify that we have the correct size... |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3672 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3673 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3674 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3675 | itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3676 | |
| 3677 | // Verify all elements are correct type! |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3678 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3679 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3680 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3681 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3682 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3683 | } |
| 3684 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3685 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3686 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3687 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3688 | ;} |
| 3689 | break; |
| 3690 | |
| 3691 | case 143: |
| 3692 | #line 1421 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3693 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3694 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3695 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3696 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3697 | if (ATy == 0) |
| 3698 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3699 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3700 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3701 | int NumElements = ATy->getNumElements(); |
| 3702 | if (NumElements != -1 && NumElements != 0) |
| 3703 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3704 | " arguments, but has size of " + itostr(NumElements) +""); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3705 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3706 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3707 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3708 | ;} |
| 3709 | break; |
| 3710 | |
| 3711 | case 144: |
| 3712 | #line 1437 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3713 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3714 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3715 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3716 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3717 | if (ATy == 0) |
| 3718 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3719 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3720 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3721 | int NumElements = ATy->getNumElements(); |
| 3722 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3723 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 3724 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3725 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3726 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3727 | " when array has size " + itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3728 | std::vector<Constant*> Vals; |
| 3729 | if (ETy == Type::Int8Ty) { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3730 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3731 | C != (unsigned char*)EndStr; ++C) |
| 3732 | Vals.push_back(ConstantInt::get(ETy, *C)); |
| 3733 | } else { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3734 | free((yyvsp[0].StrVal)); |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3735 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3736 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3737 | free((yyvsp[0].StrVal)); |
| 3738 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3739 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3740 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3741 | ;} |
| 3742 | break; |
| 3743 | |
| 3744 | case 145: |
| 3745 | #line 1466 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3746 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3747 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3748 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3749 | const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3750 | if (PTy == 0) |
| 3751 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3752 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3753 | const Type *ETy = PTy->getElementType(); |
| 3754 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3755 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3756 | // Verify that we have the correct size... |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3757 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3758 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3759 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3760 | itostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3761 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3762 | // Verify all elements are correct type! |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3763 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3764 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3765 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3766 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3767 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3768 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3769 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3770 | (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); |
| 3771 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3772 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3773 | ;} |
| 3774 | break; |
| 3775 | |
| 3776 | case 146: |
| 3777 | #line 1494 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3778 | { |
| 3779 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3780 | if (STy == 0) |
| 3781 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3782 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3783 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3784 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3785 | GEN_ERROR("Illegal number of initializers for structure type"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3786 | |
| 3787 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3788 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
| 3789 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3790 | GEN_ERROR("Expected type '" + |
| 3791 | STy->getElementType(i)->getDescription() + |
| 3792 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3793 | " of structure initializer"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3794 | |
| 3795 | // Check to ensure that Type is not packed |
| 3796 | if (STy->isPacked()) |
| 3797 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3798 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3799 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 3800 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3801 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3802 | ;} |
| 3803 | break; |
| 3804 | |
| 3805 | case 147: |
| 3806 | #line 1519 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3807 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3808 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3809 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3810 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3811 | if (STy == 0) |
| 3812 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3813 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3814 | |
| 3815 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3816 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3817 | |
| 3818 | // Check to ensure that Type is not packed |
| 3819 | if (STy->isPacked()) |
| 3820 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3821 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3822 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3823 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3824 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3825 | ;} |
| 3826 | break; |
| 3827 | |
| 3828 | case 148: |
| 3829 | #line 1538 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3830 | { |
| 3831 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3832 | if (STy == 0) |
| 3833 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3834 | (*(yyvsp[-5].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3835 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3836 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3837 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3838 | |
| 3839 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3840 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) |
| 3841 | if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3842 | GEN_ERROR("Expected type '" + |
| 3843 | STy->getElementType(i)->getDescription() + |
| 3844 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3845 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3846 | |
| 3847 | // Check to ensure that Type is packed |
| 3848 | if (!STy->isPacked()) |
| 3849 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3850 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3851 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector)); |
| 3852 | delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3853 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3854 | ;} |
| 3855 | break; |
| 3856 | |
| 3857 | case 149: |
| 3858 | #line 1563 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3859 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3860 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3861 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 3862 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3863 | if (STy == 0) |
| 3864 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3865 | (*(yyvsp[-4].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3866 | |
| 3867 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3868 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3869 | |
| 3870 | // Check to ensure that Type is packed |
| 3871 | if (!STy->isPacked()) |
| 3872 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3873 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3874 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3875 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3876 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3877 | ;} |
| 3878 | break; |
| 3879 | |
| 3880 | case 150: |
| 3881 | #line 1582 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3882 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3883 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3884 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3885 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3886 | if (PTy == 0) |
| 3887 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3888 | (*(yyvsp[-1].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3889 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3890 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 3891 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3892 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3893 | ;} |
| 3894 | break; |
| 3895 | |
| 3896 | case 151: |
| 3897 | #line 1594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3898 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3899 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3900 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3901 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 3902 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3903 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3904 | ;} |
| 3905 | break; |
| 3906 | |
| 3907 | case 152: |
| 3908 | #line 1601 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3909 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3910 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3911 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3912 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3913 | if (Ty == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3914 | GEN_ERROR("Global const reference must be a pointer type"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3915 | |
| 3916 | // ConstExprs can exist in the body of a function, thus creating |
| 3917 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3918 | // the context of a function, getValNonImprovising will search the functions |
| 3919 | // symbol table instead of the module symbol table for the global symbol, |
| 3920 | // which throws things all off. To get around this, we just tell |
| 3921 | // getValNonImprovising that we are at global scope here. |
| 3922 | // |
| 3923 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3924 | CurFun.CurrentFunction = 0; |
| 3925 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3926 | Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3927 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3928 | |
| 3929 | CurFun.CurrentFunction = SavedCurFn; |
| 3930 | |
| 3931 | // If this is an initializer for a constant pointer, which is referencing a |
| 3932 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3933 | // in the future with the right type of variable. |
| 3934 | // |
| 3935 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame^] | 3936 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3937 | const PointerType *PT = cast<PointerType>(Ty); |
| 3938 | |
| 3939 | // First check to see if the forward references value is already created! |
| 3940 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3941 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3942 | |
| 3943 | if (I != CurModule.GlobalRefs.end()) { |
| 3944 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3945 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3946 | } else { |
| 3947 | std::string Name; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3948 | if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName) |
| 3949 | Name = (yyvsp[0].ValIDVal).Name; |
| 3950 | else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3951 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3952 | |
| 3953 | // Create the forward referenced global. |
| 3954 | GlobalValue *GV; |
| 3955 | if (const FunctionType *FTy = |
| 3956 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3957 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3958 | CurModule.CurrentModule); |
| 3959 | } else { |
| 3960 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3961 | GlobalValue::ExternalLinkage, 0, |
| 3962 | Name, CurModule.CurrentModule); |
| 3963 | } |
| 3964 | |
| 3965 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3966 | 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] | 3967 | V = GV; |
| 3968 | } |
| 3969 | } |
| 3970 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3971 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 3972 | delete (yyvsp[-1].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3973 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3974 | ;} |
| 3975 | break; |
| 3976 | |
| 3977 | case 153: |
| 3978 | #line 1667 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3979 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3980 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3981 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3982 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3983 | GEN_ERROR("Mismatched types for constant expression: " + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3984 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); |
| 3985 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 3986 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3987 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3988 | ;} |
| 3989 | break; |
| 3990 | |
| 3991 | case 154: |
| 3992 | #line 1677 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3993 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3994 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3995 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3996 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3997 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3998 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 3999 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4000 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4001 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4002 | ;} |
| 4003 | break; |
| 4004 | |
| 4005 | case 155: |
| 4006 | #line 1687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4007 | { // integral constants |
| 4008 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4009 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4010 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4011 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4012 | ;} |
| 4013 | break; |
| 4014 | |
| 4015 | case 156: |
| 4016 | #line 1693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4017 | { // integral constants |
| 4018 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4019 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4020 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4021 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4022 | ;} |
| 4023 | break; |
| 4024 | |
| 4025 | case 157: |
| 4026 | #line 1699 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4027 | { // Boolean constants |
| 4028 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4029 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4030 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4031 | ;} |
| 4032 | break; |
| 4033 | |
| 4034 | case 158: |
| 4035 | #line 1704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4036 | { // Boolean constants |
| 4037 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4038 | (yyval.ConstVal) = ConstantInt::getFalse(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4039 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4040 | ;} |
| 4041 | break; |
| 4042 | |
| 4043 | case 159: |
| 4044 | #line 1709 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4045 | { // Float & Double constants |
| 4046 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4047 | GEN_ERROR("Floating point constant invalid for type"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4048 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4049 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4050 | ;} |
| 4051 | break; |
| 4052 | |
| 4053 | case 160: |
| 4054 | #line 1717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4055 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4056 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4057 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4058 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4059 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4060 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4061 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4062 | Val->getType()->getDescription() + "' to '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4063 | DestTy->getDescription() + "'"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4064 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
| 4065 | delete (yyvsp[-1].TypeVal); |
| 4066 | ;} |
| 4067 | break; |
| 4068 | |
| 4069 | case 161: |
| 4070 | #line 1729 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4071 | { |
| 4072 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4073 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4074 | |
| 4075 | const Type *IdxTy = |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4076 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4077 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4078 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4079 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4080 | SmallVector<Constant*, 8> IdxVec; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4081 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 4082 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4083 | IdxVec.push_back(C); |
| 4084 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4085 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4086 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4087 | delete (yyvsp[-1].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4088 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4089 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4090 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4091 | ;} |
| 4092 | break; |
| 4093 | |
| 4094 | case 162: |
| 4095 | #line 1750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4096 | { |
| 4097 | if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4098 | GEN_ERROR("Select condition must be of boolean type"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4099 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4100 | GEN_ERROR("Select operand types must match"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4101 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4102 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4103 | ;} |
| 4104 | break; |
| 4105 | |
| 4106 | case 163: |
| 4107 | #line 1758 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4108 | { |
| 4109 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4110 | GEN_ERROR("Binary operator types must match"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4111 | CHECK_FOR_ERROR; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4112 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4113 | ;} |
| 4114 | break; |
| 4115 | |
| 4116 | case 164: |
| 4117 | #line 1764 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4118 | { |
| 4119 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4120 | GEN_ERROR("Logical operator types must match"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4121 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) { |
| 4122 | if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<PackedType>((yyvsp[-3].ConstVal)->getType()) || |
| 4123 | !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4124 | GEN_ERROR("Logical operator requires integral operands"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4125 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4126 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4127 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4128 | ;} |
| 4129 | break; |
| 4130 | |
| 4131 | case 165: |
| 4132 | #line 1775 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4133 | { |
| 4134 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4135 | GEN_ERROR("icmp operand types must match"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4136 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4137 | ;} |
| 4138 | break; |
| 4139 | |
| 4140 | case 166: |
| 4141 | #line 1780 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4142 | { |
| 4143 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4144 | GEN_ERROR("fcmp operand types must match"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4145 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4146 | ;} |
| 4147 | break; |
| 4148 | |
| 4149 | case 167: |
| 4150 | #line 1785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4151 | { |
| 4152 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4153 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4154 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4155 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4156 | ;} |
| 4157 | break; |
| 4158 | |
| 4159 | case 168: |
| 4160 | #line 1791 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4161 | { |
| 4162 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4163 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4164 | (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] | 4165 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4166 | ;} |
| 4167 | break; |
| 4168 | |
| 4169 | case 169: |
| 4170 | #line 1797 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4171 | { |
| 4172 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4173 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4174 | (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] | 4175 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4176 | ;} |
| 4177 | break; |
| 4178 | |
| 4179 | case 170: |
| 4180 | #line 1806 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4181 | { |
| 4182 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4183 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4184 | ;} |
| 4185 | break; |
| 4186 | |
| 4187 | case 171: |
| 4188 | #line 1810 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4189 | { |
| 4190 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4191 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4192 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4193 | ;} |
| 4194 | break; |
| 4195 | |
| 4196 | case 172: |
| 4197 | #line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4198 | { (yyval.BoolVal) = false; ;} |
| 4199 | break; |
| 4200 | |
| 4201 | case 173: |
| 4202 | #line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4203 | { (yyval.BoolVal) = true; ;} |
| 4204 | break; |
| 4205 | |
| 4206 | case 174: |
| 4207 | #line 1829 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4208 | { |
| 4209 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4210 | CurModule.ModuleDone(); |
| 4211 | CHECK_FOR_ERROR; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4212 | ;} |
| 4213 | break; |
| 4214 | |
| 4215 | case 175: |
| 4216 | #line 1834 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4217 | { |
| 4218 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4219 | CurModule.ModuleDone(); |
| 4220 | CHECK_FOR_ERROR; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4221 | ;} |
| 4222 | break; |
| 4223 | |
| 4224 | case 178: |
| 4225 | #line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4226 | { CurFun.isDeclare = false; ;} |
| 4227 | break; |
| 4228 | |
| 4229 | case 179: |
| 4230 | #line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4231 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4232 | CurFun.FunctionDone(); |
| 4233 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4234 | ;} |
| 4235 | break; |
| 4236 | |
| 4237 | case 180: |
| 4238 | #line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4239 | { CurFun.isDeclare = true; ;} |
| 4240 | break; |
| 4241 | |
| 4242 | case 181: |
| 4243 | #line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4244 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4245 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4246 | ;} |
| 4247 | break; |
| 4248 | |
| 4249 | case 182: |
| 4250 | #line 1854 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4251 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4252 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4253 | ;} |
| 4254 | break; |
| 4255 | |
| 4256 | case 183: |
| 4257 | #line 1857 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4258 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4259 | // Emit an error if there are any unresolved types left. |
| 4260 | if (!CurModule.LateResolveTypes.empty()) { |
| 4261 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4262 | if (DID.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4263 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4264 | } else { |
| 4265 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4266 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4267 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4268 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4269 | ;} |
| 4270 | break; |
| 4271 | |
| 4272 | case 184: |
| 4273 | #line 1869 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4274 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4275 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4276 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4277 | // Eagerly resolve types. This is not an optimization, this is a |
| 4278 | // requirement that is due to the fact that we could have this: |
| 4279 | // |
| 4280 | // %list = type { %list * } |
| 4281 | // %list = type { %list * } ; repeated type decl |
| 4282 | // |
| 4283 | // If types are not resolved eagerly, then the two types will not be |
| 4284 | // determined to be the same type! |
| 4285 | // |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4286 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4287 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4288 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4289 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4290 | // If this is a named type that is not a redefinition, add it to the slot |
| 4291 | // table. |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4292 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4293 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4294 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4295 | delete (yyvsp[0].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4296 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4297 | ;} |
| 4298 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4299 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4300 | case 185: |
| 4301 | #line 1893 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4302 | { |
| 4303 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); |
| 4304 | |
| 4305 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4306 | CHECK_FOR_ERROR |
| 4307 | // If this is a named type that is not a redefinition, add it to the slot |
| 4308 | // table. |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4309 | CurModule.Types.push_back((yyvsp[0].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4310 | } |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4311 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4312 | ;} |
| 4313 | break; |
| 4314 | |
| 4315 | case 186: |
| 4316 | #line 1904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4317 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4318 | /* "Externally Visible" Linkage */ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4319 | if ((yyvsp[0].ConstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4320 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4321 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, |
| 4322 | (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4323 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4324 | ;} |
| 4325 | break; |
| 4326 | |
| 4327 | case 187: |
| 4328 | #line 1911 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4329 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4330 | CurGV = 0; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4331 | ;} |
| 4332 | break; |
| 4333 | |
| 4334 | case 188: |
| 4335 | #line 1914 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4336 | { |
| 4337 | if ((yyvsp[0].ConstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4338 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4339 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4340 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4341 | ;} |
| 4342 | break; |
| 4343 | |
| 4344 | case 189: |
| 4345 | #line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4346 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4347 | CurGV = 0; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4348 | ;} |
| 4349 | break; |
| 4350 | |
| 4351 | case 190: |
| 4352 | #line 1922 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4353 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4354 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4355 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 4356 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4357 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4358 | delete (yyvsp[0].TypeVal); |
| 4359 | ;} |
| 4360 | break; |
| 4361 | |
| 4362 | case 191: |
| 4363 | #line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4364 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4365 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4366 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4367 | ;} |
| 4368 | break; |
| 4369 | |
| 4370 | case 192: |
| 4371 | #line 1932 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4372 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4373 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4374 | ;} |
| 4375 | break; |
| 4376 | |
| 4377 | case 193: |
| 4378 | #line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4379 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4380 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4381 | ;} |
| 4382 | break; |
| 4383 | |
| 4384 | case 194: |
| 4385 | #line 1941 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4386 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4387 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4388 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4389 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4390 | free((yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4391 | |
| 4392 | if (AsmSoFar.empty()) |
| 4393 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4394 | else |
| 4395 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4396 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4397 | ;} |
| 4398 | break; |
| 4399 | |
| 4400 | case 195: |
| 4401 | #line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4402 | { |
| 4403 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4404 | free((yyvsp[0].StrVal)); |
| 4405 | ;} |
| 4406 | break; |
| 4407 | |
| 4408 | case 196: |
| 4409 | #line 1958 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4410 | { |
| 4411 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4412 | free((yyvsp[0].StrVal)); |
| 4413 | ;} |
| 4414 | break; |
| 4415 | |
| 4416 | case 198: |
| 4417 | #line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4418 | { |
| 4419 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4420 | free((yyvsp[0].StrVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4421 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4422 | ;} |
| 4423 | break; |
| 4424 | |
| 4425 | case 199: |
| 4426 | #line 1970 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4427 | { |
| 4428 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4429 | free((yyvsp[0].StrVal)); |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 4430 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4431 | ;} |
| 4432 | break; |
| 4433 | |
| 4434 | case 200: |
| 4435 | #line 1975 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4436 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4437 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4438 | ;} |
| 4439 | break; |
| 4440 | |
| 4441 | case 201: |
| 4442 | #line 1984 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4443 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4444 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4445 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4446 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4447 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4448 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4449 | (yyval.ArgList) = (yyvsp[-4].ArgList); |
| 4450 | (yyvsp[-4].ArgList)->push_back(E); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4451 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4452 | ;} |
| 4453 | break; |
| 4454 | |
| 4455 | case 202: |
| 4456 | #line 1994 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4457 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4458 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4459 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4460 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4461 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4462 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4463 | (yyval.ArgList) = new ArgListType; |
| 4464 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4465 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4466 | ;} |
| 4467 | break; |
| 4468 | |
| 4469 | case 203: |
| 4470 | #line 2005 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4471 | { |
| 4472 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4473 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4474 | ;} |
| 4475 | break; |
| 4476 | |
| 4477 | case 204: |
| 4478 | #line 2009 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4479 | { |
| 4480 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4481 | struct ArgListEntry E; |
| 4482 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4483 | E.Name = 0; |
| 4484 | E.Attrs = FunctionType::NoAttributeSet; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4485 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4486 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4487 | ;} |
| 4488 | break; |
| 4489 | |
| 4490 | case 205: |
| 4491 | #line 2018 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4492 | { |
| 4493 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4494 | struct ArgListEntry E; |
| 4495 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4496 | E.Name = 0; |
| 4497 | E.Attrs = FunctionType::NoAttributeSet; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4498 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4499 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4500 | ;} |
| 4501 | break; |
| 4502 | |
| 4503 | case 206: |
| 4504 | #line 2027 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4505 | { |
| 4506 | (yyval.ArgList) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4507 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4508 | ;} |
| 4509 | break; |
| 4510 | |
| 4511 | case 207: |
| 4512 | #line 2033 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4513 | { |
| 4514 | UnEscapeLexed((yyvsp[-6].StrVal)); |
| 4515 | std::string FunctionName((yyvsp[-6].StrVal)); |
| 4516 | free((yyvsp[-6].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4517 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4518 | // Check the function result for abstractness if this is a define. We should |
| 4519 | // have no abstract types at this point |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4520 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal))) |
| 4521 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4522 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4523 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4524 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4525 | ParamAttrs.push_back((yyvsp[-2].ParamAttrs)); |
| 4526 | if ((yyvsp[-4].ArgList)) { // If there are arguments... |
| 4527 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4528 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4529 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4530 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4531 | ParamTypeList.push_back(Ty); |
| 4532 | if (Ty != Type::VoidTy) |
| 4533 | ParamAttrs.push_back(I->Attrs); |
| 4534 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4535 | } |
| 4536 | |
| 4537 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4538 | if (isVarArg) ParamTypeList.pop_back(); |
| 4539 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4540 | FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4541 | ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4542 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4543 | delete (yyvsp[-7].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4544 | |
| 4545 | ValID ID; |
| 4546 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4547 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4548 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4549 | ID = ValID::createGlobalID(CurModule.Values[PFT].size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4550 | } |
| 4551 | |
| 4552 | Function *Fn = 0; |
| 4553 | // See if this function was forward referenced. If so, recycle the object. |
| 4554 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4555 | // Move the function to the end of the list, from whereever it was |
| 4556 | // previously inserted. |
| 4557 | Fn = cast<Function>(FWRef); |
| 4558 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4559 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4560 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4561 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4562 | // If this is the case, either we need to be a forward decl, or it needs |
| 4563 | // to be. |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4564 | if (!CurFun.isDeclare && !Fn->isDeclaration()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4565 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4566 | |
| 4567 | // Make sure to strip off any argument names so we can't get conflicts. |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4568 | if (Fn->isDeclaration()) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4569 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4570 | AI != AE; ++AI) |
| 4571 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4572 | } else { // Not already defined? |
| 4573 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4574 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4575 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4576 | InsertValue(Fn, CurModule.Values); |
| 4577 | } |
| 4578 | |
| 4579 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4580 | |
| 4581 | if (CurFun.isDeclare) { |
| 4582 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4583 | // correctly handle cases, when pointer to function is passed as argument to |
| 4584 | // another function. |
| 4585 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4586 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4587 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4588 | Fn->setCallingConv((yyvsp[-8].UIntVal)); |
| 4589 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4590 | if ((yyvsp[-1].StrVal)) { |
| 4591 | Fn->setSection((yyvsp[-1].StrVal)); |
| 4592 | free((yyvsp[-1].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4593 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4594 | |
| 4595 | // Add all of the arguments we parsed to the function... |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4596 | if ((yyvsp[-4].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4597 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4598 | 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^] | 4599 | "Not a varargs marker!"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4600 | delete (yyvsp[-4].ArgList)->back().Ty; |
| 4601 | (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4602 | } |
| 4603 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4604 | unsigned Idx = 1; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4605 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4606 | delete I->Ty; // Delete the typeholder... |
| 4607 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4608 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4609 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4610 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4611 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4612 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4613 | delete (yyvsp[-4].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4614 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4615 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4616 | ;} |
| 4617 | break; |
| 4618 | |
| 4619 | case 210: |
| 4620 | #line 2140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4621 | { |
| 4622 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4623 | |
| 4624 | // Make sure that we keep track of the linkage type even if there was a |
| 4625 | // previous "declare". |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4626 | (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage)); |
| 4627 | (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility)); |
| 4628 | ;} |
| 4629 | break; |
| 4630 | |
| 4631 | case 213: |
| 4632 | #line 2151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4633 | { |
| 4634 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4635 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4636 | ;} |
| 4637 | break; |
| 4638 | |
| 4639 | case 214: |
| 4640 | #line 2156 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4641 | { |
| 4642 | CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); |
| 4643 | CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); |
| 4644 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4645 | CurFun.FunctionDone(); |
| 4646 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4647 | ;} |
| 4648 | break; |
| 4649 | |
| 4650 | case 215: |
| 4651 | #line 2168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4652 | { |
| 4653 | (yyval.BoolVal) = false; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4654 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4655 | ;} |
| 4656 | break; |
| 4657 | |
| 4658 | case 216: |
| 4659 | #line 2172 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4660 | { |
| 4661 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4662 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4663 | ;} |
| 4664 | break; |
| 4665 | |
| 4666 | case 217: |
| 4667 | #line 2177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4668 | { // A reference to a direct constant |
| 4669 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4670 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4671 | ;} |
| 4672 | break; |
| 4673 | |
| 4674 | case 218: |
| 4675 | #line 2181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4676 | { |
| 4677 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4678 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4679 | ;} |
| 4680 | break; |
| 4681 | |
| 4682 | case 219: |
| 4683 | #line 2185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4684 | { // Perhaps it's an FP constant? |
| 4685 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4686 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4687 | ;} |
| 4688 | break; |
| 4689 | |
| 4690 | case 220: |
| 4691 | #line 2189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4692 | { |
| 4693 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4694 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4695 | ;} |
| 4696 | break; |
| 4697 | |
| 4698 | case 221: |
| 4699 | #line 2193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4700 | { |
| 4701 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4702 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4703 | ;} |
| 4704 | break; |
| 4705 | |
| 4706 | case 222: |
| 4707 | #line 2197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4708 | { |
| 4709 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4710 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4711 | ;} |
| 4712 | break; |
| 4713 | |
| 4714 | case 223: |
| 4715 | #line 2201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4716 | { |
| 4717 | (yyval.ValIDVal) = ValID::createUndef(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4718 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4719 | ;} |
| 4720 | break; |
| 4721 | |
| 4722 | case 224: |
| 4723 | #line 2205 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4724 | { // A vector zero constant. |
| 4725 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4726 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4727 | ;} |
| 4728 | break; |
| 4729 | |
| 4730 | case 225: |
| 4731 | #line 2209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4732 | { // Nonempty unsized packed vector |
| 4733 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
| 4734 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4735 | |
| 4736 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 4737 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4738 | HandleUpRefs( |
| 4739 | PackedType::get( |
| 4740 | ETy, |
| 4741 | NumElements) |
| 4742 | ) |
| 4743 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4744 | |
| 4745 | // Verify all elements are correct type! |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4746 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4747 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4748 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4749 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4750 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4751 | } |
| 4752 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4753 | (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); |
| 4754 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4755 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4756 | ;} |
| 4757 | break; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4758 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4759 | case 226: |
| 4760 | #line 2234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4761 | { |
| 4762 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4763 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4764 | ;} |
| 4765 | break; |
| 4766 | |
| 4767 | case 227: |
| 4768 | #line 2238 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4769 | { |
| 4770 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 4771 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 4772 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4773 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 4774 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 4775 | free((yyvsp[-2].StrVal)); |
| 4776 | free((yyvsp[0].StrVal)); |
| 4777 | CHECK_FOR_ERROR |
| 4778 | ;} |
| 4779 | break; |
| 4780 | |
| 4781 | case 228: |
| 4782 | #line 2252 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4783 | { // Is it an integer reference...? |
| 4784 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); |
| 4785 | CHECK_FOR_ERROR |
| 4786 | ;} |
| 4787 | break; |
| 4788 | |
| 4789 | case 229: |
| 4790 | #line 2256 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4791 | { |
| 4792 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); |
| 4793 | CHECK_FOR_ERROR |
| 4794 | ;} |
| 4795 | break; |
| 4796 | |
| 4797 | case 230: |
| 4798 | #line 2260 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4799 | { // Is it a named reference...? |
| 4800 | (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal)); |
| 4801 | CHECK_FOR_ERROR |
| 4802 | ;} |
| 4803 | break; |
| 4804 | |
| 4805 | case 231: |
| 4806 | #line 2264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4807 | { // Is it a named reference...? |
| 4808 | (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal)); |
| 4809 | CHECK_FOR_ERROR |
| 4810 | ;} |
| 4811 | break; |
| 4812 | |
| 4813 | case 234: |
| 4814 | #line 2276 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4815 | { |
| 4816 | if (!UpRefs.empty()) |
| 4817 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4818 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
| 4819 | delete (yyvsp[-1].TypeVal); |
| 4820 | CHECK_FOR_ERROR |
| 4821 | ;} |
| 4822 | break; |
| 4823 | |
| 4824 | case 235: |
| 4825 | #line 2285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4826 | { |
| 4827 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 4828 | CHECK_FOR_ERROR |
| 4829 | ;} |
| 4830 | break; |
| 4831 | |
| 4832 | case 236: |
| 4833 | #line 2289 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4834 | { // Do not allow functions with 0 basic blocks |
| 4835 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 4836 | CHECK_FOR_ERROR |
| 4837 | ;} |
| 4838 | break; |
| 4839 | |
| 4840 | case 237: |
| 4841 | #line 2298 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4842 | { |
| 4843 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
| 4844 | CHECK_FOR_ERROR |
| 4845 | InsertValue((yyvsp[0].TermInstVal)); |
| 4846 | |
| 4847 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 4848 | InsertValue((yyvsp[-2].BasicBlockVal)); |
| 4849 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
| 4850 | CHECK_FOR_ERROR |
| 4851 | ;} |
| 4852 | break; |
| 4853 | |
| 4854 | case 238: |
| 4855 | #line 2309 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4856 | { |
| 4857 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4858 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4859 | if (CI2->getParent() == 0) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4860 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
| 4861 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 4862 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4863 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4864 | ;} |
| 4865 | break; |
| 4866 | |
| 4867 | case 239: |
| 4868 | #line 2318 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4869 | { |
| 4870 | (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4871 | CHECK_FOR_ERROR |
| 4872 | |
| 4873 | // Make sure to move the basic block to the correct location in the |
| 4874 | // function, instead of leaving it inserted wherever it was first |
| 4875 | // referenced. |
| 4876 | Function::BasicBlockListType &BBL = |
| 4877 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4878 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4879 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4880 | ;} |
| 4881 | break; |
| 4882 | |
| 4883 | case 240: |
| 4884 | #line 2330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4885 | { |
| 4886 | (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4887 | CHECK_FOR_ERROR |
| 4888 | |
| 4889 | // Make sure to move the basic block to the correct location in the |
| 4890 | // function, instead of leaving it inserted wherever it was first |
| 4891 | // referenced. |
| 4892 | Function::BasicBlockListType &BBL = |
| 4893 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4894 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4895 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4896 | ;} |
| 4897 | break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4898 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4899 | case 241: |
| 4900 | #line 2343 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4901 | { // Return with a result... |
| 4902 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
| 4903 | CHECK_FOR_ERROR |
| 4904 | ;} |
| 4905 | break; |
| 4906 | |
| 4907 | case 242: |
| 4908 | #line 2347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4909 | { // Return with no result... |
| 4910 | (yyval.TermInstVal) = new ReturnInst(); |
| 4911 | CHECK_FOR_ERROR |
| 4912 | ;} |
| 4913 | break; |
| 4914 | |
| 4915 | case 243: |
| 4916 | #line 2351 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4917 | { // Unconditional Branch... |
| 4918 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4919 | CHECK_FOR_ERROR |
| 4920 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 4921 | ;} |
| 4922 | break; |
| 4923 | |
| 4924 | case 244: |
| 4925 | #line 2356 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4926 | { |
| 4927 | assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4928 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 4929 | CHECK_FOR_ERROR |
| 4930 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4931 | CHECK_FOR_ERROR |
| 4932 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); |
| 4933 | CHECK_FOR_ERROR |
| 4934 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 4935 | ;} |
| 4936 | break; |
| 4937 | |
| 4938 | case 245: |
| 4939 | #line 2366 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4940 | { |
| 4941 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
| 4942 | CHECK_FOR_ERROR |
| 4943 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 4944 | CHECK_FOR_ERROR |
| 4945 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 4946 | (yyval.TermInstVal) = S; |
| 4947 | |
| 4948 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 4949 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4950 | for (; I != E; ++I) { |
| 4951 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4952 | S->addCase(CI, I->second); |
| 4953 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4954 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4955 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4956 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4957 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4958 | ;} |
| 4959 | break; |
| 4960 | |
| 4961 | case 246: |
| 4962 | #line 2385 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4963 | { |
| 4964 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4965 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4966 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4967 | CHECK_FOR_ERROR |
| 4968 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4969 | (yyval.TermInstVal) = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4970 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4971 | ;} |
| 4972 | break; |
| 4973 | |
| 4974 | case 247: |
| 4975 | #line 2395 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4976 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4977 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4978 | // Handle the short syntax |
| 4979 | const PointerType *PFTy = 0; |
| 4980 | const FunctionType *Ty = 0; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4981 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4982 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 4983 | // Pull out the types of all of the arguments... |
| 4984 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4985 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4986 | ParamAttrs.push_back((yyvsp[-6].ParamAttrs)); |
| 4987 | for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4988 | const Type *Ty = I->Val->getType(); |
| 4989 | if (Ty == Type::VoidTy) |
| 4990 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 4991 | ParamTypes.push_back(Ty); |
| 4992 | ParamAttrs.push_back(I->Attrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4993 | } |
| 4994 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4995 | Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4996 | PFTy = PointerType::get(Ty); |
| 4997 | } |
| 4998 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4999 | 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] | 5000 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5001 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5002 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5003 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5004 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5005 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5006 | // Check the arguments |
| 5007 | ValueList Args; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5008 | if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5009 | // Make sure no arguments is a good thing! |
| 5010 | if (Ty->getNumParams() != 0) |
| 5011 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5012 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5013 | } else { // Has arguments? |
| 5014 | // Loop through FunctionType's arguments and ensure they are specified |
| 5015 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5016 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5017 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5018 | ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5019 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5020 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5021 | if (ArgI->Val->getType() != *I) |
| 5022 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5023 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5024 | Args.push_back(ArgI->Val); |
| 5025 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5026 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5027 | if (Ty->isVarArg()) { |
| 5028 | if (I == E) |
| 5029 | for (; ArgI != ArgE; ++ArgI) |
| 5030 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5031 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5032 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5033 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5034 | |
| 5035 | // Create the InvokeInst |
| 5036 | InvokeInst *II = new InvokeInst(V, Normal, Except, Args); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5037 | II->setCallingConv((yyvsp[-12].UIntVal)); |
| 5038 | (yyval.TermInstVal) = II; |
| 5039 | delete (yyvsp[-8].ValueRefList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5040 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5041 | ;} |
| 5042 | break; |
| 5043 | |
| 5044 | case 248: |
| 5045 | #line 2461 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5046 | { |
| 5047 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5048 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5049 | ;} |
| 5050 | break; |
| 5051 | |
| 5052 | case 249: |
| 5053 | #line 2465 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5054 | { |
| 5055 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5056 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5057 | ;} |
| 5058 | break; |
| 5059 | |
| 5060 | case 250: |
| 5061 | #line 2472 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5062 | { |
| 5063 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
| 5064 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5065 | CHECK_FOR_ERROR |
| 5066 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5067 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5068 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5069 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5070 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5071 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5072 | ;} |
| 5073 | break; |
| 5074 | |
| 5075 | case 251: |
| 5076 | #line 2483 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5077 | { |
| 5078 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5079 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5080 | CHECK_FOR_ERROR |
| 5081 | |
| 5082 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5083 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5084 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5085 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5086 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5087 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5088 | ;} |
| 5089 | break; |
| 5090 | |
| 5091 | case 252: |
| 5092 | #line 2496 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5093 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5094 | // Is this definition named?? if so, assign the name... |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5095 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5096 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5097 | InsertValue((yyvsp[0].InstVal)); |
| 5098 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5099 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5100 | ;} |
| 5101 | break; |
| 5102 | |
| 5103 | case 253: |
| 5104 | #line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5105 | { // Used for PHI nodes |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5106 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5107 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); |
| 5108 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5109 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5110 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5111 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5112 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5113 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5114 | delete (yyvsp[-5].TypeVal); |
| 5115 | ;} |
| 5116 | break; |
| 5117 | |
| 5118 | case 254: |
| 5119 | #line 2516 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5120 | { |
| 5121 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5122 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5123 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5124 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5125 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5126 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5127 | ;} |
| 5128 | break; |
| 5129 | |
| 5130 | case 255: |
| 5131 | #line 2526 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5132 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5133 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5134 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5135 | // Used for call and invoke instructions |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5136 | (yyval.ValueRefList) = new ValueRefList(); |
| 5137 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5138 | (yyval.ValueRefList)->push_back(E); |
| 5139 | ;} |
| 5140 | break; |
| 5141 | |
| 5142 | case 256: |
| 5143 | #line 2534 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5144 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5145 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5146 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5147 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); |
| 5148 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5149 | (yyval.ValueRefList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5150 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5151 | ;} |
| 5152 | break; |
| 5153 | |
| 5154 | case 257: |
| 5155 | #line 2542 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5156 | { (yyval.ValueRefList) = new ValueRefList(); ;} |
| 5157 | break; |
| 5158 | |
| 5159 | case 258: |
| 5160 | #line 2545 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5161 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5162 | break; |
| 5163 | |
| 5164 | case 259: |
| 5165 | #line 2546 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5166 | { |
| 5167 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5168 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5169 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5170 | ;} |
| 5171 | break; |
| 5172 | |
| 5173 | case 260: |
| 5174 | #line 2553 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5175 | { |
| 5176 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5177 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5178 | ;} |
| 5179 | break; |
| 5180 | |
| 5181 | case 261: |
| 5182 | #line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5183 | { |
| 5184 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5185 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5186 | ;} |
| 5187 | break; |
| 5188 | |
| 5189 | case 262: |
| 5190 | #line 2562 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5191 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5192 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5193 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5194 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5195 | !isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5196 | GEN_ERROR( |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5197 | "Arithmetic operator requires integer, FP, or packed operands"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5198 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5199 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5200 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5201 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5202 | GEN_ERROR("U/S/FRem not supported on packed types"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5203 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5204 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5205 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5206 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5207 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
| 5208 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5209 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5210 | delete (yyvsp[-3].TypeVal); |
| 5211 | ;} |
| 5212 | break; |
| 5213 | |
| 5214 | case 263: |
| 5215 | #line 2583 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5216 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5217 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5218 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5219 | if (!(*(yyvsp[-3].TypeVal))->isInteger()) { |
| 5220 | if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<PackedType>((yyvsp[-3].TypeVal)->get()) || |
| 5221 | !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5222 | GEN_ERROR("Logical operator requires integral operands"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5223 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5224 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5225 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5226 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5227 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5228 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
| 5229 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5230 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5231 | delete (yyvsp[-3].TypeVal); |
| 5232 | ;} |
| 5233 | break; |
| 5234 | |
| 5235 | case 264: |
| 5236 | #line 2600 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5237 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5238 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5239 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5240 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 5241 | GEN_ERROR("Packed types not supported by icmp instruction"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5242 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5243 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5244 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5245 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5246 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5247 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5248 | GEN_ERROR("icmp operator returned null"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5249 | ;} |
| 5250 | break; |
| 5251 | |
| 5252 | case 265: |
| 5253 | #line 2613 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5254 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5255 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5256 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5257 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 5258 | GEN_ERROR("Packed types not supported by fcmp instruction"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5259 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5260 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5261 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5262 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5263 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5264 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5265 | GEN_ERROR("fcmp operator returned null"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5266 | ;} |
| 5267 | break; |
| 5268 | |
| 5269 | case 266: |
| 5270 | #line 2626 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5271 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5272 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5273 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5274 | Value* Val = (yyvsp[-2].ValueVal); |
| 5275 | const Type* DestTy = (yyvsp[0].TypeVal)->get(); |
| 5276 | if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5277 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5278 | Val->getType()->getDescription() + "' to '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5279 | DestTy->getDescription() + "'"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5280 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy); |
| 5281 | delete (yyvsp[0].TypeVal); |
| 5282 | ;} |
| 5283 | break; |
| 5284 | |
| 5285 | case 267: |
| 5286 | #line 2638 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5287 | { |
| 5288 | if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5289 | GEN_ERROR("select condition must be boolean"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5290 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5291 | GEN_ERROR("select value types should match"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5292 | (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] | 5293 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5294 | ;} |
| 5295 | break; |
| 5296 | |
| 5297 | case 268: |
| 5298 | #line 2646 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5299 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5300 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5301 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5302 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5303 | delete (yyvsp[0].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5304 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5305 | ;} |
| 5306 | break; |
| 5307 | |
| 5308 | case 269: |
| 5309 | #line 2653 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5310 | { |
| 5311 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5312 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5313 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5314 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5315 | ;} |
| 5316 | break; |
| 5317 | |
| 5318 | case 270: |
| 5319 | #line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5320 | { |
| 5321 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5322 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5323 | (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5324 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5325 | ;} |
| 5326 | break; |
| 5327 | |
| 5328 | case 271: |
| 5329 | #line 2665 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5330 | { |
| 5331 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5332 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5333 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5334 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5335 | ;} |
| 5336 | break; |
| 5337 | |
| 5338 | case 272: |
| 5339 | #line 2671 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5340 | { |
| 5341 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5342 | if (!Ty->isFirstClassType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5343 | GEN_ERROR("PHI node operands must be of first class type"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5344 | (yyval.InstVal) = new PHINode(Ty); |
| 5345 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5346 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5347 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5348 | GEN_ERROR("All elements of a PHI node must be of the same type"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5349 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5350 | (yyvsp[0].PHIList)->pop_front(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5351 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5352 | delete (yyvsp[0].PHIList); // Free the list... |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5353 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5354 | ;} |
| 5355 | break; |
| 5356 | |
| 5357 | case 273: |
| 5358 | #line 2687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5359 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5360 | |
| 5361 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5362 | const PointerType *PFTy = 0; |
| 5363 | const FunctionType *Ty = 0; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5364 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5365 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5366 | // Pull out the types of all of the arguments... |
| 5367 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5368 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5369 | ParamAttrs.push_back((yyvsp[0].ParamAttrs)); |
| 5370 | for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5371 | const Type *Ty = I->Val->getType(); |
| 5372 | if (Ty == Type::VoidTy) |
| 5373 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5374 | ParamTypes.push_back(Ty); |
| 5375 | ParamAttrs.push_back(I->Attrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5376 | } |
| 5377 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5378 | Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5379 | PFTy = PointerType::get(Ty); |
| 5380 | } |
| 5381 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5382 | 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] | 5383 | CHECK_FOR_ERROR |
| 5384 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5385 | // Check the arguments |
| 5386 | ValueList Args; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5387 | if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5388 | // Make sure no arguments is a good thing! |
| 5389 | if (Ty->getNumParams() != 0) |
| 5390 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5391 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5392 | } else { // Has arguments? |
| 5393 | // Loop through FunctionType's arguments and ensure they are specified |
| 5394 | // correctly! |
| 5395 | // |
| 5396 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5397 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5398 | ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5399 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5400 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5401 | if (ArgI->Val->getType() != *I) |
| 5402 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5403 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5404 | Args.push_back(ArgI->Val); |
| 5405 | } |
| 5406 | if (Ty->isVarArg()) { |
| 5407 | if (I == E) |
| 5408 | for (; ArgI != ArgE; ++ArgI) |
| 5409 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5410 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5411 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5412 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5413 | // Create the call node |
| 5414 | CallInst *CI = new CallInst(V, Args); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5415 | CI->setTailCall((yyvsp[-7].BoolVal)); |
| 5416 | CI->setCallingConv((yyvsp[-6].UIntVal)); |
| 5417 | (yyval.InstVal) = CI; |
| 5418 | delete (yyvsp[-2].ValueRefList); |
| 5419 | delete (yyvsp[-5].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5420 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5421 | ;} |
| 5422 | break; |
| 5423 | |
| 5424 | case 274: |
| 5425 | #line 2750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5426 | { |
| 5427 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5428 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5429 | ;} |
| 5430 | break; |
| 5431 | |
| 5432 | case 275: |
| 5433 | #line 2755 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5434 | { |
| 5435 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5436 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5437 | ;} |
| 5438 | break; |
| 5439 | |
| 5440 | case 276: |
| 5441 | #line 2759 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5442 | { |
| 5443 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5444 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5445 | ;} |
| 5446 | break; |
| 5447 | |
| 5448 | case 277: |
| 5449 | #line 2766 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5450 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5451 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5452 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5453 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5454 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5455 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5456 | ;} |
| 5457 | break; |
| 5458 | |
| 5459 | case 278: |
| 5460 | #line 2773 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5461 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5462 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5463 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5464 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5465 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5466 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5467 | delete (yyvsp[-4].TypeVal); |
| 5468 | ;} |
| 5469 | break; |
| 5470 | |
| 5471 | case 279: |
| 5472 | #line 2781 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5473 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5474 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5475 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5476 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5477 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5478 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5479 | ;} |
| 5480 | break; |
| 5481 | |
| 5482 | case 280: |
| 5483 | #line 2788 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5484 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5485 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5486 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5487 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5488 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5489 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5490 | delete (yyvsp[-4].TypeVal); |
| 5491 | ;} |
| 5492 | break; |
| 5493 | |
| 5494 | case 281: |
| 5495 | #line 2796 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5496 | { |
| 5497 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5498 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5499 | (yyvsp[0].ValueVal)->getType()->getDescription() + ""); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5500 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5501 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5502 | ;} |
| 5503 | break; |
| 5504 | |
| 5505 | case 282: |
| 5506 | #line 2804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5507 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5508 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5509 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5510 | if (!isa<PointerType>((yyvsp[-1].TypeVal)->get())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5511 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5512 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5513 | if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5514 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5515 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5516 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5517 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5518 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
| 5519 | delete (yyvsp[-1].TypeVal); |
| 5520 | ;} |
| 5521 | break; |
| 5522 | |
| 5523 | case 283: |
| 5524 | #line 2818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5525 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5526 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5527 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5528 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5529 | if (!PT) |
| 5530 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5531 | (*(yyvsp[-1].TypeVal))->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5532 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5533 | if (ElTy != (yyvsp[-3].ValueVal)->getType()) |
| 5534 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5535 | "' into space of type '" + ElTy->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5536 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5537 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5538 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5539 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); |
| 5540 | delete (yyvsp[-1].TypeVal); |
| 5541 | ;} |
| 5542 | break; |
| 5543 | |
| 5544 | case 284: |
| 5545 | #line 2835 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5546 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5547 | if (!UpRefs.empty()) |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5548 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5549 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5550 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5551 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5552 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5553 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5554 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'"); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5555 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5556 | CHECK_FOR_ERROR |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5557 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); |
| 5558 | delete (yyvsp[-2].TypeVal); |
| 5559 | delete (yyvsp[0].ValueList); |
| 5560 | ;} |
| 5561 | break; |
| 5562 | |
| 5563 | |
| 5564 | default: break; |
| 5565 | } |
| 5566 | |
| 5567 | /* Line 1126 of yacc.c. */ |
| 5568 | #line 5569 "llvmAsmParser.tab.c" |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5569 | |
| 5570 | yyvsp -= yylen; |
| 5571 | yyssp -= yylen; |
| 5572 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5573 | |
| 5574 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5575 | |
| 5576 | *++yyvsp = yyval; |
| 5577 | |
| 5578 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5579 | /* Now `shift' the result of the reduction. Determine what state |
| 5580 | that goes to, based on the state we popped back to and the rule |
| 5581 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5582 | |
| 5583 | yyn = yyr1[yyn]; |
| 5584 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5585 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5586 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5587 | yystate = yytable[yystate]; |
| 5588 | else |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5589 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5590 | |
| 5591 | goto yynewstate; |
| 5592 | |
| 5593 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5594 | /*------------------------------------. |
| 5595 | | yyerrlab -- here on detecting error | |
| 5596 | `------------------------------------*/ |
| 5597 | yyerrlab: |
| 5598 | /* If not already recovering from an error, report this error. */ |
| 5599 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5600 | { |
| 5601 | ++yynerrs; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5602 | #if YYERROR_VERBOSE |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5603 | yyn = yypact[yystate]; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5604 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5605 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5606 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5607 | int yytype = YYTRANSLATE (yychar); |
| 5608 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5609 | YYSIZE_T yysize = yysize0; |
| 5610 | YYSIZE_T yysize1; |
| 5611 | int yysize_overflow = 0; |
| 5612 | char *yymsg = 0; |
| 5613 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5614 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5615 | int yyx; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5616 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5617 | #if 0 |
| 5618 | /* This is so xgettext sees the translatable formats that are |
| 5619 | constructed on the fly. */ |
| 5620 | YY_("syntax error, unexpected %s"); |
| 5621 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5622 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5623 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5624 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5625 | #endif |
| 5626 | char *yyfmt; |
| 5627 | char const *yyf; |
| 5628 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5629 | static char const yyexpecting[] = ", expecting %s"; |
| 5630 | static char const yyor[] = " or %s"; |
| 5631 | char yyformat[sizeof yyunexpected |
| 5632 | + sizeof yyexpecting - 1 |
| 5633 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5634 | * (sizeof yyor - 1))]; |
| 5635 | char const *yyprefix = yyexpecting; |
| 5636 | |
| 5637 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5638 | YYCHECK. */ |
| 5639 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5640 | |
| 5641 | /* Stay within bounds of both yycheck and yytname. */ |
| 5642 | int yychecklim = YYLAST - yyn; |
| 5643 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5644 | int yycount = 1; |
| 5645 | |
| 5646 | yyarg[0] = yytname[yytype]; |
| 5647 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5648 | |
| 5649 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5650 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5651 | { |
| 5652 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 5653 | { |
| 5654 | yycount = 1; |
| 5655 | yysize = yysize0; |
| 5656 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 5657 | break; |
| 5658 | } |
| 5659 | yyarg[yycount++] = yytname[yyx]; |
| 5660 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5661 | yysize_overflow |= yysize1 < yysize; |
| 5662 | yysize = yysize1; |
| 5663 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5664 | yyprefix = yyor; |
| 5665 | } |
| 5666 | |
| 5667 | yyf = YY_(yyformat); |
| 5668 | yysize1 = yysize + yystrlen (yyf); |
| 5669 | yysize_overflow |= yysize1 < yysize; |
| 5670 | yysize = yysize1; |
| 5671 | |
| 5672 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5673 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5674 | if (yymsg) |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5675 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5676 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5677 | Don't have undefined behavior even if the translation |
| 5678 | produced a string with the wrong number of "%s"s. */ |
| 5679 | char *yyp = yymsg; |
| 5680 | int yyi = 0; |
| 5681 | while ((*yyp = *yyf)) |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5682 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5683 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5684 | { |
| 5685 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5686 | yyf += 2; |
| 5687 | } |
| 5688 | else |
| 5689 | { |
| 5690 | yyp++; |
| 5691 | yyf++; |
| 5692 | } |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5693 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5694 | yyerror (yymsg); |
| 5695 | YYSTACK_FREE (yymsg); |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5696 | } |
| 5697 | else |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5698 | { |
| 5699 | yyerror (YY_("syntax error")); |
| 5700 | goto yyexhaustedlab; |
| 5701 | } |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5702 | } |
| 5703 | else |
| 5704 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5705 | yyerror (YY_("syntax error")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5706 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5707 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5708 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5709 | |
| 5710 | if (yyerrstatus == 3) |
| 5711 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5712 | /* If just tried and failed to reuse look-ahead token after an |
| 5713 | error, discard it. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5714 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5715 | if (yychar <= YYEOF) |
| 5716 | { |
| 5717 | /* Return failure if at end of input. */ |
| 5718 | if (yychar == YYEOF) |
| 5719 | YYABORT; |
| 5720 | } |
| 5721 | else |
| 5722 | { |
| 5723 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 5724 | yychar = YYEMPTY; |
| 5725 | } |
| 5726 | } |
| 5727 | |
| 5728 | /* Else will try to reuse look-ahead token after shifting the error |
| 5729 | token. */ |
| 5730 | goto yyerrlab1; |
| 5731 | |
| 5732 | |
| 5733 | /*---------------------------------------------------. |
| 5734 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5735 | `---------------------------------------------------*/ |
| 5736 | yyerrorlab: |
| 5737 | |
| 5738 | /* Pacify compilers like GCC when the user code never invokes |
| 5739 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5740 | code. */ |
| 5741 | if (0) |
| 5742 | goto yyerrorlab; |
| 5743 | |
| 5744 | yyvsp -= yylen; |
| 5745 | yyssp -= yylen; |
| 5746 | yystate = *yyssp; |
| 5747 | goto yyerrlab1; |
| 5748 | |
| 5749 | |
| 5750 | /*-------------------------------------------------------------. |
| 5751 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5752 | `-------------------------------------------------------------*/ |
| 5753 | yyerrlab1: |
| 5754 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5755 | |
| 5756 | for (;;) |
| 5757 | { |
| 5758 | yyn = yypact[yystate]; |
| 5759 | if (yyn != YYPACT_NINF) |
| 5760 | { |
| 5761 | yyn += YYTERROR; |
| 5762 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5763 | { |
| 5764 | yyn = yytable[yyn]; |
| 5765 | if (0 < yyn) |
| 5766 | break; |
| 5767 | } |
| 5768 | } |
| 5769 | |
| 5770 | /* Pop the current state because it cannot handle the error token. */ |
| 5771 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5772 | YYABORT; |
| 5773 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5774 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5775 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 5776 | YYPOPSTACK; |
| 5777 | yystate = *yyssp; |
| 5778 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5779 | } |
| 5780 | |
| 5781 | if (yyn == YYFINAL) |
| 5782 | YYACCEPT; |
| 5783 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5784 | *++yyvsp = yylval; |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5785 | |
| 5786 | |
| 5787 | /* Shift the error token. */ |
| 5788 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5789 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5790 | yystate = yyn; |
| 5791 | goto yynewstate; |
| 5792 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 5793 | |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5794 | /*-------------------------------------. |
| 5795 | | yyacceptlab -- YYACCEPT comes here. | |
| 5796 | `-------------------------------------*/ |
| 5797 | yyacceptlab: |
| 5798 | yyresult = 0; |
| 5799 | goto yyreturn; |
| 5800 | |
| 5801 | /*-----------------------------------. |
| 5802 | | yyabortlab -- YYABORT comes here. | |
| 5803 | `-----------------------------------*/ |
| 5804 | yyabortlab: |
| 5805 | yyresult = 1; |
| 5806 | goto yyreturn; |
| 5807 | |
| 5808 | #ifndef yyoverflow |
| 5809 | /*-------------------------------------------------. |
| 5810 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5811 | `-------------------------------------------------*/ |
| 5812 | yyexhaustedlab: |
| 5813 | yyerror (YY_("memory exhausted")); |
| 5814 | yyresult = 2; |
| 5815 | /* Fall through. */ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 5816 | #endif |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5817 | |
| 5818 | yyreturn: |
| 5819 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5820 | yydestruct ("Cleanup: discarding lookahead", |
| 5821 | yytoken, &yylval); |
| 5822 | while (yyssp != yyss) |
| 5823 | { |
| 5824 | yydestruct ("Cleanup: popping", |
| 5825 | yystos[*yyssp], yyvsp); |
| 5826 | YYPOPSTACK; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 5827 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5828 | #ifndef yyoverflow |
| 5829 | if (yyss != yyssa) |
| 5830 | YYSTACK_FREE (yyss); |
| 5831 | #endif |
| 5832 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5833 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5834 | |
| 5835 | |
| 5836 | #line 2852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5837 | |
| 5838 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5839 | // common code from the two 'RunVMAsmParser' functions |
| 5840 | static Module* RunParser(Module * M) { |
| 5841 | |
| 5842 | llvmAsmlineno = 1; // Reset the current line number... |
| 5843 | CurModule.CurrentModule = M; |
| 5844 | #if YYDEBUG |
| 5845 | yydebug = Debug; |
| 5846 | #endif |
| 5847 | |
| 5848 | // Check to make sure the parser succeeded |
| 5849 | if (yyparse()) { |
| 5850 | if (ParserResult) |
| 5851 | delete ParserResult; |
| 5852 | return 0; |
| 5853 | } |
| 5854 | |
| 5855 | // Check to make sure that parsing produced a result |
| 5856 | if (!ParserResult) |
| 5857 | return 0; |
| 5858 | |
| 5859 | // Reset ParserResult variable while saving its value for the result. |
| 5860 | Module *Result = ParserResult; |
| 5861 | ParserResult = 0; |
| 5862 | |
| 5863 | return Result; |
| 5864 | } |
| 5865 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5866 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5867 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5868 | // TODO: column number in exception |
| 5869 | if (TheParseError) |
| 5870 | TheParseError->setError(CurFilename, message, LineNo); |
| 5871 | TriggerError = 1; |
| 5872 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5873 | |
| 5874 | int yyerror(const char *ErrorMsg) { |
| 5875 | std::string where |
| 5876 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5877 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5878 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5879 | if (yychar == YYEMPTY || yychar == 0) |
| 5880 | errMsg += "end-of-file."; |
| 5881 | else |
| 5882 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5883 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5884 | return 0; |
| 5885 | } |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5886 | |