Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +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 | 3822ff5 | 2006-11-08 06:47:33 +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. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +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 | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 10 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +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 | 3822ff5 | 2006-11-08 06:47:33 +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 | 3822ff5 | 2006-11-08 06:47:33 +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 | 3822ff5 | 2006-11-08 06:47:33 +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 | SINTVAL = 260, |
| 70 | UINTVAL = 261, |
| 71 | FPVAL = 262, |
| 72 | VOID = 263, |
| 73 | BOOL = 264, |
| 74 | SBYTE = 265, |
| 75 | UBYTE = 266, |
| 76 | SHORT = 267, |
| 77 | USHORT = 268, |
| 78 | INT = 269, |
| 79 | UINT = 270, |
| 80 | LONG = 271, |
| 81 | ULONG = 272, |
| 82 | FLOAT = 273, |
| 83 | DOUBLE = 274, |
| 84 | TYPE = 275, |
| 85 | LABEL = 276, |
| 86 | VAR_ID = 277, |
| 87 | LABELSTR = 278, |
| 88 | STRINGCONSTANT = 279, |
| 89 | IMPLEMENTATION = 280, |
| 90 | ZEROINITIALIZER = 281, |
| 91 | TRUETOK = 282, |
| 92 | FALSETOK = 283, |
| 93 | BEGINTOK = 284, |
| 94 | ENDTOK = 285, |
| 95 | DECLARE = 286, |
| 96 | GLOBAL = 287, |
| 97 | CONSTANT = 288, |
| 98 | SECTION = 289, |
| 99 | VOLATILE = 290, |
| 100 | TO = 291, |
| 101 | DOTDOTDOT = 292, |
| 102 | NULL_TOK = 293, |
| 103 | UNDEF = 294, |
| 104 | CONST = 295, |
| 105 | INTERNAL = 296, |
| 106 | LINKONCE = 297, |
| 107 | WEAK = 298, |
| 108 | APPENDING = 299, |
| 109 | DLLIMPORT = 300, |
| 110 | DLLEXPORT = 301, |
| 111 | EXTERN_WEAK = 302, |
| 112 | OPAQUE = 303, |
| 113 | NOT = 304, |
| 114 | EXTERNAL = 305, |
| 115 | TARGET = 306, |
| 116 | TRIPLE = 307, |
| 117 | ENDIAN = 308, |
| 118 | POINTERSIZE = 309, |
| 119 | LITTLE = 310, |
| 120 | BIG = 311, |
| 121 | ALIGN = 312, |
| 122 | DEPLIBS = 313, |
| 123 | CALL = 314, |
| 124 | TAIL = 315, |
| 125 | ASM_TOK = 316, |
| 126 | MODULE = 317, |
| 127 | SIDEEFFECT = 318, |
| 128 | CC_TOK = 319, |
| 129 | CCC_TOK = 320, |
| 130 | CSRETCC_TOK = 321, |
| 131 | FASTCC_TOK = 322, |
| 132 | COLDCC_TOK = 323, |
| 133 | X86_STDCALLCC_TOK = 324, |
| 134 | X86_FASTCALLCC_TOK = 325, |
| 135 | DATALAYOUT = 326, |
| 136 | RET = 327, |
| 137 | BR = 328, |
| 138 | SWITCH = 329, |
| 139 | INVOKE = 330, |
| 140 | UNWIND = 331, |
| 141 | UNREACHABLE = 332, |
| 142 | ADD = 333, |
| 143 | SUB = 334, |
| 144 | MUL = 335, |
| 145 | UDIV = 336, |
| 146 | SDIV = 337, |
| 147 | FDIV = 338, |
| 148 | UREM = 339, |
| 149 | SREM = 340, |
| 150 | FREM = 341, |
| 151 | AND = 342, |
| 152 | OR = 343, |
| 153 | XOR = 344, |
| 154 | SETLE = 345, |
| 155 | SETGE = 346, |
| 156 | SETLT = 347, |
| 157 | SETGT = 348, |
| 158 | SETEQ = 349, |
| 159 | SETNE = 350, |
| 160 | MALLOC = 351, |
| 161 | ALLOCA = 352, |
| 162 | FREE = 353, |
| 163 | LOAD = 354, |
| 164 | STORE = 355, |
| 165 | GETELEMENTPTR = 356, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 166 | TRUNC = 357, |
| 167 | ZEXT = 358, |
| 168 | SEXT = 359, |
| 169 | FPTRUNC = 360, |
| 170 | FPEXT = 361, |
| 171 | BITCAST = 362, |
| 172 | UITOFP = 363, |
| 173 | SITOFP = 364, |
| 174 | FPTOUI = 365, |
| 175 | FPTOSI = 366, |
| 176 | INTTOPTR = 367, |
| 177 | PTRTOINT = 368, |
| 178 | PHI_TOK = 369, |
| 179 | SELECT = 370, |
| 180 | SHL = 371, |
| 181 | LSHR = 372, |
| 182 | ASHR = 373, |
| 183 | VAARG = 374, |
| 184 | EXTRACTELEMENT = 375, |
| 185 | INSERTELEMENT = 376, |
| 186 | SHUFFLEVECTOR = 377, |
| 187 | VAARG_old = 378, |
| 188 | VANEXT_old = 379 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 189 | }; |
| 190 | #endif |
| 191 | /* Tokens. */ |
| 192 | #define ESINT64VAL 258 |
| 193 | #define EUINT64VAL 259 |
| 194 | #define SINTVAL 260 |
| 195 | #define UINTVAL 261 |
| 196 | #define FPVAL 262 |
| 197 | #define VOID 263 |
| 198 | #define BOOL 264 |
| 199 | #define SBYTE 265 |
| 200 | #define UBYTE 266 |
| 201 | #define SHORT 267 |
| 202 | #define USHORT 268 |
| 203 | #define INT 269 |
| 204 | #define UINT 270 |
| 205 | #define LONG 271 |
| 206 | #define ULONG 272 |
| 207 | #define FLOAT 273 |
| 208 | #define DOUBLE 274 |
| 209 | #define TYPE 275 |
| 210 | #define LABEL 276 |
| 211 | #define VAR_ID 277 |
| 212 | #define LABELSTR 278 |
| 213 | #define STRINGCONSTANT 279 |
| 214 | #define IMPLEMENTATION 280 |
| 215 | #define ZEROINITIALIZER 281 |
| 216 | #define TRUETOK 282 |
| 217 | #define FALSETOK 283 |
| 218 | #define BEGINTOK 284 |
| 219 | #define ENDTOK 285 |
| 220 | #define DECLARE 286 |
| 221 | #define GLOBAL 287 |
| 222 | #define CONSTANT 288 |
| 223 | #define SECTION 289 |
| 224 | #define VOLATILE 290 |
| 225 | #define TO 291 |
| 226 | #define DOTDOTDOT 292 |
| 227 | #define NULL_TOK 293 |
| 228 | #define UNDEF 294 |
| 229 | #define CONST 295 |
| 230 | #define INTERNAL 296 |
| 231 | #define LINKONCE 297 |
| 232 | #define WEAK 298 |
| 233 | #define APPENDING 299 |
| 234 | #define DLLIMPORT 300 |
| 235 | #define DLLEXPORT 301 |
| 236 | #define EXTERN_WEAK 302 |
| 237 | #define OPAQUE 303 |
| 238 | #define NOT 304 |
| 239 | #define EXTERNAL 305 |
| 240 | #define TARGET 306 |
| 241 | #define TRIPLE 307 |
| 242 | #define ENDIAN 308 |
| 243 | #define POINTERSIZE 309 |
| 244 | #define LITTLE 310 |
| 245 | #define BIG 311 |
| 246 | #define ALIGN 312 |
| 247 | #define DEPLIBS 313 |
| 248 | #define CALL 314 |
| 249 | #define TAIL 315 |
| 250 | #define ASM_TOK 316 |
| 251 | #define MODULE 317 |
| 252 | #define SIDEEFFECT 318 |
| 253 | #define CC_TOK 319 |
| 254 | #define CCC_TOK 320 |
| 255 | #define CSRETCC_TOK 321 |
| 256 | #define FASTCC_TOK 322 |
| 257 | #define COLDCC_TOK 323 |
| 258 | #define X86_STDCALLCC_TOK 324 |
| 259 | #define X86_FASTCALLCC_TOK 325 |
| 260 | #define DATALAYOUT 326 |
| 261 | #define RET 327 |
| 262 | #define BR 328 |
| 263 | #define SWITCH 329 |
| 264 | #define INVOKE 330 |
| 265 | #define UNWIND 331 |
| 266 | #define UNREACHABLE 332 |
| 267 | #define ADD 333 |
| 268 | #define SUB 334 |
| 269 | #define MUL 335 |
| 270 | #define UDIV 336 |
| 271 | #define SDIV 337 |
| 272 | #define FDIV 338 |
| 273 | #define UREM 339 |
| 274 | #define SREM 340 |
| 275 | #define FREM 341 |
| 276 | #define AND 342 |
| 277 | #define OR 343 |
| 278 | #define XOR 344 |
| 279 | #define SETLE 345 |
| 280 | #define SETGE 346 |
| 281 | #define SETLT 347 |
| 282 | #define SETGT 348 |
| 283 | #define SETEQ 349 |
| 284 | #define SETNE 350 |
| 285 | #define MALLOC 351 |
| 286 | #define ALLOCA 352 |
| 287 | #define FREE 353 |
| 288 | #define LOAD 354 |
| 289 | #define STORE 355 |
| 290 | #define GETELEMENTPTR 356 |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 291 | #define TRUNC 357 |
| 292 | #define ZEXT 358 |
| 293 | #define SEXT 359 |
| 294 | #define FPTRUNC 360 |
| 295 | #define FPEXT 361 |
| 296 | #define BITCAST 362 |
| 297 | #define UITOFP 363 |
| 298 | #define SITOFP 364 |
| 299 | #define FPTOUI 365 |
| 300 | #define FPTOSI 366 |
| 301 | #define INTTOPTR 367 |
| 302 | #define PTRTOINT 368 |
| 303 | #define PHI_TOK 369 |
| 304 | #define SELECT 370 |
| 305 | #define SHL 371 |
| 306 | #define LSHR 372 |
| 307 | #define ASHR 373 |
| 308 | #define VAARG 374 |
| 309 | #define EXTRACTELEMENT 375 |
| 310 | #define INSERTELEMENT 376 |
| 311 | #define SHUFFLEVECTOR 377 |
| 312 | #define VAARG_old 378 |
| 313 | #define VANEXT_old 379 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | /* Copy the first part of user declarations. */ |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 319 | #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 320 | |
| 321 | #include "ParserInternals.h" |
| 322 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 323 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 324 | #include "llvm/Instructions.h" |
| 325 | #include "llvm/Module.h" |
| 326 | #include "llvm/SymbolTable.h" |
Reid Spencer | 0b11820 | 2006-01-16 21:12:35 +0000 | [diff] [blame] | 327 | #include "llvm/Assembly/AutoUpgrade.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 328 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
| 329 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 330 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 331 | #include <algorithm> |
| 332 | #include <iostream> |
| 333 | #include <list> |
| 334 | #include <utility> |
| 335 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 336 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 337 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 338 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 339 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 340 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 341 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 342 | // GenerateError are made from inside productions and they must simulate the |
| 343 | // previous exception behavior by exiting the production immediately. We have |
| 344 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 345 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 346 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 347 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 348 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 349 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 350 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 351 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 352 | int yylex(); // declaration" of xxx warnings. |
| 353 | int yyparse(); |
| 354 | |
| 355 | namespace llvm { |
| 356 | std::string CurFilename; |
| 357 | } |
| 358 | using namespace llvm; |
| 359 | |
| 360 | static Module *ParserResult; |
| 361 | |
| 362 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 363 | // relating to upreferences in the input stream. |
| 364 | // |
| 365 | //#define DEBUG_UPREFS 1 |
| 366 | #ifdef DEBUG_UPREFS |
| 367 | #define UR_OUT(X) std::cerr << X |
| 368 | #else |
| 369 | #define UR_OUT(X) |
| 370 | #endif |
| 371 | |
| 372 | #define YYERROR_VERBOSE 1 |
| 373 | |
| 374 | static bool ObsoleteVarArgs; |
| 375 | static bool NewVarArgs; |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 376 | static BasicBlock *CurBB; |
| 377 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 378 | |
| 379 | |
| 380 | // This contains info used when building the body of a function. It is |
| 381 | // destroyed when the function is completed. |
| 382 | // |
| 383 | typedef std::vector<Value *> ValueList; // Numbered defs |
| 384 | static void |
| 385 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 386 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 387 | |
| 388 | static struct PerModuleInfo { |
| 389 | Module *CurrentModule; |
| 390 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 391 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 392 | std::vector<PATypeHolder> Types; |
| 393 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 394 | |
| 395 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 396 | /// 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] | 397 | /// that we can resolve them later and print error messages as appropriate. |
| 398 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 399 | |
| 400 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 401 | // references to global values. Global values may be referenced before they |
| 402 | // are defined, and if so, the temporary object that they represent is held |
| 403 | // here. This is used for forward references of GlobalValues. |
| 404 | // |
| 405 | typedef std::map<std::pair<const PointerType *, |
| 406 | ValID>, GlobalValue*> GlobalRefsType; |
| 407 | GlobalRefsType GlobalRefs; |
| 408 | |
| 409 | void ModuleDone() { |
| 410 | // If we could not resolve some functions at function compilation time |
| 411 | // (calls to functions before they are defined), resolve them now... Types |
| 412 | // are resolved when the constant pool has been completely parsed. |
| 413 | // |
| 414 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 415 | if (TriggerError) |
| 416 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 417 | |
| 418 | // Check to make sure that all global value forward references have been |
| 419 | // resolved! |
| 420 | // |
| 421 | if (!GlobalRefs.empty()) { |
| 422 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 423 | |
| 424 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 425 | I != E; ++I) { |
| 426 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 427 | I->first.second.getName() + "\n"; |
| 428 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 429 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 430 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 431 | } |
| 432 | |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 433 | // Look for intrinsic functions and CallInst that need to be upgraded |
Chris Lattner | d5efe84 | 2006-04-08 01:18:56 +0000 | [diff] [blame] | 434 | for (Module::iterator FI = CurrentModule->begin(), |
| 435 | FE = CurrentModule->end(); FI != FE; ) |
Chris Lattner | c2c6038 | 2006-03-04 07:53:41 +0000 | [diff] [blame] | 436 | UpgradeCallsToIntrinsic(FI++); |
Reid Spencer | 0b11820 | 2006-01-16 21:12:35 +0000 | [diff] [blame] | 437 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 438 | Values.clear(); // Clear out function local definitions |
| 439 | Types.clear(); |
| 440 | CurrentModule = 0; |
| 441 | } |
| 442 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 443 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 444 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 445 | // If not, just return null. |
| 446 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 447 | // Check to see if there is a forward reference to this global variable... |
| 448 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 449 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 450 | GlobalValue *Ret = 0; |
| 451 | if (I != GlobalRefs.end()) { |
| 452 | Ret = I->second; |
| 453 | GlobalRefs.erase(I); |
| 454 | } |
| 455 | return Ret; |
| 456 | } |
| 457 | } CurModule; |
| 458 | |
| 459 | static struct PerFunctionInfo { |
| 460 | Function *CurrentFunction; // Pointer to current function being created |
| 461 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 462 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 463 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 464 | bool isDeclare; // Is this function a forward declararation? |
| 465 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 466 | |
| 467 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 468 | /// track of them here. |
| 469 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 470 | std::vector<BasicBlock*> NumberedBlocks; |
| 471 | unsigned NextBBNum; |
| 472 | |
| 473 | inline PerFunctionInfo() { |
| 474 | CurrentFunction = 0; |
| 475 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 476 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | inline void FunctionStart(Function *M) { |
| 480 | CurrentFunction = M; |
| 481 | NextBBNum = 0; |
| 482 | } |
| 483 | |
| 484 | void FunctionDone() { |
| 485 | NumberedBlocks.clear(); |
| 486 | |
| 487 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 488 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 489 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 490 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 491 | return; |
| 492 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 493 | |
| 494 | // Resolve all forward references now. |
| 495 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 496 | |
| 497 | Values.clear(); // Clear out function local definitions |
| 498 | CurrentFunction = 0; |
| 499 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 500 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 501 | } |
| 502 | } CurFun; // Info for the current function... |
| 503 | |
| 504 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 505 | |
| 506 | |
| 507 | //===----------------------------------------------------------------------===// |
| 508 | // Code to handle definitions of all the types |
| 509 | //===----------------------------------------------------------------------===// |
| 510 | |
| 511 | static int InsertValue(Value *V, |
| 512 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 513 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 514 | |
| 515 | // Yes, insert the value into the value table... |
| 516 | ValueList &List = ValueTab[V->getType()]; |
| 517 | List.push_back(V); |
| 518 | return List.size()-1; |
| 519 | } |
| 520 | |
| 521 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 522 | switch (D.Type) { |
| 523 | case ValID::NumberVal: // Is it a numbered definition? |
| 524 | // Module constants occupy the lowest numbered slots... |
| 525 | if ((unsigned)D.Num < CurModule.Types.size()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 526 | return CurModule.Types[(unsigned)D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 527 | break; |
| 528 | case ValID::NameVal: // Is it a named definition? |
| 529 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 530 | D.destroy(); // Free old strdup'd memory... |
| 531 | return N; |
| 532 | } |
| 533 | break; |
| 534 | default: |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 535 | GenerateError("Internal parser error: Invalid symbol type reference!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 536 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | // If we reached here, we referenced either a symbol that we don't know about |
| 540 | // or an id number that hasn't been read yet. We may be referencing something |
| 541 | // forward, so just create an entry to be resolved later and get to it... |
| 542 | // |
| 543 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 544 | |
| 545 | |
| 546 | if (inFunctionScope()) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 547 | if (D.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 548 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 549 | return 0; |
| 550 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 551 | GenerateError("Reference to an undefined type: #" + itostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 552 | return 0; |
| 553 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 554 | } |
| 555 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 556 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 557 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 558 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 559 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 560 | Type *Typ = OpaqueType::get(); |
| 561 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 562 | return Typ; |
| 563 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 564 | |
| 565 | static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { |
| 566 | SymbolTable &SymTab = |
| 567 | inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : |
| 568 | CurModule.CurrentModule->getSymbolTable(); |
| 569 | return SymTab.lookup(Ty, Name); |
| 570 | } |
| 571 | |
| 572 | // getValNonImprovising - Look up the value specified by the provided type and |
| 573 | // the provided ValID. If the value exists and has already been defined, return |
| 574 | // it. Otherwise return null. |
| 575 | // |
| 576 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 577 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 578 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 579 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 580 | return 0; |
| 581 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 582 | |
| 583 | switch (D.Type) { |
| 584 | case ValID::NumberVal: { // Is it a numbered definition? |
| 585 | unsigned Num = (unsigned)D.Num; |
| 586 | |
| 587 | // Module constants occupy the lowest numbered slots... |
| 588 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 589 | if (VI != CurModule.Values.end()) { |
| 590 | if (Num < VI->second.size()) |
| 591 | return VI->second[Num]; |
| 592 | Num -= VI->second.size(); |
| 593 | } |
| 594 | |
| 595 | // Make sure that our type is within bounds |
| 596 | VI = CurFun.Values.find(Ty); |
| 597 | if (VI == CurFun.Values.end()) return 0; |
| 598 | |
| 599 | // Check that the number is within bounds... |
| 600 | if (VI->second.size() <= Num) return 0; |
| 601 | |
| 602 | return VI->second[Num]; |
| 603 | } |
| 604 | |
| 605 | case ValID::NameVal: { // Is it a named definition? |
| 606 | Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); |
| 607 | if (N == 0) return 0; |
| 608 | |
| 609 | D.destroy(); // Free old strdup'd memory... |
| 610 | return N; |
| 611 | } |
| 612 | |
| 613 | // Check to make sure that "Ty" is an integral type, and that our |
| 614 | // value will fit into the specified type... |
| 615 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 616 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 617 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 618 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 619 | Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 620 | return 0; |
| 621 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 622 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 623 | |
| 624 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 625 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 626 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 627 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 628 | "' is invalid or out of range!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 629 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 630 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 631 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 632 | } |
| 633 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 634 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 635 | } |
| 636 | |
| 637 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 638 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 639 | GenerateError("FP constant invalid for type!!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 640 | return 0; |
| 641 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 642 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 643 | |
| 644 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 645 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 646 | GenerateError("Cannot create a a non pointer null!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 647 | return 0; |
| 648 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 649 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 650 | |
| 651 | case ValID::ConstUndefVal: // Is it an undef value? |
| 652 | return UndefValue::get(Ty); |
| 653 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 654 | case ValID::ConstZeroVal: // Is it a zero value? |
| 655 | return Constant::getNullValue(Ty); |
| 656 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 657 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 658 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 659 | GenerateError("Constant expression type different from required type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 660 | return 0; |
| 661 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 662 | return D.ConstantValue; |
| 663 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 664 | case ValID::InlineAsmVal: { // Inline asm expression |
| 665 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 666 | const FunctionType *FTy = |
| 667 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 668 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 669 | GenerateError("Invalid type for asm constraint string!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 670 | return 0; |
| 671 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 672 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 673 | D.IAD->HasSideEffects); |
| 674 | D.destroy(); // Free InlineAsmDescriptor. |
| 675 | return IA; |
| 676 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 677 | default: |
| 678 | assert(0 && "Unhandled case!"); |
| 679 | return 0; |
| 680 | } // End of switch |
| 681 | |
| 682 | assert(0 && "Unhandled case!"); |
| 683 | return 0; |
| 684 | } |
| 685 | |
| 686 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 687 | // value is not already defined, it "improvises" by creating a placeholder var |
| 688 | // that looks and acts just like the requested variable. When the value is |
| 689 | // defined later, all uses of the placeholder variable are replaced with the |
| 690 | // real thing. |
| 691 | // |
| 692 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 693 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 694 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 695 | return 0; |
| 696 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 697 | |
| 698 | // See if the value has already been defined. |
| 699 | Value *V = getValNonImprovising(Ty, ID); |
| 700 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 701 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 702 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 703 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 704 | GenerateError("Invalid use of a composite type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 705 | return 0; |
| 706 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 707 | |
| 708 | // If we reached here, we referenced either a symbol that we don't know about |
| 709 | // or an id number that hasn't been read yet. We may be referencing something |
| 710 | // forward, so just create an entry to be resolved later and get to it... |
| 711 | // |
| 712 | V = new Argument(Ty); |
| 713 | |
| 714 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 715 | // to recycle these things?? |
| 716 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 717 | llvmAsmlineno))); |
| 718 | |
| 719 | if (inFunctionScope()) |
| 720 | InsertValue(V, CurFun.LateResolveValues); |
| 721 | else |
| 722 | InsertValue(V, CurModule.LateResolveValues); |
| 723 | return V; |
| 724 | } |
| 725 | |
| 726 | /// getBBVal - This is used for two purposes: |
| 727 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 728 | /// defined. |
| 729 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 730 | /// or may not be a forward reference. |
| 731 | /// |
| 732 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 733 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 734 | |
| 735 | std::string Name; |
| 736 | BasicBlock *BB = 0; |
| 737 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 738 | default: |
| 739 | GenerateError("Illegal label reference " + ID.getName()); |
| 740 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 741 | case ValID::NumberVal: // Is it a numbered definition? |
| 742 | if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) |
| 743 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 744 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 745 | break; |
| 746 | case ValID::NameVal: // Is it a named definition? |
| 747 | Name = ID.Name; |
| 748 | if (Value *N = CurFun.CurrentFunction-> |
| 749 | getSymbolTable().lookup(Type::LabelTy, Name)) |
| 750 | BB = cast<BasicBlock>(N); |
| 751 | break; |
| 752 | } |
| 753 | |
| 754 | // See if the block has already been defined. |
| 755 | if (BB) { |
| 756 | // If this is the definition of the block, make sure the existing value was |
| 757 | // just a forward reference. If it was a forward reference, there will be |
| 758 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 759 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 760 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 761 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 762 | return 0; |
| 763 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 764 | |
| 765 | ID.destroy(); // Free strdup'd memory. |
| 766 | return BB; |
| 767 | } |
| 768 | |
| 769 | // Otherwise this block has not been seen before. |
| 770 | BB = new BasicBlock("", CurFun.CurrentFunction); |
| 771 | if (ID.Type == ValID::NameVal) { |
| 772 | BB->setName(ID.Name); |
| 773 | } else { |
| 774 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 775 | } |
| 776 | |
| 777 | // If this is not a definition, keep track of it so we can use it as a forward |
| 778 | // reference. |
| 779 | if (!isDefinition) { |
| 780 | // Remember where this forward reference came from. |
| 781 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 782 | } else { |
| 783 | // The forward declaration could have been inserted anywhere in the |
| 784 | // function: insert it into the correct place now. |
| 785 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 786 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 787 | } |
| 788 | ID.destroy(); |
| 789 | return BB; |
| 790 | } |
| 791 | |
| 792 | |
| 793 | //===----------------------------------------------------------------------===// |
| 794 | // Code to handle forward references in instructions |
| 795 | //===----------------------------------------------------------------------===// |
| 796 | // |
| 797 | // This code handles the late binding needed with statements that reference |
| 798 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 799 | // a loop body. |
| 800 | // |
| 801 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 802 | // and back patchs after we are done. |
| 803 | // |
| 804 | |
| 805 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 806 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 807 | // defs now... |
| 808 | // |
| 809 | static void |
| 810 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 811 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 812 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 813 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 814 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 815 | ValueList &List = LRI->second; |
| 816 | while (!List.empty()) { |
| 817 | Value *V = List.back(); |
| 818 | List.pop_back(); |
| 819 | |
| 820 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 821 | CurModule.PlaceHolderInfo.find(V); |
| 822 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 823 | |
| 824 | ValID &DID = PHI->second.first; |
| 825 | |
| 826 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 827 | if (TriggerError) |
| 828 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 829 | if (TheRealValue) { |
| 830 | V->replaceAllUsesWith(TheRealValue); |
| 831 | delete V; |
| 832 | CurModule.PlaceHolderInfo.erase(PHI); |
| 833 | } else if (FutureLateResolvers) { |
| 834 | // Functions have their unresolved items forwarded to the module late |
| 835 | // resolver table |
| 836 | InsertValue(V, *FutureLateResolvers); |
| 837 | } else { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 838 | if (DID.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 839 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 840 | "' of type '" + V->getType()->getDescription() + "'", |
| 841 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 842 | return; |
| 843 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 844 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 845 | itostr(DID.Num) + " of type '" + |
| 846 | V->getType()->getDescription() + "'", |
| 847 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 848 | return; |
| 849 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 850 | } |
| 851 | } |
| 852 | } |
| 853 | |
| 854 | LateResolvers.clear(); |
| 855 | } |
| 856 | |
| 857 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 858 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 859 | // refering to the number can be resolved. Do this now. |
| 860 | // |
| 861 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 862 | ValID D; |
| 863 | if (Name) D = ValID::create(Name); |
| 864 | else D = ValID::create((int)CurModule.Types.size()); |
| 865 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 866 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 867 | CurModule.LateResolveTypes.find(D); |
| 868 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 869 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 870 | CurModule.LateResolveTypes.erase(I); |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | // setValueName - Set the specified value to the name given. The name may be |
| 875 | // null potentially, in which case this is a noop. The string passed in is |
| 876 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 877 | // |
| 878 | static void setValueName(Value *V, char *NameStr) { |
| 879 | if (NameStr) { |
| 880 | std::string Name(NameStr); // Copy string |
| 881 | free(NameStr); // Free old string |
| 882 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 883 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 884 | GenerateError("Can't assign name '" + Name+"' to value with void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 885 | return; |
| 886 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 887 | |
| 888 | assert(inFunctionScope() && "Must be in function scope!"); |
| 889 | SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 890 | if (ST.lookup(V->getType(), Name)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 891 | GenerateError("Redefinition of value named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 892 | V->getType()->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 893 | return; |
| 894 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 895 | |
| 896 | // Set the name. |
| 897 | V->setName(Name); |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 902 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 903 | static GlobalVariable * |
| 904 | ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, |
| 905 | bool isConstantGlobal, const Type *Ty, |
| 906 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 907 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 908 | GenerateError("Cannot declare global vars of function type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 909 | return 0; |
| 910 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 911 | |
| 912 | const PointerType *PTy = PointerType::get(Ty); |
| 913 | |
| 914 | std::string Name; |
| 915 | if (NameStr) { |
| 916 | Name = NameStr; // Copy string |
| 917 | free(NameStr); // Free old string |
| 918 | } |
| 919 | |
| 920 | // See if this global value was forward referenced. If so, recycle the |
| 921 | // object. |
| 922 | ValID ID; |
| 923 | if (!Name.empty()) { |
| 924 | ID = ValID::create((char*)Name.c_str()); |
| 925 | } else { |
| 926 | ID = ValID::create((int)CurModule.Values[PTy].size()); |
| 927 | } |
| 928 | |
| 929 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 930 | // Move the global to the end of the list, from whereever it was |
| 931 | // previously inserted. |
| 932 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 933 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 934 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 935 | GV->setInitializer(Initializer); |
| 936 | GV->setLinkage(Linkage); |
| 937 | GV->setConstant(isConstantGlobal); |
| 938 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 939 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 940 | } |
| 941 | |
| 942 | // If this global has a name, check to see if there is already a definition |
| 943 | // of this global in the module. If so, merge as appropriate. Note that |
| 944 | // this is really just a hack around problems in the CFE. :( |
| 945 | if (!Name.empty()) { |
| 946 | // We are a simple redefinition of a value, check to see if it is defined |
| 947 | // the same as the old one. |
| 948 | if (GlobalVariable *EGV = |
| 949 | CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
| 950 | // We are allowed to redefine a global variable in two circumstances: |
| 951 | // 1. If at least one of the globals is uninitialized or |
| 952 | // 2. If both initializers have the same value. |
| 953 | // |
| 954 | if (!EGV->hasInitializer() || !Initializer || |
| 955 | EGV->getInitializer() == Initializer) { |
| 956 | |
| 957 | // Make sure the existing global version gets the initializer! Make |
| 958 | // sure that it also gets marked const if the new version is. |
| 959 | if (Initializer && !EGV->hasInitializer()) |
| 960 | EGV->setInitializer(Initializer); |
| 961 | if (isConstantGlobal) |
| 962 | EGV->setConstant(true); |
| 963 | EGV->setLinkage(Linkage); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 964 | return EGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 965 | } |
| 966 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 967 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 968 | "' in the '" + Ty->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 969 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 970 | } |
| 971 | } |
| 972 | |
| 973 | // Otherwise there is no existing GV to use, create one now. |
| 974 | GlobalVariable *GV = |
| 975 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 976 | CurModule.CurrentModule); |
| 977 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 978 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 979 | } |
| 980 | |
| 981 | // setTypeName - Set the specified type to the name given. The name may be |
| 982 | // null potentially, in which case this is a noop. The string passed in is |
| 983 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 984 | // |
| 985 | // This function returns true if the type has already been defined, but is |
| 986 | // allowed to be redefined in the specified context. If the name is a new name |
| 987 | // for the type plane, it is inserted and false is returned. |
| 988 | static bool setTypeName(const Type *T, char *NameStr) { |
| 989 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 990 | if (NameStr == 0) return false; |
| 991 | |
| 992 | std::string Name(NameStr); // Copy string |
| 993 | free(NameStr); // Free old string |
| 994 | |
| 995 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 996 | if (T == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 997 | GenerateError("Can't assign name '" + Name + "' to the void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 998 | return false; |
| 999 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1000 | |
| 1001 | // Set the type name, checking for conflicts as we do so. |
| 1002 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1003 | |
| 1004 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1005 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1006 | assert(Existing && "Conflict but no matching type?"); |
| 1007 | |
| 1008 | // There is only one case where this is allowed: when we are refining an |
| 1009 | // opaque type. In this case, Existing will be an opaque type. |
| 1010 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1011 | // We ARE replacing an opaque type! |
| 1012 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1013 | return true; |
| 1014 | } |
| 1015 | |
| 1016 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1017 | // the redefinition is identical to the original. This will be so if |
| 1018 | // Existing and T point to the same Type object. In this one case we |
| 1019 | // allow the equivalent redefinition. |
| 1020 | if (Existing == T) return true; // Yes, it's equal. |
| 1021 | |
| 1022 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1023 | GenerateError("Redefinition of type named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1024 | T->getDescription() + "' type plane!"); |
| 1025 | } |
| 1026 | |
| 1027 | return false; |
| 1028 | } |
| 1029 | |
| 1030 | //===----------------------------------------------------------------------===// |
| 1031 | // Code for handling upreferences in type names... |
| 1032 | // |
| 1033 | |
| 1034 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1035 | // |
| 1036 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1037 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1038 | E) != Ty->subtype_end(); |
| 1039 | } |
| 1040 | |
| 1041 | namespace { |
| 1042 | struct UpRefRecord { |
| 1043 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1044 | // this type is resolved. |
| 1045 | unsigned NestingLevel; |
| 1046 | |
| 1047 | // LastContainedTy - This is the type at the current binding level for the |
| 1048 | // type. Every time we reduce the nesting level, this gets updated. |
| 1049 | const Type *LastContainedTy; |
| 1050 | |
| 1051 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1052 | // represented with. |
| 1053 | OpaqueType *UpRefTy; |
| 1054 | |
| 1055 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1056 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1057 | }; |
| 1058 | } |
| 1059 | |
| 1060 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1061 | static std::vector<UpRefRecord> UpRefs; |
| 1062 | |
| 1063 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1064 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1065 | /// currently active types. For each type, if the up reference is contained in |
| 1066 | /// the newly completed type, we decrement the level count. When the level |
| 1067 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1068 | /// thus we can complete the cycle. |
| 1069 | /// |
| 1070 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1071 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1072 | // nothing to resolve here. |
| 1073 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1074 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1075 | PATypeHolder Ty(ty); |
| 1076 | UR_OUT("Type '" << Ty->getDescription() << |
| 1077 | "' newly formed. Resolving upreferences.\n" << |
| 1078 | UpRefs.size() << " upreferences active!\n"); |
| 1079 | |
| 1080 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1081 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1082 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1083 | // this variable. |
| 1084 | OpaqueType *TypeToResolve = 0; |
| 1085 | |
| 1086 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1087 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1088 | << UpRefs[i].second->getDescription() << ") = " |
| 1089 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1090 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1091 | // Decrement level of upreference |
| 1092 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1093 | UpRefs[i].LastContainedTy = Ty; |
| 1094 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1095 | if (Level == 0) { // Upreference should be resolved! |
| 1096 | if (!TypeToResolve) { |
| 1097 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1098 | } else { |
| 1099 | UR_OUT(" * Resolving upreference for " |
| 1100 | << UpRefs[i].second->getDescription() << "\n"; |
| 1101 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1102 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1103 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1104 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1105 | } |
| 1106 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1107 | --i; // Do not skip the next element... |
| 1108 | } |
| 1109 | } |
| 1110 | } |
| 1111 | |
| 1112 | if (TypeToResolve) { |
| 1113 | UR_OUT(" * Resolving upreference for " |
| 1114 | << UpRefs[i].second->getDescription() << "\n"; |
| 1115 | std::string OldName = TypeToResolve->getDescription()); |
| 1116 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1117 | } |
| 1118 | |
| 1119 | return Ty; |
| 1120 | } |
| 1121 | |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1122 | /// This function is used to obtain the correct opcode for an instruction when |
| 1123 | /// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both |
| 1124 | /// an opcode and an "obsolete" flag. These are generated by the lexer and |
| 1125 | /// the "obsolete" member will be true when the lexer encounters the token for |
| 1126 | /// an obsolete opcode. For example, "div" was replaced by [usf]div but we need |
| 1127 | /// to maintain backwards compatibility for asm files that still have the "div" |
| 1128 | /// instruction. This function handles converting div -> [usf]div appropriately. |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1129 | /// @brief Convert obsolete BinaryOps opcodes to new values |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1130 | static void |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1131 | sanitizeOpcode(OpcodeInfo<Instruction::BinaryOps> &OI, const Type *Ty) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1132 | { |
| 1133 | // If its not obsolete, don't do anything |
| 1134 | if (!OI.obsolete) |
| 1135 | return; |
| 1136 | |
| 1137 | // If its a packed type we want to use the element type |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1138 | if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1139 | Ty = PTy->getElementType(); |
| 1140 | |
| 1141 | // Depending on the opcode .. |
| 1142 | switch (OI.opcode) { |
| 1143 | default: |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 1144 | GenerateError("Invalid obsolete opCode (check Lexer.l)"); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1145 | break; |
| 1146 | case Instruction::UDiv: |
| 1147 | // Handle cases where the opcode needs to change |
| 1148 | if (Ty->isFloatingPoint()) |
| 1149 | OI.opcode = Instruction::FDiv; |
| 1150 | else if (Ty->isSigned()) |
| 1151 | OI.opcode = Instruction::SDiv; |
| 1152 | break; |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 1153 | case Instruction::URem: |
| 1154 | if (Ty->isFloatingPoint()) |
| 1155 | OI.opcode = Instruction::FRem; |
| 1156 | else if (Ty->isSigned()) |
| 1157 | OI.opcode = Instruction::SRem; |
| 1158 | break; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1159 | } |
| 1160 | // Its not obsolete any more, we fixed it. |
| 1161 | OI.obsolete = false; |
| 1162 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1163 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1164 | /// This function is similar to the previous overload of sanitizeOpcode but |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1165 | /// operates on Instruction::OtherOps instead of Instruction::BinaryOps. |
| 1166 | /// @brief Convert obsolete OtherOps opcodes to new values |
| 1167 | static void |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1168 | sanitizeOpcode(OpcodeInfo<Instruction::OtherOps> &OI, const Type *Ty) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1169 | { |
| 1170 | // If its not obsolete, don't do anything |
| 1171 | if (!OI.obsolete) |
| 1172 | return; |
| 1173 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1174 | switch (OI.opcode) { |
| 1175 | default: |
| 1176 | GenerateError("Invalid obsolete opcode (check Lexer.l)"); |
| 1177 | break; |
| 1178 | case Instruction::LShr: |
| 1179 | if (Ty->isSigned()) |
| 1180 | OI.opcode = Instruction::AShr; |
| 1181 | break; |
| 1182 | } |
| 1183 | // Its not obsolete any more, we fixed it. |
| 1184 | OI.obsolete = false; |
| 1185 | } |
| 1186 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1187 | // common code from the two 'RunVMAsmParser' functions |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1188 | static Module* RunParser(Module * M) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1189 | |
| 1190 | llvmAsmlineno = 1; // Reset the current line number... |
| 1191 | ObsoleteVarArgs = false; |
| 1192 | NewVarArgs = false; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1193 | CurModule.CurrentModule = M; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 1194 | |
| 1195 | // Check to make sure the parser succeeded |
| 1196 | if (yyparse()) { |
| 1197 | if (ParserResult) |
| 1198 | delete ParserResult; |
| 1199 | return 0; |
| 1200 | } |
| 1201 | |
| 1202 | // Check to make sure that parsing produced a result |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1203 | if (!ParserResult) |
| 1204 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1205 | |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 1206 | // Reset ParserResult variable while saving its value for the result. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1207 | Module *Result = ParserResult; |
| 1208 | ParserResult = 0; |
| 1209 | |
| 1210 | //Not all functions use vaarg, so make a second check for ObsoleteVarArgs |
| 1211 | { |
| 1212 | Function* F; |
| 1213 | if ((F = Result->getNamedFunction("llvm.va_start")) |
| 1214 | && F->getFunctionType()->getNumParams() == 0) |
| 1215 | ObsoleteVarArgs = true; |
| 1216 | if((F = Result->getNamedFunction("llvm.va_copy")) |
| 1217 | && F->getFunctionType()->getNumParams() == 1) |
| 1218 | ObsoleteVarArgs = true; |
| 1219 | } |
| 1220 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1221 | if (ObsoleteVarArgs && NewVarArgs) { |
| 1222 | GenerateError( |
| 1223 | "This file is corrupt: it uses both new and old style varargs"); |
| 1224 | return 0; |
| 1225 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1226 | |
| 1227 | if(ObsoleteVarArgs) { |
| 1228 | if(Function* F = Result->getNamedFunction("llvm.va_start")) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1229 | if (F->arg_size() != 0) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1230 | GenerateError("Obsolete va_start takes 0 argument!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1231 | return 0; |
| 1232 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1233 | |
| 1234 | //foo = va_start() |
| 1235 | // -> |
| 1236 | //bar = alloca typeof(foo) |
| 1237 | //va_start(bar) |
| 1238 | //foo = load bar |
| 1239 | |
| 1240 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1241 | const Type* ArgTy = F->getFunctionType()->getReturnType(); |
| 1242 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1243 | Function* NF = Result->getOrInsertFunction("llvm.va_start", |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 1244 | RetTy, ArgTyPtr, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1245 | |
| 1246 | while (!F->use_empty()) { |
| 1247 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1248 | AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); |
| 1249 | new CallInst(NF, bar, "", CI); |
| 1250 | Value* foo = new LoadInst(bar, "vastart.fix.2", CI); |
| 1251 | CI->replaceAllUsesWith(foo); |
| 1252 | CI->getParent()->getInstList().erase(CI); |
| 1253 | } |
| 1254 | Result->getFunctionList().erase(F); |
| 1255 | } |
| 1256 | |
| 1257 | if(Function* F = Result->getNamedFunction("llvm.va_end")) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1258 | if(F->arg_size() != 1) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1259 | GenerateError("Obsolete va_end takes 1 argument!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1260 | return 0; |
| 1261 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1262 | |
| 1263 | //vaend foo |
| 1264 | // -> |
| 1265 | //bar = alloca 1 of typeof(foo) |
| 1266 | //vaend bar |
| 1267 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1268 | const Type* ArgTy = F->getFunctionType()->getParamType(0); |
| 1269 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1270 | Function* NF = Result->getOrInsertFunction("llvm.va_end", |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 1271 | RetTy, ArgTyPtr, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1272 | |
| 1273 | while (!F->use_empty()) { |
| 1274 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1275 | AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); |
| 1276 | new StoreInst(CI->getOperand(1), bar, CI); |
| 1277 | new CallInst(NF, bar, "", CI); |
| 1278 | CI->getParent()->getInstList().erase(CI); |
| 1279 | } |
| 1280 | Result->getFunctionList().erase(F); |
| 1281 | } |
| 1282 | |
| 1283 | if(Function* F = Result->getNamedFunction("llvm.va_copy")) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1284 | if(F->arg_size() != 1) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1285 | GenerateError("Obsolete va_copy takes 1 argument!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1286 | return 0; |
| 1287 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1288 | //foo = vacopy(bar) |
| 1289 | // -> |
| 1290 | //a = alloca 1 of typeof(foo) |
| 1291 | //b = alloca 1 of typeof(foo) |
| 1292 | //store bar -> b |
| 1293 | //vacopy(a, b) |
| 1294 | //foo = load a |
| 1295 | |
| 1296 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1297 | const Type* ArgTy = F->getFunctionType()->getReturnType(); |
| 1298 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1299 | Function* NF = Result->getOrInsertFunction("llvm.va_copy", |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 1300 | RetTy, ArgTyPtr, ArgTyPtr, |
| 1301 | (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1302 | |
| 1303 | while (!F->use_empty()) { |
| 1304 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1305 | AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); |
| 1306 | AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); |
| 1307 | new StoreInst(CI->getOperand(1), b, CI); |
| 1308 | new CallInst(NF, a, b, "", CI); |
| 1309 | Value* foo = new LoadInst(a, "vacopy.fix.3", CI); |
| 1310 | CI->replaceAllUsesWith(foo); |
| 1311 | CI->getParent()->getInstList().erase(CI); |
| 1312 | } |
| 1313 | Result->getFunctionList().erase(F); |
| 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | return Result; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1318 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1319 | |
| 1320 | //===----------------------------------------------------------------------===// |
| 1321 | // RunVMAsmParser - Define an interface to this parser |
| 1322 | //===----------------------------------------------------------------------===// |
| 1323 | // |
| 1324 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1325 | set_scan_file(F); |
| 1326 | |
| 1327 | CurFilename = Filename; |
| 1328 | return RunParser(new Module(CurFilename)); |
| 1329 | } |
| 1330 | |
| 1331 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1332 | set_scan_string(AsmString); |
| 1333 | |
| 1334 | CurFilename = "from_memory"; |
| 1335 | if (M == NULL) { |
| 1336 | return RunParser(new Module (CurFilename)); |
| 1337 | } else { |
| 1338 | return RunParser(M); |
| 1339 | } |
| 1340 | } |
| 1341 | |
| 1342 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1343 | |
| 1344 | /* Enabling traces. */ |
| 1345 | #ifndef YYDEBUG |
| 1346 | # define YYDEBUG 0 |
| 1347 | #endif |
| 1348 | |
| 1349 | /* Enabling verbose error messages. */ |
| 1350 | #ifdef YYERROR_VERBOSE |
| 1351 | # undef YYERROR_VERBOSE |
| 1352 | # define YYERROR_VERBOSE 1 |
| 1353 | #else |
| 1354 | # define YYERROR_VERBOSE 0 |
| 1355 | #endif |
| 1356 | |
| 1357 | /* Enabling the token table. */ |
| 1358 | #ifndef YYTOKEN_TABLE |
| 1359 | # define YYTOKEN_TABLE 0 |
| 1360 | #endif |
| 1361 | |
| 1362 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1363 | #line 1038 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1364 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1365 | llvm::Module *ModuleVal; |
| 1366 | llvm::Function *FunctionVal; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1367 | std::pair<TypeInfo, char*> *ArgVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1368 | llvm::BasicBlock *BasicBlockVal; |
| 1369 | llvm::TerminatorInst *TermInstVal; |
| 1370 | llvm::Instruction *InstVal; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1371 | ConstInfo ConstVal; |
| 1372 | TypeInfo TypeVal; |
| 1373 | ValueInfo ValueVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1374 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1375 | std::vector<std::pair<TypeInfo,char*> >*ArgList; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1376 | std::vector<ValueInfo> *ValueList; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1377 | std::list<TypeInfo> *TypeList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1378 | // Represent the RHS of PHI node |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1379 | std::list<std::pair<llvm::Value*, llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1380 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1381 | std::vector<ConstInfo> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1382 | |
| 1383 | llvm::GlobalValue::LinkageTypes Linkage; |
| 1384 | int64_t SInt64Val; |
| 1385 | uint64_t UInt64Val; |
| 1386 | int SIntVal; |
| 1387 | unsigned UIntVal; |
| 1388 | double FPVal; |
| 1389 | bool BoolVal; |
| 1390 | |
| 1391 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1392 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1393 | |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1394 | BinaryOpInfo BinaryOpVal; |
| 1395 | TermOpInfo TermOpVal; |
| 1396 | MemOpInfo MemOpVal; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1397 | CastOpInfo CastOpVal; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1398 | OtherOpInfo OtherOpVal; |
| 1399 | llvm::Module::Endianness Endianness; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1400 | } YYSTYPE; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1401 | /* Line 196 of yacc.c. */ |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1402 | #line 1403 "llvmAsmParser.tab.c" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1403 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1404 | # define YYSTYPE_IS_DECLARED 1 |
| 1405 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1406 | #endif |
| 1407 | |
| 1408 | |
| 1409 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1410 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1411 | |
| 1412 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1413 | /* Line 219 of yacc.c. */ |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1414 | #line 1415 "llvmAsmParser.tab.c" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1415 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1416 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1417 | # define YYSIZE_T __SIZE_TYPE__ |
| 1418 | #endif |
| 1419 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1420 | # define YYSIZE_T size_t |
| 1421 | #endif |
| 1422 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1423 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1424 | # define YYSIZE_T size_t |
| 1425 | #endif |
| 1426 | #if ! defined (YYSIZE_T) |
| 1427 | # define YYSIZE_T unsigned int |
| 1428 | #endif |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 1429 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1430 | #ifndef YY_ |
| 1431 | # if YYENABLE_NLS |
| 1432 | # if ENABLE_NLS |
| 1433 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1434 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1435 | # endif |
| 1436 | # endif |
| 1437 | # ifndef YY_ |
| 1438 | # define YY_(msgid) msgid |
| 1439 | # endif |
| 1440 | #endif |
| 1441 | |
| 1442 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1443 | |
| 1444 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1445 | |
| 1446 | # ifdef YYSTACK_USE_ALLOCA |
| 1447 | # if YYSTACK_USE_ALLOCA |
| 1448 | # ifdef __GNUC__ |
| 1449 | # define YYSTACK_ALLOC __builtin_alloca |
| 1450 | # else |
| 1451 | # define YYSTACK_ALLOC alloca |
| 1452 | # if defined (__STDC__) || defined (__cplusplus) |
| 1453 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1454 | # define YYINCLUDED_STDLIB_H |
| 1455 | # endif |
| 1456 | # endif |
| 1457 | # endif |
| 1458 | # endif |
| 1459 | |
| 1460 | # ifdef YYSTACK_ALLOC |
| 1461 | /* Pacify GCC's `empty if-body' warning. */ |
| 1462 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1463 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1464 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1465 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1466 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1467 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1468 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1469 | # endif |
| 1470 | # else |
| 1471 | # define YYSTACK_ALLOC YYMALLOC |
| 1472 | # define YYSTACK_FREE YYFREE |
| 1473 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1474 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1475 | # endif |
| 1476 | # ifdef __cplusplus |
| 1477 | extern "C" { |
| 1478 | # endif |
| 1479 | # ifndef YYMALLOC |
| 1480 | # define YYMALLOC malloc |
| 1481 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1482 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1483 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1484 | # endif |
| 1485 | # endif |
| 1486 | # ifndef YYFREE |
| 1487 | # define YYFREE free |
| 1488 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1489 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1490 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1491 | # endif |
| 1492 | # endif |
| 1493 | # ifdef __cplusplus |
| 1494 | } |
| 1495 | # endif |
| 1496 | # endif |
| 1497 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1498 | |
| 1499 | |
| 1500 | #if (! defined (yyoverflow) \ |
| 1501 | && (! defined (__cplusplus) \ |
| 1502 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1503 | |
| 1504 | /* A type that is properly aligned for any stack member. */ |
| 1505 | union yyalloc |
| 1506 | { |
| 1507 | short int yyss; |
| 1508 | YYSTYPE yyvs; |
| 1509 | }; |
| 1510 | |
| 1511 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1512 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1513 | |
| 1514 | /* The size of an array large to enough to hold all stacks, each with |
| 1515 | N elements. */ |
| 1516 | # define YYSTACK_BYTES(N) \ |
| 1517 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1518 | + YYSTACK_GAP_MAXIMUM) |
| 1519 | |
| 1520 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1521 | not overlap. */ |
| 1522 | # ifndef YYCOPY |
| 1523 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1524 | # define YYCOPY(To, From, Count) \ |
| 1525 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1526 | # else |
| 1527 | # define YYCOPY(To, From, Count) \ |
| 1528 | do \ |
| 1529 | { \ |
| 1530 | YYSIZE_T yyi; \ |
| 1531 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1532 | (To)[yyi] = (From)[yyi]; \ |
| 1533 | } \ |
| 1534 | while (0) |
| 1535 | # endif |
| 1536 | # endif |
| 1537 | |
| 1538 | /* Relocate STACK from its old location to the new one. The |
| 1539 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1540 | elements in the stack, and YYPTR gives the new location of the |
| 1541 | stack. Advance YYPTR to a properly aligned location for the next |
| 1542 | stack. */ |
| 1543 | # define YYSTACK_RELOCATE(Stack) \ |
| 1544 | do \ |
| 1545 | { \ |
| 1546 | YYSIZE_T yynewbytes; \ |
| 1547 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1548 | Stack = &yyptr->Stack; \ |
| 1549 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1550 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1551 | } \ |
| 1552 | while (0) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 1553 | |
| 1554 | #endif |
| 1555 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1556 | #if defined (__STDC__) || defined (__cplusplus) |
| 1557 | typedef signed char yysigned_char; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1558 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1559 | typedef short int yysigned_char; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1560 | #endif |
| 1561 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1562 | /* YYFINAL -- State number of the termination state. */ |
| 1563 | #define YYFINAL 4 |
| 1564 | /* YYLAST -- Last index in YYTABLE. */ |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1565 | #define YYLAST 1410 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1566 | |
| 1567 | /* YYNTOKENS -- Number of terminals. */ |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1568 | #define YYNTOKENS 139 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1569 | /* YYNNTS -- Number of nonterminals. */ |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1570 | #define YYNNTS 76 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1571 | /* YYNRULES -- Number of rules. */ |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1572 | #define YYNRULES 269 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1573 | /* YYNRULES -- Number of states. */ |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1574 | #define YYNSTATES 534 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1575 | |
| 1576 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1577 | #define YYUNDEFTOK 2 |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1578 | #define YYMAXUTOK 379 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1579 | |
| 1580 | #define YYTRANSLATE(YYX) \ |
| 1581 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1582 | |
| 1583 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1584 | static const unsigned char yytranslate[] = |
| 1585 | { |
| 1586 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1587 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1588 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1589 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1590 | 128, 129, 137, 2, 126, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1591 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1592 | 133, 125, 134, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1593 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1594 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1595 | 2, 130, 127, 132, 2, 2, 2, 2, 2, 138, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1596 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1597 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1598 | 131, 2, 2, 135, 2, 136, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1599 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1600 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1601 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1602 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1603 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1604 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1605 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1606 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1607 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1608 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1609 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1610 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1611 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1612 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1613 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1614 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1615 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1616 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1617 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1618 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1619 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1620 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1621 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1622 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1623 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1624 | }; |
| 1625 | |
| 1626 | #if YYDEBUG |
| 1627 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1628 | YYRHS. */ |
| 1629 | static const unsigned short int yyprhs[] = |
| 1630 | { |
| 1631 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1632 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1633 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1634 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1635 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1636 | 99, 101, 104, 105, 107, 109, 111, 113, 115, 117, |
| 1637 | 119, 120, 121, 123, 125, 127, 129, 131, 133, 136, |
| 1638 | 137, 140, 141, 145, 148, 149, 151, 152, 156, 158, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1639 | 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1640 | 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, |
| 1641 | 201, 203, 206, 211, 217, 223, 227, 230, 233, 235, |
| 1642 | 239, 241, 245, 247, 248, 253, 257, 261, 266, 271, |
| 1643 | 275, 278, 281, 284, 287, 290, 293, 296, 299, 302, |
| 1644 | 305, 312, 318, 327, 334, 341, 348, 355, 362, 371, |
| 1645 | 380, 384, 386, 388, 390, 392, 395, 398, 403, 406, |
| 1646 | 408, 413, 416, 421, 422, 430, 431, 439, 440, 448, |
| 1647 | 449, 457, 461, 466, 467, 469, 471, 473, 477, 481, |
| 1648 | 485, 489, 493, 497, 499, 500, 502, 504, 506, 507, |
| 1649 | 510, 514, 516, 518, 522, 524, 525, 534, 536, 538, |
| 1650 | 542, 544, 546, 549, 550, 552, 554, 555, 560, 561, |
| 1651 | 563, 565, 567, 569, 571, 573, 575, 577, 579, 583, |
| 1652 | 585, 591, 593, 595, 597, 599, 602, 605, 608, 612, |
| 1653 | 615, 616, 618, 621, 624, 628, 638, 648, 657, 671, |
| 1654 | 673, 675, 682, 688, 691, 698, 706, 708, 712, 714, |
| 1655 | 715, 718, 720, 726, 732, 738, 741, 746, 751, 758, |
| 1656 | 763, 768, 773, 778, 785, 792, 795, 803, 805, 808, |
| 1657 | 809, 811, 812, 816, 823, 827, 834, 837, 842, 849 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1658 | }; |
| 1659 | |
| 1660 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1661 | static const short int yyrhs[] = |
| 1662 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1663 | 171, 0, -1, 5, -1, 6, -1, 3, -1, 4, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1664 | -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, |
| 1665 | -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, |
| 1666 | -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1667 | -1, 93, -1, 94, -1, 95, -1, 102, -1, 103, |
| 1668 | -1, 104, -1, 105, -1, 106, -1, 107, -1, 108, |
| 1669 | -1, 109, -1, 110, -1, 111, -1, 112, -1, 113, |
| 1670 | -1, 116, -1, 117, -1, 118, -1, 16, -1, 14, |
| 1671 | -1, 12, -1, 10, -1, 17, -1, 15, -1, 13, |
| 1672 | -1, 11, -1, 147, -1, 148, -1, 18, -1, 19, |
| 1673 | -1, 183, 125, -1, -1, 41, -1, 42, -1, 43, |
| 1674 | -1, 44, -1, 45, -1, 46, -1, 47, -1, -1, |
| 1675 | -1, 65, -1, 66, -1, 67, -1, 68, -1, 69, |
| 1676 | -1, 70, -1, 64, 4, -1, -1, 57, 4, -1, |
| 1677 | -1, 126, 57, 4, -1, 34, 24, -1, -1, 156, |
| 1678 | -1, -1, 126, 159, 158, -1, 156, -1, 57, 4, |
| 1679 | -1, 162, -1, 8, -1, 164, -1, 8, -1, 164, |
| 1680 | -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, |
| 1681 | -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, |
| 1682 | -1, 19, -1, 20, -1, 21, -1, 48, -1, 163, |
| 1683 | -1, 198, -1, 127, 4, -1, 161, 128, 166, 129, |
| 1684 | -1, 130, 4, 131, 164, 132, -1, 133, 4, 131, |
| 1685 | 164, 134, -1, 135, 165, 136, -1, 135, 136, -1, |
| 1686 | 164, 137, -1, 164, -1, 165, 126, 164, -1, 165, |
| 1687 | -1, 165, 126, 37, -1, 37, -1, -1, 162, 130, |
| 1688 | 169, 132, -1, 162, 130, 132, -1, 162, 138, 24, |
| 1689 | -1, 162, 133, 169, 134, -1, 162, 135, 169, 136, |
| 1690 | -1, 162, 135, 136, -1, 162, 38, -1, 162, 39, |
| 1691 | -1, 162, 198, -1, 162, 168, -1, 162, 26, -1, |
| 1692 | 147, 141, -1, 148, 4, -1, 9, 27, -1, 9, |
| 1693 | 28, -1, 150, 7, -1, 145, 128, 167, 36, 162, |
| 1694 | 129, -1, 101, 128, 167, 212, 129, -1, 115, 128, |
| 1695 | 167, 126, 167, 126, 167, 129, -1, 142, 128, 167, |
| 1696 | 126, 167, 129, -1, 143, 128, 167, 126, 167, 129, |
| 1697 | -1, 144, 128, 167, 126, 167, 129, -1, 146, 128, |
| 1698 | 167, 126, 167, 129, -1, 120, 128, 167, 126, 167, |
| 1699 | 129, -1, 121, 128, 167, 126, 167, 126, 167, 129, |
| 1700 | -1, 122, 128, 167, 126, 167, 126, 167, 129, -1, |
| 1701 | 169, 126, 167, -1, 167, -1, 32, -1, 33, -1, |
| 1702 | 172, -1, 172, 192, -1, 172, 194, -1, 172, 62, |
| 1703 | 61, 178, -1, 172, 25, -1, 173, -1, 173, 151, |
| 1704 | 20, 160, -1, 173, 194, -1, 173, 62, 61, 178, |
| 1705 | -1, -1, 173, 151, 152, 170, 167, 174, 158, -1, |
| 1706 | -1, 173, 151, 50, 170, 162, 175, 158, -1, -1, |
| 1707 | 173, 151, 45, 170, 162, 176, 158, -1, -1, 173, |
| 1708 | 151, 47, 170, 162, 177, 158, -1, 173, 51, 180, |
| 1709 | -1, 173, 58, 125, 181, -1, -1, 24, -1, 56, |
| 1710 | -1, 55, -1, 53, 125, 179, -1, 54, 125, 4, |
| 1711 | -1, 52, 125, 24, -1, 71, 125, 24, -1, 130, |
| 1712 | 182, 132, -1, 182, 126, 24, -1, 24, -1, -1, |
| 1713 | 22, -1, 24, -1, 183, -1, -1, 162, 184, -1, |
| 1714 | 186, 126, 185, -1, 185, -1, 186, -1, 186, 126, |
| 1715 | 37, -1, 37, -1, -1, 153, 160, 183, 128, 187, |
| 1716 | 129, 157, 154, -1, 29, -1, 135, -1, 152, 188, |
| 1717 | 189, -1, 30, -1, 136, -1, 201, 191, -1, -1, |
| 1718 | 45, -1, 47, -1, -1, 31, 195, 193, 188, -1, |
| 1719 | -1, 63, -1, 3, -1, 4, -1, 7, -1, 27, |
| 1720 | -1, 28, -1, 38, -1, 39, -1, 26, -1, 133, |
| 1721 | 169, 134, -1, 168, -1, 61, 196, 24, 126, 24, |
| 1722 | -1, 140, -1, 183, -1, 198, -1, 197, -1, 162, |
| 1723 | 199, -1, 201, 202, -1, 190, 202, -1, 203, 151, |
| 1724 | 204, -1, 203, 206, -1, -1, 23, -1, 72, 200, |
| 1725 | -1, 72, 8, -1, 73, 21, 199, -1, 73, 9, |
| 1726 | 199, 126, 21, 199, 126, 21, 199, -1, 74, 149, |
| 1727 | 199, 126, 21, 199, 130, 205, 132, -1, 74, 149, |
| 1728 | 199, 126, 21, 199, 130, 132, -1, 75, 153, 160, |
| 1729 | 199, 128, 209, 129, 36, 21, 199, 76, 21, 199, |
| 1730 | -1, 76, -1, 77, -1, 205, 149, 197, 126, 21, |
| 1731 | 199, -1, 149, 197, 126, 21, 199, -1, 151, 211, |
| 1732 | -1, 162, 130, 199, 126, 199, 132, -1, 207, 126, |
| 1733 | 130, 199, 126, 199, 132, -1, 200, -1, 208, 126, |
| 1734 | 200, -1, 208, -1, -1, 60, 59, -1, 59, -1, |
| 1735 | 142, 162, 199, 126, 199, -1, 143, 162, 199, 126, |
| 1736 | 199, -1, 144, 162, 199, 126, 199, -1, 49, 200, |
| 1737 | -1, 146, 200, 126, 200, -1, 145, 200, 36, 162, |
| 1738 | -1, 115, 200, 126, 200, 126, 200, -1, 119, 200, |
| 1739 | 126, 162, -1, 123, 200, 126, 162, -1, 124, 200, |
| 1740 | 126, 162, -1, 120, 200, 126, 200, -1, 121, 200, |
| 1741 | 126, 200, 126, 200, -1, 122, 200, 126, 200, 126, |
| 1742 | 200, -1, 114, 207, -1, 210, 153, 160, 199, 128, |
| 1743 | 209, 129, -1, 214, -1, 126, 208, -1, -1, 35, |
| 1744 | -1, -1, 96, 162, 155, -1, 96, 162, 126, 15, |
| 1745 | 199, 155, -1, 97, 162, 155, -1, 97, 162, 126, |
| 1746 | 15, 199, 155, -1, 98, 200, -1, 213, 99, 162, |
| 1747 | 199, -1, 213, 100, 200, 126, 162, 199, -1, 101, |
| 1748 | 162, 199, 212, -1 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1749 | }; |
| 1750 | |
| 1751 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1752 | static const unsigned short int yyrline[] = |
| 1753 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 1754 | 0, 1164, 1164, 1165, 1173, 1174, 1184, 1184, 1184, 1184, |
| 1755 | 1184, 1184, 1184, 1184, 1184, 1185, 1185, 1185, 1186, 1186, |
| 1756 | 1186, 1186, 1186, 1186, 1187, 1187, 1187, 1187, 1187, 1187, |
| 1757 | 1188, 1188, 1188, 1188, 1188, 1188, 1189, 1189, 1189, 1193, |
| 1758 | 1193, 1193, 1193, 1194, 1194, 1194, 1194, 1195, 1195, 1196, |
| 1759 | 1196, 1199, 1203, 1208, 1209, 1210, 1211, 1212, 1213, 1214, |
| 1760 | 1215, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1233, |
| 1761 | 1234, 1240, 1241, 1249, 1257, 1258, 1263, 1264, 1265, 1270, |
| 1762 | 1284, 1284, 1288, 1288, 1293, 1304, 1304, 1304, 1304, 1304, |
| 1763 | 1304, 1304, 1305, 1305, 1305, 1305, 1305, 1305, 1306, 1311, |
| 1764 | 1315, 1324, 1333, 1348, 1355, 1369, 1380, 1385, 1397, 1402, |
| 1765 | 1408, 1409, 1415, 1421, 1432, 1463, 1478, 1509, 1539, 1564, |
| 1766 | 1578, 1589, 1595, 1657, 1664, 1674, 1681, 1688, 1693, 1698, |
| 1767 | 1707, 1733, 1755, 1764, 1793, 1805, 1812, 1824, 1831, 1838, |
| 1768 | 1848, 1852, 1860, 1860, 1870, 1878, 1883, 1887, 1891, 1895, |
| 1769 | 1910, 1932, 1935, 1938, 1938, 1946, 1946, 1955, 1955, 1964, |
| 1770 | 1964, 1974, 1977, 1980, 1984, 1997, 1998, 2000, 2004, 2013, |
| 1771 | 2017, 2022, 2024, 2029, 2034, 2043, 2043, 2044, 2044, 2046, |
| 1772 | 2053, 2059, 2066, 2070, 2078, 2086, 2091, 2185, 2185, 2187, |
| 1773 | 2195, 2195, 2197, 2202, 2203, 2204, 2206, 2206, 2216, 2220, |
| 1774 | 2225, 2229, 2233, 2237, 2241, 2245, 2249, 2253, 2257, 2280, |
| 1775 | 2284, 2298, 2302, 2308, 2308, 2314, 2321, 2325, 2334, 2345, |
| 1776 | 2354, 2366, 2379, 2383, 2387, 2392, 2401, 2420, 2429, 2494, |
| 1777 | 2498, 2505, 2516, 2529, 2538, 2547, 2557, 2561, 2568, 2571, |
| 1778 | 2575, 2579, 2584, 2606, 2621, 2635, 2648, 2659, 2685, 2693, |
| 1779 | 2699, 2719, 2742, 2748, 2754, 2760, 2775, 2848, 2855, 2858, |
| 1780 | 2863, 2867, 2874, 2879, 2885, 2890, 2896, 2904, 2916, 2931 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1781 | }; |
| 1782 | #endif |
| 1783 | |
| 1784 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1785 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1786 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1787 | static const char *const yytname[] = |
| 1788 | { |
| 1789 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", |
| 1790 | "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", |
| 1791 | "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", |
| 1792 | "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", |
| 1793 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1794 | "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1795 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", |
| 1796 | "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1797 | "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", |
| 1798 | "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", |
| 1799 | "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", |
| 1800 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1801 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", |
| 1802 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", |
| 1803 | "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC", |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1804 | "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", |
| 1805 | "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", |
| 1806 | "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR", |
| 1807 | "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
| 1808 | "VAARG_old", "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['", |
| 1809 | "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", |
| 1810 | "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", |
| 1811 | "CastOps", "ShiftOps", "SIntType", "UIntType", "IntType", "FPType", |
| 1812 | "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", |
| 1813 | "SectionString", "OptSection", "GlobalVarAttributes", |
| 1814 | "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType", |
| 1815 | "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr", |
| 1816 | "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1", |
| 1817 | "@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition", |
| 1818 | "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", |
| 1819 | "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", |
| 1820 | "END", "Function", "FnDeclareLinkage", "FunctionProto", "@5", |
| 1821 | "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1822 | "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", |
| 1823 | "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", |
| 1824 | "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", |
| 1825 | "MemoryInst", 0 |
| 1826 | }; |
| 1827 | #endif |
| 1828 | |
| 1829 | # ifdef YYPRINT |
| 1830 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1831 | token YYLEX-NUM. */ |
| 1832 | static const unsigned short int yytoknum[] = |
| 1833 | { |
| 1834 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1835 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1836 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1837 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1838 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1839 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1840 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1841 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1842 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1843 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1844 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1845 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1846 | 375, 376, 377, 378, 379, 61, 44, 92, 40, 41, |
| 1847 | 91, 120, 93, 60, 62, 123, 125, 42, 99 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1848 | }; |
| 1849 | # endif |
| 1850 | |
| 1851 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1852 | static const unsigned char yyr1[] = |
| 1853 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1854 | 0, 139, 140, 140, 141, 141, 142, 142, 142, 142, |
| 1855 | 142, 142, 142, 142, 142, 143, 143, 143, 144, 144, |
| 1856 | 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, |
| 1857 | 145, 145, 145, 145, 145, 145, 146, 146, 146, 147, |
| 1858 | 147, 147, 147, 148, 148, 148, 148, 149, 149, 150, |
| 1859 | 150, 151, 151, 152, 152, 152, 152, 152, 152, 152, |
| 1860 | 152, 153, 153, 153, 153, 153, 153, 153, 153, 154, |
| 1861 | 154, 155, 155, 156, 157, 157, 158, 158, 159, 159, |
| 1862 | 160, 160, 161, 161, 162, 163, 163, 163, 163, 163, |
| 1863 | 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, |
| 1864 | 164, 164, 164, 164, 164, 164, 164, 164, 165, 165, |
| 1865 | 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, |
| 1866 | 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, |
| 1867 | 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, |
| 1868 | 169, 169, 170, 170, 171, 172, 172, 172, 172, 172, |
| 1869 | 173, 173, 173, 174, 173, 175, 173, 176, 173, 177, |
| 1870 | 173, 173, 173, 173, 178, 179, 179, 180, 180, 180, |
| 1871 | 180, 181, 182, 182, 182, 183, 183, 184, 184, 185, |
| 1872 | 186, 186, 187, 187, 187, 187, 188, 189, 189, 190, |
| 1873 | 191, 191, 192, 193, 193, 193, 195, 194, 196, 196, |
| 1874 | 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, |
| 1875 | 197, 198, 198, 199, 199, 200, 201, 201, 202, 203, |
| 1876 | 203, 203, 204, 204, 204, 204, 204, 204, 204, 204, |
| 1877 | 204, 205, 205, 206, 207, 207, 208, 208, 209, 209, |
| 1878 | 210, 210, 211, 211, 211, 211, 211, 211, 211, 211, |
| 1879 | 211, 211, 211, 211, 211, 211, 211, 211, 212, 212, |
| 1880 | 213, 213, 214, 214, 214, 214, 214, 214, 214, 214 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1881 | }; |
| 1882 | |
| 1883 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1884 | static const unsigned char yyr2[] = |
| 1885 | { |
| 1886 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1887 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1888 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1889 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1890 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1891 | 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, |
| 1892 | 0, 0, 1, 1, 1, 1, 1, 1, 2, 0, |
| 1893 | 2, 0, 3, 2, 0, 1, 0, 3, 1, 2, |
| 1894 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1895 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1896 | 1, 2, 4, 5, 5, 3, 2, 2, 1, 3, |
| 1897 | 1, 3, 1, 0, 4, 3, 3, 4, 4, 3, |
| 1898 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1899 | 6, 5, 8, 6, 6, 6, 6, 6, 8, 8, |
| 1900 | 3, 1, 1, 1, 1, 2, 2, 4, 2, 1, |
| 1901 | 4, 2, 4, 0, 7, 0, 7, 0, 7, 0, |
| 1902 | 7, 3, 4, 0, 1, 1, 1, 3, 3, 3, |
| 1903 | 3, 3, 3, 1, 0, 1, 1, 1, 0, 2, |
| 1904 | 3, 1, 1, 3, 1, 0, 8, 1, 1, 3, |
| 1905 | 1, 1, 2, 0, 1, 1, 0, 4, 0, 1, |
| 1906 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, |
| 1907 | 5, 1, 1, 1, 1, 2, 2, 2, 3, 2, |
| 1908 | 0, 1, 2, 2, 3, 9, 9, 8, 13, 1, |
| 1909 | 1, 6, 5, 2, 6, 7, 1, 3, 1, 0, |
| 1910 | 2, 1, 5, 5, 5, 2, 4, 4, 6, 4, |
| 1911 | 4, 4, 4, 6, 6, 2, 7, 1, 2, 0, |
| 1912 | 1, 0, 3, 6, 3, 6, 2, 4, 6, 4 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1913 | }; |
| 1914 | |
| 1915 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1916 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1917 | means the default is an error. */ |
| 1918 | static const unsigned short int yydefact[] = |
| 1919 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1920 | 163, 0, 60, 149, 1, 148, 196, 53, 54, 55, |
| 1921 | 56, 57, 58, 59, 0, 61, 220, 145, 146, 220, |
| 1922 | 175, 176, 0, 0, 0, 60, 0, 151, 193, 0, |
| 1923 | 0, 62, 63, 64, 65, 66, 67, 0, 0, 221, |
| 1924 | 217, 52, 190, 191, 192, 216, 0, 0, 0, 0, |
| 1925 | 161, 0, 0, 0, 0, 0, 0, 0, 51, 194, |
| 1926 | 195, 61, 164, 147, 68, 2, 3, 81, 85, 86, |
| 1927 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 1928 | 97, 98, 0, 0, 0, 0, 211, 0, 0, 80, |
| 1929 | 99, 84, 212, 100, 187, 188, 189, 261, 219, 0, |
| 1930 | 0, 0, 0, 174, 162, 152, 150, 142, 143, 0, |
| 1931 | 0, 0, 0, 197, 101, 0, 0, 83, 106, 108, |
| 1932 | 0, 0, 113, 107, 260, 0, 241, 0, 0, 0, |
| 1933 | 0, 61, 229, 230, 6, 7, 8, 9, 10, 11, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1934 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1935 | 22, 23, 0, 0, 0, 0, 24, 25, 26, 27, |
| 1936 | 28, 29, 30, 31, 32, 33, 34, 35, 0, 0, |
| 1937 | 36, 37, 38, 0, 0, 0, 0, 0, 0, 0, |
| 1938 | 0, 0, 0, 0, 218, 61, 233, 0, 257, 169, |
| 1939 | 166, 165, 167, 168, 170, 173, 0, 157, 159, 155, |
| 1940 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1941 | 95, 0, 0, 0, 0, 153, 0, 0, 0, 105, |
| 1942 | 185, 112, 110, 0, 0, 245, 240, 223, 222, 0, |
| 1943 | 0, 42, 46, 41, 45, 40, 44, 39, 43, 47, |
| 1944 | 48, 0, 0, 71, 71, 266, 0, 0, 255, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1945 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1946 | 0, 0, 0, 0, 0, 171, 76, 76, 76, 127, |
| 1947 | 128, 4, 5, 125, 126, 129, 124, 120, 121, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1948 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1949 | 0, 0, 0, 123, 122, 76, 82, 82, 109, 184, |
| 1950 | 178, 181, 182, 0, 0, 102, 200, 201, 202, 207, |
| 1951 | 203, 204, 205, 206, 198, 0, 209, 214, 213, 215, |
| 1952 | 0, 224, 0, 0, 0, 262, 0, 264, 259, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1953 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1954 | 0, 0, 0, 0, 0, 0, 172, 0, 158, 160, |
| 1955 | 156, 0, 0, 0, 0, 0, 115, 141, 0, 0, |
| 1956 | 119, 0, 116, 0, 0, 0, 0, 0, 154, 103, |
| 1957 | 104, 177, 179, 0, 74, 111, 199, 0, 0, 0, |
| 1958 | 0, 0, 0, 0, 0, 0, 269, 0, 0, 0, |
| 1959 | 249, 252, 0, 0, 250, 251, 0, 0, 0, 247, |
| 1960 | 246, 0, 267, 0, 0, 0, 78, 76, 259, 0, |
| 1961 | 0, 0, 0, 0, 114, 117, 118, 0, 0, 0, |
| 1962 | 0, 0, 183, 180, 75, 69, 0, 208, 0, 0, |
| 1963 | 239, 71, 72, 71, 236, 258, 0, 0, 0, 0, |
| 1964 | 0, 242, 243, 244, 239, 0, 73, 79, 77, 0, |
| 1965 | 0, 0, 0, 0, 140, 0, 0, 0, 0, 0, |
| 1966 | 0, 186, 0, 0, 0, 238, 0, 0, 263, 265, |
| 1967 | 0, 0, 0, 248, 253, 254, 0, 268, 131, 0, |
| 1968 | 0, 0, 0, 0, 0, 0, 0, 0, 70, 210, |
| 1969 | 0, 0, 0, 237, 234, 0, 256, 0, 137, 0, |
| 1970 | 0, 133, 134, 135, 130, 136, 0, 227, 0, 0, |
| 1971 | 0, 235, 0, 0, 0, 225, 0, 226, 0, 0, |
| 1972 | 132, 138, 139, 0, 0, 0, 0, 0, 0, 232, |
| 1973 | 0, 0, 231, 228 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1974 | }; |
| 1975 | |
| 1976 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1977 | static const short int yydefgoto[] = |
| 1978 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1979 | -1, 86, 273, 288, 289, 290, 291, 292, 211, 212, |
| 1980 | 241, 213, 25, 15, 37, 461, 325, 406, 425, 348, |
| 1981 | 407, 87, 88, 214, 90, 91, 120, 223, 357, 316, |
| 1982 | 358, 109, 1, 2, 3, 295, 268, 266, 267, 63, |
| 1983 | 192, 50, 104, 196, 92, 372, 301, 302, 303, 38, |
| 1984 | 96, 16, 44, 17, 61, 18, 28, 377, 317, 93, |
| 1985 | 319, 434, 19, 40, 41, 184, 509, 98, 248, 465, |
| 1986 | 466, 185, 186, 386, 187, 188 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1987 | }; |
| 1988 | |
| 1989 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1990 | STATE-NUM. */ |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1991 | #define YYPACT_NINF -472 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1992 | static const short int yypact[] = |
| 1993 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1994 | -472, 24, 395, 501, -472, -472, -472, -472, -472, -472, |
| 1995 | -472, -472, -472, -472, -13, 112, 46, -472, -472, -11, |
| 1996 | -472, -472, -18, -41, 45, 51, -1, -472, 40, 106, |
| 1997 | 131, -472, -472, -472, -472, -472, -472, 1136, -23, -472, |
| 1998 | -472, 81, -472, -472, -472, -472, 30, 33, 49, 61, |
| 1999 | -472, 57, 106, 1136, 78, 78, 78, 78, -472, -472, |
| 2000 | -472, 112, -472, -472, -472, -472, -472, 62, -472, -472, |
| 2001 | -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, |
| 2002 | -472, -472, 185, 187, 188, 619, -472, 81, 67, -472, |
| 2003 | -472, -71, -472, -472, -472, -472, -472, 1286, -472, 174, |
| 2004 | 58, 196, 177, 178, -472, -472, -472, -472, -472, 1177, |
| 2005 | 1177, 1177, 1197, -472, -472, 72, 73, -472, -472, -71, |
| 2006 | -89, 79, 151, -472, -472, 1177, -472, 147, 1222, 12, |
| 2007 | 218, 112, -472, -472, -472, -472, -472, -472, -472, -472, |
| 2008 | -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, |
| 2009 | -472, -472, 1177, 1177, 1177, 1177, -472, -472, -472, -472, |
| 2010 | -472, -472, -472, -472, -472, -472, -472, -472, 1177, 1177, |
| 2011 | -472, -472, -472, 1177, 1177, 1177, 1177, 1177, 1177, 1177, |
| 2012 | 1177, 1177, 1177, 1177, -472, 112, -472, -55, -472, -472, |
| 2013 | -472, -472, -472, -472, -472, -472, -62, -472, -472, -472, |
| 2014 | 95, 123, 204, 125, 205, 130, 206, 149, 207, 208, |
| 2015 | 210, 181, 209, 214, 488, -472, 1177, 1177, 1177, -472, |
| 2016 | 944, -472, 88, 93, 698, -472, -472, 62, -472, 698, |
| 2017 | 698, -472, -472, -472, -472, -472, -472, -472, -472, -472, |
| 2018 | -472, 698, 1136, 97, 110, -472, 698, 108, 113, 114, |
| 2019 | 120, 121, 124, 126, 133, 136, 698, 698, 698, 213, |
| 2020 | 139, 1136, 1177, 1177, 227, -472, 140, 140, 140, -472, |
| 2021 | -472, -472, -472, -472, -472, -472, -472, -472, -472, 141, |
| 2022 | 142, 143, 145, 146, 985, 1197, 639, 243, 148, 154, |
| 2023 | 155, 157, 165, -472, -472, 140, -28, -51, -71, -472, |
| 2024 | 81, -472, 153, 172, 1005, -472, -472, -472, -472, -472, |
| 2025 | -472, -472, -472, -472, 244, 1197, -472, -472, -472, -472, |
| 2026 | 180, -472, 182, 698, -7, -472, -6, -472, 183, 698, |
| 2027 | 138, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 184, 186, |
| 2028 | 189, 1177, 1177, 698, 698, 190, -472, -17, -472, -472, |
| 2029 | -472, 1197, 1197, 1197, 1197, 1197, -472, -472, -24, -85, |
| 2030 | -472, -80, -472, 1197, 1197, 1197, 1197, 1197, -472, -472, |
| 2031 | -472, -472, -472, 1046, 277, -472, -472, 289, -27, 293, |
| 2032 | 296, 191, 698, 314, 698, 1177, -472, 194, 698, 195, |
| 2033 | -472, -472, 200, 201, -472, -472, 698, 698, 698, -472, |
| 2034 | -472, 202, -472, 1177, 298, 324, -472, 140, 183, 203, |
| 2035 | 211, 212, 224, 1197, -472, -472, -472, 225, 226, 230, |
| 2036 | 295, 232, -472, -472, -472, 275, 233, -472, 698, 698, |
| 2037 | 1177, 235, -472, 235, -472, 239, 698, 241, 1177, 1177, |
| 2038 | 1177, -472, -472, -472, 1177, 698, -472, -472, -472, 215, |
| 2039 | 1197, 1197, 1197, 1197, -472, 1197, 1197, 1197, 1177, 1197, |
| 2040 | 329, -472, 310, 242, 223, 239, 240, 278, -472, -472, |
| 2041 | 1177, 238, 698, -472, -472, -472, 247, -472, -472, 245, |
| 2042 | 250, 246, 255, 254, 256, 257, 259, 262, -472, -472, |
| 2043 | 318, 15, 337, -472, -472, 252, -472, 1197, -472, 1197, |
| 2044 | 1197, -472, -472, -472, -472, -472, 698, -472, 818, 65, |
| 2045 | 371, -472, 265, 267, 268, -472, 272, -472, 818, 698, |
| 2046 | -472, -472, -472, 378, 274, 328, 698, 384, 385, -472, |
| 2047 | 698, 698, -472, -472 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2048 | }; |
| 2049 | |
| 2050 | /* YYPGOTO[NTERM-NUM]. */ |
| 2051 | static const short int yypgoto[] = |
| 2052 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2053 | -472, -472, -472, 311, 312, 313, 315, 317, -129, -127, |
| 2054 | -471, -472, 370, 392, -120, -472, -237, 50, -472, -253, |
| 2055 | -472, -49, -472, -37, -472, -67, 301, -472, -110, 220, |
| 2056 | -263, 64, -472, -472, -472, -472, -472, -472, -472, 373, |
| 2057 | -472, -472, -472, -472, 2, -472, 70, -472, -472, 374, |
| 2058 | -472, -472, -472, -472, -472, 441, -472, -472, -418, 34, |
| 2059 | 31, -115, -472, 426, -472, -472, -472, -472, -472, 63, |
| 2060 | 3, -472, -472, 38, -472, -472 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2061 | }; |
| 2062 | |
| 2063 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2064 | positive, shift that token. If negative, reduce the rule which |
| 2065 | number is the opposite. If zero, do what YYDEFACT says. |
| 2066 | If YYTABLE_NINF, syntax error. */ |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2067 | #define YYTABLE_NINF -145 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2068 | static const short int yytable[] = |
| 2069 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2070 | 89, 239, 215, 240, 106, 26, 94, 327, 382, 384, |
| 2071 | 225, 242, 39, 228, 349, 350, 89, 404, 119, 42, |
| 2072 | 508, 229, 359, 361, 4, 231, 232, 233, 234, 235, |
| 2073 | 236, 237, 238, 230, 46, 47, 48, 218, 518, 245, |
| 2074 | 405, 413, 368, 26, 262, 263, 413, 219, 29, 415, |
| 2075 | 383, 383, 378, 49, 249, 119, 416, -82, 250, 251, |
| 2076 | 252, 253, 254, 255, 264, 261, 123, 259, 260, 39, |
| 2077 | 265, 53, 197, 198, 199, 231, 232, 233, 234, 235, |
| 2078 | 236, 237, 238, 370, 51, 59, 123, 60, 224, 121, |
| 2079 | 516, 224, 7, 8, 9, 10, 54, 12, 55, 413, |
| 2080 | 524, 56, 413, 20, 369, 21, 52, 427, 414, 123, |
| 2081 | 107, 108, 95, 190, 191, 243, 244, 224, 246, 110, |
| 2082 | 111, 112, 269, 270, 58, 43, -42, -42, -41, -41, |
| 2083 | 62, 247, 224, -40, -40, 64, 224, 224, 224, 224, |
| 2084 | 224, 224, 256, 257, 258, 224, 224, 507, 345, 296, |
| 2085 | 297, 298, -39, -39, 448, 99, 65, 66, 100, 117, |
| 2086 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2087 | 78, 79, 80, 20, 101, 21, 30, 31, 32, 33, |
| 2088 | 34, 35, 36, 300, 271, 272, 102, 103, 221, 114, |
| 2089 | -83, 115, 116, 323, 468, 122, 469, 517, 189, 81, |
| 2090 | 193, 194, 195, 216, 217, 89, 226, 220, -46, -45, |
| 2091 | -44, -43, 343, 274, 304, -49, 389, -50, 391, 392, |
| 2092 | 393, 275, 305, 324, 89, 344, 224, 400, 231, 232, |
| 2093 | 233, 234, 235, 236, 237, 238, 326, 298, 329, 330, |
| 2094 | 331, 408, 409, 410, 411, 412, 332, 333, 294, 341, |
| 2095 | 334, 346, 335, 417, 418, 419, 420, 421, 318, 336, |
| 2096 | 320, 321, 337, 318, 318, 342, 347, 362, 388, 351, |
| 2097 | 352, 353, 322, 354, 355, 318, 363, 328, 82, 373, |
| 2098 | 318, 83, 364, 365, 84, 366, 85, 338, 339, 340, |
| 2099 | 318, 318, 318, 367, 224, 390, 224, 224, 224, 394, |
| 2100 | 395, 374, 371, 454, 399, 224, 379, 376, 380, 385, |
| 2101 | 396, 404, 397, 426, 428, 398, 403, 429, 432, 430, |
| 2102 | 436, 438, 446, 473, 474, 475, 439, 440, 447, 450, |
| 2103 | 444, 458, 460, 488, 489, 383, 300, 451, 452, 506, |
| 2104 | 479, 480, 481, 482, 478, 483, 484, 485, 224, 487, |
| 2105 | 453, 455, 456, 491, 381, 493, 457, 318, 459, 462, |
| 2106 | 387, 467, 239, 318, 240, 470, 445, 472, 490, 492, |
| 2107 | 494, 497, 499, 510, 401, 402, 496, 318, 318, 498, |
| 2108 | 239, 500, 240, 501, 511, 502, 503, 512, 504, 513, |
| 2109 | 514, 505, 519, 224, 520, -144, 521, 522, 523, 526, |
| 2110 | 527, 224, 224, 224, 528, 530, 531, 224, 179, 180, |
| 2111 | 181, 97, 182, 431, 183, 433, 318, 57, 318, 437, |
| 2112 | 5, 486, 318, 222, 424, 105, 6, 441, 442, 443, |
| 2113 | 318, 318, 318, 224, 293, 113, 7, 8, 9, 10, |
| 2114 | 11, 12, 13, 423, 27, 45, 449, 476, 435, 0, |
| 2115 | 0, 0, 0, 0, 0, 0, 0, 14, 0, 463, |
| 2116 | 464, 0, 318, 318, 0, 0, 0, 471, 0, 0, |
| 2117 | 318, 0, 0, 0, 0, 0, 477, 0, 0, 318, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2118 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2119 | 0, 0, 0, 65, 66, 0, 0, 0, 0, 0, |
| 2120 | 0, 0, 0, 495, 0, 0, 318, 0, 0, 0, |
| 2121 | 20, 0, 21, 0, 276, 0, 0, 0, 0, 0, |
| 2122 | 0, -52, 0, 20, 0, 21, 277, 278, 0, 0, |
| 2123 | 0, 0, 6, -52, -52, 0, 0, 515, 0, 0, |
| 2124 | 318, 0, -52, -52, -52, -52, -52, -52, -52, 0, |
| 2125 | 525, -52, 22, 318, 0, 0, 0, 529, 0, 23, |
| 2126 | 318, 532, 533, 24, 318, 318, 134, 135, 136, 137, |
| 2127 | 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, |
| 2128 | 148, 149, 150, 151, 0, 0, 0, 0, 0, 279, |
| 2129 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2130 | 166, 167, 0, 280, 170, 171, 172, 0, 281, 282, |
| 2131 | 283, 0, 0, 0, 0, 0, 0, 0, 284, 0, |
| 2132 | 0, 285, 0, 286, 65, 66, 287, 117, 68, 69, |
| 2133 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2134 | 80, 20, 0, 21, 65, 66, 0, 117, 200, 201, |
| 2135 | 202, 203, 204, 205, 206, 207, 208, 209, 210, 79, |
| 2136 | 80, 20, 0, 21, 0, 0, 0, 81, 0, 0, |
| 2137 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2138 | 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, |
| 2139 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2140 | 0, 306, 307, 65, 66, 308, 0, 0, 0, 0, |
| 2141 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2142 | 20, 0, 21, 0, 309, 310, 311, 0, 0, 0, |
| 2143 | 0, 0, 0, 0, 0, 0, 312, 313, 0, 0, |
| 2144 | 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, |
| 2145 | 0, 0, 84, 0, 85, 118, 0, 0, 0, 314, |
| 2146 | 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, |
| 2147 | 0, 0, 84, 0, 85, 360, 134, 135, 136, 137, |
| 2148 | 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, |
| 2149 | 148, 149, 150, 151, 0, 0, 0, 0, 0, 279, |
| 2150 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2151 | 166, 167, 0, 280, 170, 171, 172, 0, 281, 282, |
| 2152 | 283, 306, 307, 0, 0, 308, 0, 0, 0, 0, |
| 2153 | 0, 315, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2154 | 0, 0, 0, 0, 309, 310, 311, 0, 0, 0, |
| 2155 | 0, 0, 0, 0, 0, 0, 312, 313, 0, 0, |
| 2156 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2157 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 314, |
| 2158 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2159 | 0, 0, 0, 0, 0, 0, 134, 135, 136, 137, |
| 2160 | 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2161 | 148, 149, 150, 151, 0, 0, 0, 0, 0, 279, |
| 2162 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2163 | 166, 167, 0, 280, 170, 171, 172, 0, 281, 282, |
| 2164 | 283, 0, 0, 0, 0, 0, 0, 0, 0, 65, |
| 2165 | 66, 315, 117, 68, 69, 70, 71, 72, 73, 74, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2166 | 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, |
| 2167 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2168 | 0, 299, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2169 | 65, 66, 81, 117, 200, 201, 202, 203, 204, 205, |
| 2170 | 206, 207, 208, 209, 210, 79, 80, 20, 0, 21, |
| 2171 | 65, 66, 0, 117, 68, 69, 70, 71, 72, 73, |
| 2172 | 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, |
| 2173 | 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, |
| 2174 | 0, 0, 375, 0, 0, 0, 0, 0, 0, 0, |
| 2175 | 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, |
| 2176 | 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, |
| 2177 | 21, 82, 0, 0, 83, 0, 0, 84, 0, 85, |
| 2178 | 0, 0, 0, 422, 0, 0, 0, 0, 0, 0, |
| 2179 | 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2180 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2181 | 0, 0, 82, 0, 0, 83, 0, 356, 84, 0, |
| 2182 | 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2183 | 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, |
| 2184 | 85, 65, 66, 0, 67, 68, 69, 70, 71, 72, |
| 2185 | 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, |
| 2186 | 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2187 | 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, |
| 2188 | 0, 85, 65, 66, 81, 117, 68, 69, 70, 71, |
| 2189 | 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, |
| 2190 | 0, 21, 65, 66, 0, 117, 200, 201, 202, 203, |
| 2191 | 204, 205, 206, 207, 208, 209, 210, 79, 80, 20, |
| 2192 | 0, 21, 0, 0, 0, 81, 0, 65, 66, 0, |
| 2193 | 227, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2194 | 77, 78, 79, 80, 20, 81, 21, 0, 0, 0, |
| 2195 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2196 | 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, |
| 2197 | 81, 85, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2198 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2199 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2200 | 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, |
| 2201 | 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, |
| 2202 | 0, 124, 0, 0, 82, 0, 0, 83, 0, 0, |
| 2203 | 84, 0, 85, 0, 0, 125, 0, 0, 0, 0, |
| 2204 | 0, 0, 0, 0, 0, 126, 127, 0, 0, 82, |
| 2205 | 0, 0, 83, 0, 0, 84, 0, 85, 128, 129, |
| 2206 | 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, |
| 2207 | 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, |
| 2208 | 150, 151, 152, 153, 154, 0, 0, 155, 156, 157, |
| 2209 | 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, |
| 2210 | 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, |
| 2211 | 178 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2212 | }; |
| 2213 | |
| 2214 | static const short int yycheck[] = |
| 2215 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2216 | 37, 130, 112, 130, 53, 3, 29, 244, 15, 15, |
| 2217 | 125, 131, 23, 128, 267, 268, 53, 34, 85, 30, |
| 2218 | 491, 9, 285, 286, 0, 10, 11, 12, 13, 14, |
| 2219 | 15, 16, 17, 21, 52, 53, 54, 126, 509, 154, |
| 2220 | 57, 126, 295, 41, 99, 100, 126, 136, 61, 134, |
| 2221 | 57, 57, 315, 71, 169, 122, 136, 128, 173, 174, |
| 2222 | 175, 176, 177, 178, 126, 185, 137, 182, 183, 23, |
| 2223 | 132, 20, 109, 110, 111, 10, 11, 12, 13, 14, |
| 2224 | 15, 16, 17, 134, 125, 45, 137, 47, 125, 87, |
| 2225 | 508, 128, 41, 42, 43, 44, 45, 46, 47, 126, |
| 2226 | 518, 50, 126, 22, 132, 24, 61, 134, 132, 137, |
| 2227 | 32, 33, 135, 55, 56, 152, 153, 154, 155, 55, |
| 2228 | 56, 57, 27, 28, 125, 136, 3, 4, 3, 4, |
| 2229 | 24, 168, 169, 3, 4, 4, 173, 174, 175, 176, |
| 2230 | 177, 178, 179, 180, 181, 182, 183, 132, 263, 216, |
| 2231 | 217, 218, 3, 4, 407, 125, 5, 6, 125, 8, |
| 2232 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2233 | 19, 20, 21, 22, 125, 24, 64, 65, 66, 67, |
| 2234 | 68, 69, 70, 220, 3, 4, 125, 130, 37, 4, |
| 2235 | 128, 4, 4, 242, 431, 128, 433, 132, 24, 48, |
| 2236 | 4, 24, 24, 131, 131, 242, 59, 128, 4, 4, |
| 2237 | 4, 4, 261, 4, 126, 7, 331, 7, 333, 334, |
| 2238 | 335, 7, 129, 126, 261, 262, 263, 342, 10, 11, |
| 2239 | 12, 13, 14, 15, 16, 17, 126, 304, 130, 126, |
| 2240 | 126, 351, 352, 353, 354, 355, 126, 126, 214, 36, |
| 2241 | 126, 24, 126, 363, 364, 365, 366, 367, 224, 126, |
| 2242 | 229, 230, 126, 229, 230, 126, 126, 24, 130, 128, |
| 2243 | 128, 128, 241, 128, 128, 241, 128, 246, 127, 126, |
| 2244 | 246, 130, 128, 128, 133, 128, 135, 256, 257, 258, |
| 2245 | 256, 257, 258, 128, 331, 332, 333, 334, 335, 336, |
| 2246 | 337, 129, 300, 413, 341, 342, 126, 63, 126, 126, |
| 2247 | 126, 34, 126, 24, 21, 126, 126, 21, 4, 128, |
| 2248 | 126, 126, 24, 438, 439, 440, 126, 126, 4, 126, |
| 2249 | 128, 36, 57, 4, 24, 57, 373, 126, 126, 21, |
| 2250 | 450, 451, 452, 453, 129, 455, 456, 457, 385, 459, |
| 2251 | 126, 126, 126, 130, 323, 470, 126, 323, 126, 126, |
| 2252 | 329, 126, 491, 329, 491, 126, 403, 126, 126, 129, |
| 2253 | 132, 126, 126, 36, 343, 344, 129, 343, 344, 129, |
| 2254 | 509, 126, 509, 129, 132, 129, 129, 497, 129, 499, |
| 2255 | 500, 129, 21, 430, 129, 0, 129, 129, 126, 21, |
| 2256 | 126, 438, 439, 440, 76, 21, 21, 444, 97, 97, |
| 2257 | 97, 41, 97, 382, 97, 384, 382, 25, 384, 388, |
| 2258 | 25, 458, 388, 122, 374, 52, 31, 396, 397, 398, |
| 2259 | 396, 397, 398, 470, 214, 61, 41, 42, 43, 44, |
| 2260 | 45, 46, 47, 373, 3, 19, 408, 444, 385, -1, |
| 2261 | -1, -1, -1, -1, -1, -1, -1, 62, -1, 428, |
| 2262 | 429, -1, 428, 429, -1, -1, -1, 436, -1, -1, |
| 2263 | 436, -1, -1, -1, -1, -1, 445, -1, -1, 445, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2264 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2265 | -1, -1, -1, 5, 6, -1, -1, -1, -1, -1, |
| 2266 | -1, -1, -1, 472, -1, -1, 472, -1, -1, -1, |
| 2267 | 22, -1, 24, -1, 26, -1, -1, -1, -1, -1, |
| 2268 | -1, 20, -1, 22, -1, 24, 38, 39, -1, -1, |
| 2269 | -1, -1, 31, 32, 33, -1, -1, 506, -1, -1, |
| 2270 | 506, -1, 41, 42, 43, 44, 45, 46, 47, -1, |
| 2271 | 519, 50, 51, 519, -1, -1, -1, 526, -1, 58, |
| 2272 | 526, 530, 531, 62, 530, 531, 78, 79, 80, 81, |
| 2273 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2274 | 92, 93, 94, 95, -1, -1, -1, -1, -1, 101, |
| 2275 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 2276 | 112, 113, -1, 115, 116, 117, 118, -1, 120, 121, |
| 2277 | 122, -1, -1, -1, -1, -1, -1, -1, 130, -1, |
| 2278 | -1, 133, -1, 135, 5, 6, 138, 8, 9, 10, |
| 2279 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 2280 | 21, 22, -1, 24, 5, 6, -1, 8, 9, 10, |
| 2281 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 2282 | 21, 22, -1, 24, -1, -1, -1, 48, -1, -1, |
| 2283 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2284 | -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, |
| 2285 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2286 | -1, 3, 4, 5, 6, 7, -1, -1, -1, -1, |
| 2287 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2288 | 22, -1, 24, -1, 26, 27, 28, -1, -1, -1, |
| 2289 | -1, -1, -1, -1, -1, -1, 38, 39, -1, -1, |
| 2290 | -1, -1, -1, -1, -1, -1, 127, -1, -1, 130, |
| 2291 | -1, -1, 133, -1, 135, 136, -1, -1, -1, 61, |
| 2292 | -1, -1, -1, -1, -1, -1, 127, -1, -1, 130, |
| 2293 | -1, -1, 133, -1, 135, 136, 78, 79, 80, 81, |
| 2294 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2295 | 92, 93, 94, 95, -1, -1, -1, -1, -1, 101, |
| 2296 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 2297 | 112, 113, -1, 115, 116, 117, 118, -1, 120, 121, |
| 2298 | 122, 3, 4, -1, -1, 7, -1, -1, -1, -1, |
| 2299 | -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2300 | -1, -1, -1, -1, 26, 27, 28, -1, -1, -1, |
| 2301 | -1, -1, -1, -1, -1, -1, 38, 39, -1, -1, |
| 2302 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2303 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, |
| 2304 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2305 | -1, -1, -1, -1, -1, -1, 78, 79, 80, 81, |
| 2306 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2307 | 92, 93, 94, 95, -1, -1, -1, -1, -1, 101, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2308 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 2309 | 112, 113, -1, 115, 116, 117, 118, -1, 120, 121, |
| 2310 | 122, -1, -1, -1, -1, -1, -1, -1, -1, 5, |
| 2311 | 6, 133, 8, 9, 10, 11, 12, 13, 14, 15, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2312 | 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, |
| 2313 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2314 | -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2315 | 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, |
| 2316 | 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, |
| 2317 | 5, 6, -1, 8, 9, 10, 11, 12, 13, 14, |
| 2318 | 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, |
| 2319 | -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, |
| 2320 | -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, |
| 2321 | -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, |
| 2322 | 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, |
| 2323 | 24, 127, -1, -1, 130, -1, -1, 133, -1, 135, |
| 2324 | -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, |
| 2325 | -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2326 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2327 | -1, -1, 127, -1, -1, 130, -1, 132, 133, -1, |
| 2328 | 135, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2329 | -1, -1, 127, -1, -1, 130, -1, -1, 133, -1, |
| 2330 | 135, 5, 6, -1, 8, 9, 10, 11, 12, 13, |
| 2331 | 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, |
| 2332 | 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2333 | -1, -1, -1, 127, -1, -1, 130, -1, -1, 133, |
| 2334 | -1, 135, 5, 6, 48, 8, 9, 10, 11, 12, |
| 2335 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
| 2336 | -1, 24, 5, 6, -1, 8, 9, 10, 11, 12, |
| 2337 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
| 2338 | -1, 24, -1, -1, -1, 48, -1, 5, 6, -1, |
| 2339 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2340 | 18, 19, 20, 21, 22, 48, 24, -1, -1, -1, |
| 2341 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2342 | -1, -1, -1, 127, -1, -1, 130, -1, -1, 133, |
| 2343 | 48, 135, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2344 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2345 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2346 | -1, -1, -1, -1, 127, -1, -1, 130, -1, -1, |
| 2347 | 133, -1, 135, -1, -1, -1, -1, -1, -1, -1, |
| 2348 | -1, 35, -1, -1, 127, -1, -1, 130, -1, -1, |
| 2349 | 133, -1, 135, -1, -1, 49, -1, -1, -1, -1, |
| 2350 | -1, -1, -1, -1, -1, 59, 60, -1, -1, 127, |
| 2351 | -1, -1, 130, -1, -1, 133, -1, 135, 72, 73, |
| 2352 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2353 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2354 | 94, 95, 96, 97, 98, -1, -1, 101, 102, 103, |
| 2355 | 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, |
| 2356 | 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, |
| 2357 | 124 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2358 | }; |
| 2359 | |
| 2360 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2361 | symbol of state STATE-NUM. */ |
| 2362 | static const unsigned char yystos[] = |
| 2363 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2364 | 0, 171, 172, 173, 0, 25, 31, 41, 42, 43, |
| 2365 | 44, 45, 46, 47, 62, 152, 190, 192, 194, 201, |
| 2366 | 22, 24, 51, 58, 62, 151, 183, 194, 195, 61, |
| 2367 | 64, 65, 66, 67, 68, 69, 70, 153, 188, 23, |
| 2368 | 202, 203, 30, 136, 191, 202, 52, 53, 54, 71, |
| 2369 | 180, 125, 61, 20, 45, 47, 50, 152, 125, 45, |
| 2370 | 47, 193, 24, 178, 4, 5, 6, 8, 9, 10, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2371 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2372 | 21, 48, 127, 130, 133, 135, 140, 160, 161, 162, |
| 2373 | 163, 164, 183, 198, 29, 135, 189, 151, 206, 125, |
| 2374 | 125, 125, 125, 130, 181, 178, 160, 32, 33, 170, |
| 2375 | 170, 170, 170, 188, 4, 4, 4, 8, 136, 164, |
| 2376 | 165, 183, 128, 137, 35, 49, 59, 60, 72, 73, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2377 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2378 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2379 | 94, 95, 96, 97, 98, 101, 102, 103, 104, 105, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2380 | 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, |
| 2381 | 116, 117, 118, 119, 120, 121, 122, 123, 124, 142, |
| 2382 | 143, 144, 145, 146, 204, 210, 211, 213, 214, 24, |
| 2383 | 55, 56, 179, 4, 24, 24, 182, 162, 162, 162, |
| 2384 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2385 | 19, 147, 148, 150, 162, 167, 131, 131, 126, 136, |
| 2386 | 128, 37, 165, 166, 162, 200, 59, 8, 200, 9, |
| 2387 | 21, 10, 11, 12, 13, 14, 15, 16, 17, 147, |
| 2388 | 148, 149, 153, 162, 162, 200, 162, 162, 207, 200, |
| 2389 | 200, 200, 200, 200, 200, 200, 162, 162, 162, 200, |
| 2390 | 200, 153, 99, 100, 126, 132, 176, 177, 175, 27, |
| 2391 | 28, 3, 4, 141, 4, 7, 26, 38, 39, 101, |
| 2392 | 115, 120, 121, 122, 130, 133, 135, 138, 142, 143, |
| 2393 | 144, 145, 146, 168, 198, 174, 164, 164, 164, 37, |
| 2394 | 162, 185, 186, 187, 126, 129, 3, 4, 7, 26, |
| 2395 | 27, 28, 38, 39, 61, 133, 168, 197, 198, 199, |
| 2396 | 199, 199, 199, 160, 126, 155, 126, 155, 199, 130, |
| 2397 | 126, 126, 126, 126, 126, 126, 126, 126, 199, 199, |
| 2398 | 199, 36, 126, 160, 162, 200, 24, 126, 158, 158, |
| 2399 | 158, 128, 128, 128, 128, 128, 132, 167, 169, 169, |
| 2400 | 136, 169, 24, 128, 128, 128, 128, 128, 158, 132, |
| 2401 | 134, 183, 184, 126, 129, 37, 63, 196, 169, 126, |
| 2402 | 126, 199, 15, 57, 15, 126, 212, 199, 130, 200, |
| 2403 | 162, 200, 200, 200, 162, 162, 126, 126, 126, 162, |
| 2404 | 200, 199, 199, 126, 34, 57, 156, 159, 167, 167, |
| 2405 | 167, 167, 167, 126, 132, 134, 136, 167, 167, 167, |
| 2406 | 167, 167, 37, 185, 156, 157, 24, 134, 21, 21, |
| 2407 | 128, 199, 4, 199, 200, 208, 126, 199, 126, 126, |
| 2408 | 126, 199, 199, 199, 128, 162, 24, 4, 158, 212, |
| 2409 | 126, 126, 126, 126, 167, 126, 126, 126, 36, 126, |
| 2410 | 57, 154, 126, 199, 199, 208, 209, 126, 155, 155, |
| 2411 | 126, 199, 126, 200, 200, 200, 209, 199, 129, 167, |
| 2412 | 167, 167, 167, 167, 167, 167, 162, 167, 4, 24, |
| 2413 | 126, 130, 129, 200, 132, 199, 129, 126, 129, 126, |
| 2414 | 126, 129, 129, 129, 129, 129, 21, 132, 149, 205, |
| 2415 | 36, 132, 167, 167, 167, 199, 197, 132, 149, 21, |
| 2416 | 129, 129, 129, 126, 197, 199, 21, 126, 76, 199, |
| 2417 | 21, 21, 199, 199 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2418 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2419 | |
| 2420 | #define yyerrok (yyerrstatus = 0) |
| 2421 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2422 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2423 | #define YYEOF 0 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2424 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2425 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2426 | #define YYABORT goto yyabortlab |
| 2427 | #define YYERROR goto yyerrorlab |
| 2428 | |
| 2429 | |
| 2430 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2431 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2432 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2433 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2434 | #define YYFAIL goto yyerrlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2435 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2436 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2437 | |
| 2438 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2439 | do \ |
| 2440 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2441 | { \ |
| 2442 | yychar = (Token); \ |
| 2443 | yylval = (Value); \ |
| 2444 | yytoken = YYTRANSLATE (yychar); \ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2445 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2446 | goto yybackup; \ |
| 2447 | } \ |
| 2448 | else \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2449 | { \ |
| 2450 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2451 | YYERROR; \ |
| 2452 | } \ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2453 | while (0) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2454 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2455 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2456 | #define YYTERROR 1 |
| 2457 | #define YYERRCODE 256 |
| 2458 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2459 | |
| 2460 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2461 | If N is 0, then set CURRENT to the empty location which ends |
| 2462 | the previous symbol: RHS[0] (always defined). */ |
| 2463 | |
| 2464 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2465 | #ifndef YYLLOC_DEFAULT |
| 2466 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2467 | do \ |
| 2468 | if (N) \ |
| 2469 | { \ |
| 2470 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2471 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2472 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2473 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2474 | } \ |
| 2475 | else \ |
| 2476 | { \ |
| 2477 | (Current).first_line = (Current).last_line = \ |
| 2478 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2479 | (Current).first_column = (Current).last_column = \ |
| 2480 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2481 | } \ |
| 2482 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2483 | #endif |
| 2484 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2485 | |
| 2486 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2487 | This macro was not mandated originally: define only if we know |
| 2488 | we won't break user code: when these are the locations we know. */ |
| 2489 | |
| 2490 | #ifndef YY_LOCATION_PRINT |
| 2491 | # if YYLTYPE_IS_TRIVIAL |
| 2492 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2493 | fprintf (File, "%d.%d-%d.%d", \ |
| 2494 | (Loc).first_line, (Loc).first_column, \ |
| 2495 | (Loc).last_line, (Loc).last_column) |
| 2496 | # else |
| 2497 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2498 | # endif |
| 2499 | #endif |
| 2500 | |
| 2501 | |
| 2502 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2503 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2504 | #ifdef YYLEX_PARAM |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2505 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2506 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2507 | # define YYLEX yylex () |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2508 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2509 | |
| 2510 | /* Enable debugging if requested. */ |
| 2511 | #if YYDEBUG |
| 2512 | |
| 2513 | # ifndef YYFPRINTF |
| 2514 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2515 | # define YYFPRINTF fprintf |
| 2516 | # endif |
| 2517 | |
| 2518 | # define YYDPRINTF(Args) \ |
| 2519 | do { \ |
| 2520 | if (yydebug) \ |
| 2521 | YYFPRINTF Args; \ |
| 2522 | } while (0) |
| 2523 | |
| 2524 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2525 | do { \ |
| 2526 | if (yydebug) \ |
| 2527 | { \ |
| 2528 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2529 | yysymprint (stderr, \ |
| 2530 | Type, Value); \ |
| 2531 | YYFPRINTF (stderr, "\n"); \ |
| 2532 | } \ |
| 2533 | } while (0) |
| 2534 | |
| 2535 | /*------------------------------------------------------------------. |
| 2536 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2537 | | TOP (included). | |
| 2538 | `------------------------------------------------------------------*/ |
| 2539 | |
| 2540 | #if defined (__STDC__) || defined (__cplusplus) |
| 2541 | static void |
| 2542 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2543 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2544 | static void |
| 2545 | yy_stack_print (bottom, top) |
| 2546 | short int *bottom; |
| 2547 | short int *top; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2548 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2549 | { |
| 2550 | YYFPRINTF (stderr, "Stack now"); |
| 2551 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2552 | YYFPRINTF (stderr, " %d", *bottom); |
| 2553 | YYFPRINTF (stderr, "\n"); |
| 2554 | } |
| 2555 | |
| 2556 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2557 | do { \ |
| 2558 | if (yydebug) \ |
| 2559 | yy_stack_print ((Bottom), (Top)); \ |
| 2560 | } while (0) |
| 2561 | |
| 2562 | |
| 2563 | /*------------------------------------------------. |
| 2564 | | Report that the YYRULE is going to be reduced. | |
| 2565 | `------------------------------------------------*/ |
| 2566 | |
| 2567 | #if defined (__STDC__) || defined (__cplusplus) |
| 2568 | static void |
| 2569 | yy_reduce_print (int yyrule) |
| 2570 | #else |
| 2571 | static void |
| 2572 | yy_reduce_print (yyrule) |
| 2573 | int yyrule; |
Chris Lattner | 1ae022f | 2006-10-22 06:08:13 +0000 | [diff] [blame] | 2574 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2575 | { |
| 2576 | int yyi; |
| 2577 | unsigned long int yylno = yyrline[yyrule]; |
| 2578 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2579 | yyrule - 1, yylno); |
| 2580 | /* Print the symbols being reduced, and their result. */ |
| 2581 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2582 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2583 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2584 | } |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2585 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2586 | # define YY_REDUCE_PRINT(Rule) \ |
| 2587 | do { \ |
| 2588 | if (yydebug) \ |
| 2589 | yy_reduce_print (Rule); \ |
| 2590 | } while (0) |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2591 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2592 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2593 | multiple parsers can coexist. */ |
| 2594 | int yydebug; |
| 2595 | #else /* !YYDEBUG */ |
| 2596 | # define YYDPRINTF(Args) |
| 2597 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2598 | # define YY_STACK_PRINT(Bottom, Top) |
| 2599 | # define YY_REDUCE_PRINT(Rule) |
| 2600 | #endif /* !YYDEBUG */ |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2601 | |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2602 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2603 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2604 | #ifndef YYINITDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2605 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2606 | #endif |
| 2607 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2608 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2609 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2610 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2611 | Do not make this value too large; the results are undefined if |
| 2612 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2613 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2614 | |
| 2615 | #ifndef YYMAXDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2616 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2617 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2618 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2619 | |
| 2620 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2621 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2622 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2623 | # ifndef yystrlen |
| 2624 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2625 | # define yystrlen strlen |
| 2626 | # else |
| 2627 | /* Return the length of YYSTR. */ |
| 2628 | static YYSIZE_T |
| 2629 | # if defined (__STDC__) || defined (__cplusplus) |
| 2630 | yystrlen (const char *yystr) |
| 2631 | # else |
| 2632 | yystrlen (yystr) |
| 2633 | const char *yystr; |
| 2634 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2635 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2636 | const char *yys = yystr; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2637 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2638 | while (*yys++ != '\0') |
| 2639 | continue; |
| 2640 | |
| 2641 | return yys - yystr - 1; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2642 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2643 | # endif |
| 2644 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2645 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2646 | # ifndef yystpcpy |
| 2647 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2648 | # define yystpcpy stpcpy |
| 2649 | # else |
| 2650 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2651 | YYDEST. */ |
| 2652 | static char * |
| 2653 | # if defined (__STDC__) || defined (__cplusplus) |
| 2654 | yystpcpy (char *yydest, const char *yysrc) |
| 2655 | # else |
| 2656 | yystpcpy (yydest, yysrc) |
| 2657 | char *yydest; |
| 2658 | const char *yysrc; |
| 2659 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2660 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2661 | char *yyd = yydest; |
| 2662 | const char *yys = yysrc; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2663 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2664 | while ((*yyd++ = *yys++) != '\0') |
| 2665 | continue; |
| 2666 | |
| 2667 | return yyd - 1; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2668 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2669 | # endif |
| 2670 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2671 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2672 | # ifndef yytnamerr |
| 2673 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2674 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2675 | heuristic is that double-quoting is unnecessary unless the string |
| 2676 | contains an apostrophe, a comma, or backslash (other than |
| 2677 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2678 | null, do not copy; instead, return the length of what the result |
| 2679 | would have been. */ |
| 2680 | static YYSIZE_T |
| 2681 | yytnamerr (char *yyres, const char *yystr) |
| 2682 | { |
| 2683 | if (*yystr == '"') |
| 2684 | { |
| 2685 | size_t yyn = 0; |
| 2686 | char const *yyp = yystr; |
| 2687 | |
| 2688 | for (;;) |
| 2689 | switch (*++yyp) |
| 2690 | { |
| 2691 | case '\'': |
| 2692 | case ',': |
| 2693 | goto do_not_strip_quotes; |
| 2694 | |
| 2695 | case '\\': |
| 2696 | if (*++yyp != '\\') |
| 2697 | goto do_not_strip_quotes; |
| 2698 | /* Fall through. */ |
| 2699 | default: |
| 2700 | if (yyres) |
| 2701 | yyres[yyn] = *yyp; |
| 2702 | yyn++; |
| 2703 | break; |
| 2704 | |
| 2705 | case '"': |
| 2706 | if (yyres) |
| 2707 | yyres[yyn] = '\0'; |
| 2708 | return yyn; |
| 2709 | } |
| 2710 | do_not_strip_quotes: ; |
| 2711 | } |
| 2712 | |
| 2713 | if (! yyres) |
| 2714 | return yystrlen (yystr); |
| 2715 | |
| 2716 | return yystpcpy (yyres, yystr) - yyres; |
| 2717 | } |
| 2718 | # endif |
| 2719 | |
| 2720 | #endif /* YYERROR_VERBOSE */ |
| 2721 | |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2722 | |
| 2723 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2724 | #if YYDEBUG |
| 2725 | /*--------------------------------. |
| 2726 | | Print this symbol on YYOUTPUT. | |
| 2727 | `--------------------------------*/ |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2728 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2729 | #if defined (__STDC__) || defined (__cplusplus) |
| 2730 | static void |
| 2731 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2732 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2733 | static void |
| 2734 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2735 | FILE *yyoutput; |
| 2736 | int yytype; |
| 2737 | YYSTYPE *yyvaluep; |
| 2738 | #endif |
| 2739 | { |
| 2740 | /* Pacify ``unused variable'' warnings. */ |
| 2741 | (void) yyvaluep; |
| 2742 | |
| 2743 | if (yytype < YYNTOKENS) |
| 2744 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2745 | else |
| 2746 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2747 | |
| 2748 | |
| 2749 | # ifdef YYPRINT |
| 2750 | if (yytype < YYNTOKENS) |
| 2751 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2752 | # endif |
| 2753 | switch (yytype) |
| 2754 | { |
| 2755 | default: |
| 2756 | break; |
| 2757 | } |
| 2758 | YYFPRINTF (yyoutput, ")"); |
| 2759 | } |
| 2760 | |
| 2761 | #endif /* ! YYDEBUG */ |
| 2762 | /*-----------------------------------------------. |
| 2763 | | Release the memory associated to this symbol. | |
| 2764 | `-----------------------------------------------*/ |
| 2765 | |
| 2766 | #if defined (__STDC__) || defined (__cplusplus) |
| 2767 | static void |
| 2768 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2769 | #else |
| 2770 | static void |
| 2771 | yydestruct (yymsg, yytype, yyvaluep) |
| 2772 | const char *yymsg; |
| 2773 | int yytype; |
| 2774 | YYSTYPE *yyvaluep; |
| 2775 | #endif |
| 2776 | { |
| 2777 | /* Pacify ``unused variable'' warnings. */ |
| 2778 | (void) yyvaluep; |
| 2779 | |
| 2780 | if (!yymsg) |
| 2781 | yymsg = "Deleting"; |
| 2782 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2783 | |
| 2784 | switch (yytype) |
| 2785 | { |
| 2786 | |
| 2787 | default: |
| 2788 | break; |
| 2789 | } |
| 2790 | } |
| 2791 | |
| 2792 | |
| 2793 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2794 | |
| 2795 | #ifdef YYPARSE_PARAM |
| 2796 | # if defined (__STDC__) || defined (__cplusplus) |
| 2797 | int yyparse (void *YYPARSE_PARAM); |
| 2798 | # else |
| 2799 | int yyparse (); |
| 2800 | # endif |
| 2801 | #else /* ! YYPARSE_PARAM */ |
| 2802 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2803 | int yyparse (void); |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2804 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2805 | int yyparse (); |
| 2806 | #endif |
| 2807 | #endif /* ! YYPARSE_PARAM */ |
| 2808 | |
| 2809 | |
| 2810 | |
| 2811 | /* The look-ahead symbol. */ |
| 2812 | int yychar; |
| 2813 | |
| 2814 | /* The semantic value of the look-ahead symbol. */ |
| 2815 | YYSTYPE yylval; |
| 2816 | |
| 2817 | /* Number of syntax errors so far. */ |
| 2818 | int yynerrs; |
| 2819 | |
| 2820 | |
| 2821 | |
| 2822 | /*----------. |
| 2823 | | yyparse. | |
| 2824 | `----------*/ |
| 2825 | |
| 2826 | #ifdef YYPARSE_PARAM |
| 2827 | # if defined (__STDC__) || defined (__cplusplus) |
| 2828 | int yyparse (void *YYPARSE_PARAM) |
| 2829 | # else |
| 2830 | int yyparse (YYPARSE_PARAM) |
| 2831 | void *YYPARSE_PARAM; |
| 2832 | # endif |
| 2833 | #else /* ! YYPARSE_PARAM */ |
| 2834 | #if defined (__STDC__) || defined (__cplusplus) |
| 2835 | int |
| 2836 | yyparse (void) |
| 2837 | #else |
| 2838 | int |
| 2839 | yyparse () |
| 2840 | |
| 2841 | #endif |
| 2842 | #endif |
| 2843 | { |
| 2844 | |
| 2845 | int yystate; |
| 2846 | int yyn; |
| 2847 | int yyresult; |
| 2848 | /* Number of tokens to shift before error messages enabled. */ |
| 2849 | int yyerrstatus; |
| 2850 | /* Look-ahead token as an internal (translated) token number. */ |
| 2851 | int yytoken = 0; |
| 2852 | |
| 2853 | /* Three stacks and their tools: |
| 2854 | `yyss': related to states, |
| 2855 | `yyvs': related to semantic values, |
| 2856 | `yyls': related to locations. |
| 2857 | |
| 2858 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2859 | to reallocate them elsewhere. */ |
| 2860 | |
| 2861 | /* The state stack. */ |
| 2862 | short int yyssa[YYINITDEPTH]; |
| 2863 | short int *yyss = yyssa; |
| 2864 | short int *yyssp; |
| 2865 | |
| 2866 | /* The semantic value stack. */ |
| 2867 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2868 | YYSTYPE *yyvs = yyvsa; |
| 2869 | YYSTYPE *yyvsp; |
| 2870 | |
| 2871 | |
| 2872 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2873 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2874 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2875 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2876 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2877 | /* The variables used to return semantic value and location from the |
| 2878 | action routines. */ |
| 2879 | YYSTYPE yyval; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2880 | |
| 2881 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2882 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2883 | rule. */ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2884 | int yylen; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2885 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2886 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2887 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2888 | yystate = 0; |
| 2889 | yyerrstatus = 0; |
| 2890 | yynerrs = 0; |
| 2891 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2892 | |
| 2893 | /* Initialize stack pointers. |
| 2894 | Waste one element of value and location stack |
| 2895 | so that they stay on the same level as the state stack. |
| 2896 | The wasted elements are never initialized. */ |
| 2897 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2898 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2899 | yyvsp = yyvs; |
| 2900 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2901 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2902 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2903 | /*------------------------------------------------------------. |
| 2904 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2905 | `------------------------------------------------------------*/ |
| 2906 | yynewstate: |
| 2907 | /* In all cases, when you get here, the value and location stacks |
| 2908 | have just been pushed. so pushing a state here evens the stacks. |
| 2909 | */ |
| 2910 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2911 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2912 | yysetstate: |
| 2913 | *yyssp = yystate; |
| 2914 | |
| 2915 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2916 | { |
| 2917 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2918 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2919 | |
| 2920 | #ifdef yyoverflow |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2921 | { |
| 2922 | /* Give user a chance to reallocate the stack. Use copies of |
| 2923 | these so that the &'s don't force the real ones into |
| 2924 | memory. */ |
| 2925 | YYSTYPE *yyvs1 = yyvs; |
| 2926 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2927 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2928 | |
| 2929 | /* Each stack pointer address is followed by the size of the |
| 2930 | data in use in that stack, in bytes. This used to be a |
| 2931 | conditional around just the two extra args, but that might |
| 2932 | be undefined if yyoverflow is a macro. */ |
| 2933 | yyoverflow (YY_("memory exhausted"), |
| 2934 | &yyss1, yysize * sizeof (*yyssp), |
| 2935 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2936 | |
| 2937 | &yystacksize); |
| 2938 | |
| 2939 | yyss = yyss1; |
| 2940 | yyvs = yyvs1; |
| 2941 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2942 | #else /* no yyoverflow */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2943 | # ifndef YYSTACK_RELOCATE |
| 2944 | goto yyexhaustedlab; |
| 2945 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2946 | /* Extend the stack our own way. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2947 | if (YYMAXDEPTH <= yystacksize) |
| 2948 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2949 | yystacksize *= 2; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2950 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2951 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2952 | |
| 2953 | { |
| 2954 | short int *yyss1 = yyss; |
| 2955 | union yyalloc *yyptr = |
| 2956 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2957 | if (! yyptr) |
| 2958 | goto yyexhaustedlab; |
| 2959 | YYSTACK_RELOCATE (yyss); |
| 2960 | YYSTACK_RELOCATE (yyvs); |
| 2961 | |
| 2962 | # undef YYSTACK_RELOCATE |
| 2963 | if (yyss1 != yyssa) |
| 2964 | YYSTACK_FREE (yyss1); |
| 2965 | } |
| 2966 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2967 | #endif /* no yyoverflow */ |
| 2968 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2969 | yyssp = yyss + yysize - 1; |
| 2970 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2971 | |
| 2972 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2973 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2974 | (unsigned long int) yystacksize)); |
| 2975 | |
| 2976 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2977 | YYABORT; |
| 2978 | } |
| 2979 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2980 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2981 | |
| 2982 | goto yybackup; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2983 | |
| 2984 | /*-----------. |
| 2985 | | yybackup. | |
| 2986 | `-----------*/ |
| 2987 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2988 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2989 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2990 | /* Read a look-ahead token if we need one and don't already have one. */ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2991 | /* yyresume: */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2992 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2993 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2994 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2995 | yyn = yypact[yystate]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2996 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2997 | goto yydefault; |
| 2998 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2999 | /* 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] | 3000 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3001 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3002 | if (yychar == YYEMPTY) |
| 3003 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3004 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3005 | yychar = YYLEX; |
| 3006 | } |
| 3007 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3008 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3009 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3010 | yychar = yytoken = YYEOF; |
| 3011 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3012 | } |
| 3013 | else |
| 3014 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3015 | yytoken = YYTRANSLATE (yychar); |
| 3016 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3017 | } |
| 3018 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3019 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3020 | detect an error, take that action. */ |
| 3021 | yyn += yytoken; |
| 3022 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3023 | goto yydefault; |
| 3024 | yyn = yytable[yyn]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3025 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3026 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3027 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3028 | goto yyerrlab; |
| 3029 | yyn = -yyn; |
| 3030 | goto yyreduce; |
| 3031 | } |
| 3032 | |
| 3033 | if (yyn == YYFINAL) |
| 3034 | YYACCEPT; |
| 3035 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3036 | /* Shift the look-ahead token. */ |
| 3037 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3038 | |
| 3039 | /* Discard the token being shifted unless it is eof. */ |
| 3040 | if (yychar != YYEOF) |
| 3041 | yychar = YYEMPTY; |
| 3042 | |
| 3043 | *++yyvsp = yylval; |
| 3044 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3045 | |
| 3046 | /* Count tokens shifted since error; after three, turn off error |
| 3047 | status. */ |
| 3048 | if (yyerrstatus) |
| 3049 | yyerrstatus--; |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 3050 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3051 | yystate = yyn; |
| 3052 | goto yynewstate; |
| 3053 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 3054 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3055 | /*-----------------------------------------------------------. |
| 3056 | | yydefault -- do the default action for the current state. | |
| 3057 | `-----------------------------------------------------------*/ |
| 3058 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3059 | yyn = yydefact[yystate]; |
| 3060 | if (yyn == 0) |
| 3061 | goto yyerrlab; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3062 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3063 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3064 | |
| 3065 | /*-----------------------------. |
| 3066 | | yyreduce -- Do a reduction. | |
| 3067 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3068 | yyreduce: |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3069 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3070 | yylen = yyr2[yyn]; |
| 3071 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3072 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3073 | `$$ = $1'. |
| 3074 | |
| 3075 | Otherwise, the following line sets YYVAL to garbage. |
| 3076 | This behavior is undocumented and Bison |
| 3077 | users should not rely upon it. Assigning to YYVAL |
| 3078 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3079 | GCC warning that YYVAL may be used uninitialized. */ |
| 3080 | yyval = yyvsp[1-yylen]; |
| 3081 | |
| 3082 | |
| 3083 | YY_REDUCE_PRINT (yyn); |
| 3084 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3085 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3086 | case 3: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3087 | #line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3088 | { |
| 3089 | if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3090 | GEN_ERROR("Value too large for type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3091 | (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3092 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3093 | ;} |
| 3094 | break; |
| 3095 | |
| 3096 | case 5: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3097 | #line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3098 | { |
| 3099 | if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3100 | GEN_ERROR("Value too large for type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3101 | (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3102 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3103 | ;} |
| 3104 | break; |
| 3105 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3106 | case 51: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3107 | #line 1199 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3108 | { |
| 3109 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3110 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3111 | ;} |
| 3112 | break; |
| 3113 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3114 | case 52: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3115 | #line 1203 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3116 | { |
| 3117 | (yyval.StrVal) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3118 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3119 | ;} |
| 3120 | break; |
| 3121 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3122 | case 53: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3123 | #line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3124 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3125 | break; |
| 3126 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3127 | case 54: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3128 | #line 1209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3129 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3130 | break; |
| 3131 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3132 | case 55: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3133 | #line 1210 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3134 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3135 | break; |
| 3136 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3137 | case 56: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3138 | #line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3139 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3140 | break; |
| 3141 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3142 | case 57: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3143 | #line 1212 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3144 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3145 | break; |
| 3146 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3147 | case 58: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3148 | #line 1213 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3149 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3150 | break; |
| 3151 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3152 | case 59: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3153 | #line 1214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3154 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3155 | break; |
| 3156 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3157 | case 60: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3158 | #line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3159 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3160 | break; |
| 3161 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3162 | case 61: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3163 | #line 1217 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3164 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3165 | break; |
| 3166 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3167 | case 62: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3168 | #line 1218 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3169 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3170 | break; |
| 3171 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3172 | case 63: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3173 | #line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3174 | { (yyval.UIntVal) = CallingConv::CSRet; ;} |
| 3175 | break; |
| 3176 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3177 | case 64: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3178 | #line 1220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3179 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3180 | break; |
| 3181 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3182 | case 65: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3183 | #line 1221 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3184 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3185 | break; |
| 3186 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3187 | case 66: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3188 | #line 1222 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3189 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3190 | break; |
| 3191 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3192 | case 67: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3193 | #line 1223 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3194 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3195 | break; |
| 3196 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3197 | case 68: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3198 | #line 1224 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3199 | { |
| 3200 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3201 | GEN_ERROR("Calling conv too large!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3202 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3203 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3204 | ;} |
| 3205 | break; |
| 3206 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3207 | case 69: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3208 | #line 1233 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3209 | { (yyval.UIntVal) = 0; ;} |
| 3210 | break; |
| 3211 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3212 | case 70: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3213 | #line 1234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3214 | { |
| 3215 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3216 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3217 | GEN_ERROR("Alignment must be a power of two!"); |
| 3218 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3219 | ;} |
| 3220 | break; |
| 3221 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3222 | case 71: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3223 | #line 1240 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3224 | { (yyval.UIntVal) = 0; ;} |
| 3225 | break; |
| 3226 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3227 | case 72: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3228 | #line 1241 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3229 | { |
| 3230 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3231 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 3232 | GEN_ERROR("Alignment must be a power of two!"); |
| 3233 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3234 | ;} |
| 3235 | break; |
| 3236 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3237 | case 73: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3238 | #line 1249 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3239 | { |
| 3240 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3241 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3242 | GEN_ERROR("Invalid character in section name!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3243 | (yyval.StrVal) = (yyvsp[0].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3244 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3245 | ;} |
| 3246 | break; |
| 3247 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3248 | case 74: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3249 | #line 1257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3250 | { (yyval.StrVal) = 0; ;} |
| 3251 | break; |
| 3252 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3253 | case 75: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3254 | #line 1258 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3255 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3256 | break; |
| 3257 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3258 | case 76: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3259 | #line 1263 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3260 | {;} |
| 3261 | break; |
| 3262 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3263 | case 77: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3264 | #line 1264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3265 | {;} |
| 3266 | break; |
| 3267 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3268 | case 78: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3269 | #line 1265 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3270 | { |
| 3271 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3272 | free((yyvsp[0].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3273 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3274 | ;} |
| 3275 | break; |
| 3276 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3277 | case 79: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3278 | #line 1270 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3279 | { |
| 3280 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3281 | GEN_ERROR("Alignment must be a power of two!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3282 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3283 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3284 | ;} |
| 3285 | break; |
| 3286 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3287 | case 81: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3288 | #line 1284 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3289 | { |
| 3290 | (yyval.TypeVal).type = new PATypeHolder((yyvsp[0].TypeVal).type->get()); |
| 3291 | (yyval.TypeVal).signedness = (yyvsp[0].TypeVal).signedness; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3292 | ;} |
| 3293 | break; |
| 3294 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3295 | case 83: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3296 | #line 1288 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3297 | { |
| 3298 | (yyval.TypeVal).type = new PATypeHolder((yyvsp[0].TypeVal).type->get()); |
| 3299 | (yyval.TypeVal).signedness = (yyvsp[0].TypeVal).signedness; |
| 3300 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3301 | break; |
| 3302 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3303 | case 84: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3304 | #line 1293 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3305 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3306 | if (!UpRefs.empty()) |
| 3307 | GEN_ERROR("Invalid upreference in type: " + |
| 3308 | ((yyvsp[0].TypeVal).type->get())->getDescription()); |
| 3309 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3310 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3311 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3312 | break; |
| 3313 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3314 | case 98: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3315 | #line 1306 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3316 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3317 | (yyval.TypeVal).type = new PATypeHolder(OpaqueType::get()); |
| 3318 | (yyval.TypeVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3319 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3320 | ;} |
| 3321 | break; |
| 3322 | |
| 3323 | case 99: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3324 | #line 1311 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3325 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3326 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3327 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3328 | ;} |
| 3329 | break; |
| 3330 | |
| 3331 | case 100: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3332 | #line 1315 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3333 | { // Named types are also simple types... |
| 3334 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
| 3335 | CHECK_FOR_ERROR |
| 3336 | (yyval.TypeVal).type = new PATypeHolder(tmp); |
| 3337 | (yyval.TypeVal).signedness = isSignless; |
| 3338 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3339 | break; |
| 3340 | |
| 3341 | case 101: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3342 | #line 1324 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3343 | { // Type UpReference |
| 3344 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); |
| 3345 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
| 3346 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3347 | (yyval.TypeVal).type = new PATypeHolder(OT); |
| 3348 | (yyval.TypeVal).signedness = isSignless; |
| 3349 | UR_OUT("New Upreference!\n"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3350 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3351 | ;} |
| 3352 | break; |
| 3353 | |
| 3354 | case 102: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3355 | #line 1333 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3356 | { // Function derived type? |
| 3357 | std::vector<const Type*> Params; |
| 3358 | for (std::list<TypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3359 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
| 3360 | Params.push_back(I->type->get()); |
| 3361 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3362 | if (isVarArg) Params.pop_back(); |
| 3363 | |
| 3364 | (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs( |
| 3365 | FunctionType::get((yyvsp[-3].TypeVal).type->get(),Params,isVarArg))); |
| 3366 | (yyval.TypeVal).signedness = isSignless; |
| 3367 | delete (yyvsp[-1].TypeList); // Delete the argument list |
| 3368 | delete (yyvsp[-3].TypeVal).type; |
| 3369 | CHECK_FOR_ERROR |
| 3370 | ;} |
| 3371 | break; |
| 3372 | |
| 3373 | case 103: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3374 | #line 1348 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3375 | { // Sized array type? |
| 3376 | (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs( |
| 3377 | ArrayType::get((yyvsp[-1].TypeVal).type->get(), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3378 | (yyval.TypeVal).signedness = isSignless; |
| 3379 | delete (yyvsp[-1].TypeVal).type; |
| 3380 | CHECK_FOR_ERROR |
| 3381 | ;} |
| 3382 | break; |
| 3383 | |
| 3384 | case 104: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3385 | #line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3386 | { // Packed array type? |
| 3387 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal).type->get(); |
| 3388 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
| 3389 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3390 | if (!ElemTy->isPrimitiveType()) |
| 3391 | GEN_ERROR("Elemental type of a PackedType must be primitive"); |
| 3392 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
| 3393 | GEN_ERROR("Vector length should be a power of 2!"); |
| 3394 | (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs( |
| 3395 | PackedType::get((yyvsp[-1].TypeVal).type->get(), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3396 | (yyval.TypeVal).signedness = isSignless; |
| 3397 | delete (yyvsp[-1].TypeVal).type; |
| 3398 | CHECK_FOR_ERROR |
| 3399 | ;} |
| 3400 | break; |
| 3401 | |
| 3402 | case 105: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3403 | #line 1369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3404 | { // Structure type? |
| 3405 | std::vector<const Type*> Elements; |
| 3406 | for (std::list<TypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3407 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3408 | Elements.push_back((*I).type->get()); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3409 | |
| 3410 | (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3411 | (yyval.TypeVal).signedness = isSignless; |
| 3412 | delete (yyvsp[-1].TypeList); |
| 3413 | CHECK_FOR_ERROR |
| 3414 | ;} |
| 3415 | break; |
| 3416 | |
| 3417 | case 106: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3418 | #line 1380 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3419 | { // Empty structure type? |
| 3420 | (yyval.TypeVal).type = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
| 3421 | (yyval.TypeVal).signedness = isSignless; |
| 3422 | CHECK_FOR_ERROR |
| 3423 | ;} |
| 3424 | break; |
| 3425 | |
| 3426 | case 107: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3427 | #line 1385 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3428 | { // Pointer type? |
| 3429 | if ((yyvsp[-1].TypeVal).type->get() == Type::LabelTy) |
| 3430 | GEN_ERROR("Cannot form a pointer to a basic block"); |
| 3431 | (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs(PointerType::get((yyvsp[-1].TypeVal).type->get()))); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3432 | (yyval.TypeVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3433 | delete (yyvsp[-1].TypeVal).type; |
| 3434 | CHECK_FOR_ERROR |
| 3435 | ;} |
| 3436 | break; |
| 3437 | |
| 3438 | case 108: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3439 | #line 1397 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3440 | { |
| 3441 | (yyval.TypeList) = new std::list<TypeInfo>(); |
| 3442 | (yyval.TypeList)->push_back((yyvsp[0].TypeVal)); |
| 3443 | CHECK_FOR_ERROR |
| 3444 | ;} |
| 3445 | break; |
| 3446 | |
| 3447 | case 109: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3448 | #line 1402 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3449 | { |
| 3450 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back((yyvsp[0].TypeVal)); |
| 3451 | CHECK_FOR_ERROR |
| 3452 | ;} |
| 3453 | break; |
| 3454 | |
| 3455 | case 111: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3456 | #line 1409 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3457 | { |
| 3458 | TypeInfo TI; |
| 3459 | TI.type = new PATypeHolder(Type::VoidTy); TI.signedness = isSignless; |
| 3460 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(TI); |
| 3461 | CHECK_FOR_ERROR |
| 3462 | ;} |
| 3463 | break; |
| 3464 | |
| 3465 | case 112: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3466 | #line 1415 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3467 | { |
| 3468 | TypeInfo TI; |
| 3469 | TI.type = new PATypeHolder(Type::VoidTy); TI.signedness = isSignless; |
| 3470 | ((yyval.TypeList) = new std::list<TypeInfo>())->push_back(TI); |
| 3471 | CHECK_FOR_ERROR |
| 3472 | ;} |
| 3473 | break; |
| 3474 | |
| 3475 | case 113: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3476 | #line 1421 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3477 | { |
| 3478 | (yyval.TypeList) = new std::list<TypeInfo>(); |
| 3479 | CHECK_FOR_ERROR |
| 3480 | ;} |
| 3481 | break; |
| 3482 | |
| 3483 | case 114: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3484 | #line 1432 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3485 | { // Nonempty unsized arr |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3486 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3487 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3488 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3489 | ((yyvsp[-3].TypeVal).type->get())->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3490 | const Type *ETy = ATy->getElementType(); |
| 3491 | int NumElements = ATy->getNumElements(); |
| 3492 | |
| 3493 | // Verify that we have the correct size... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3494 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3495 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3496 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3497 | itostr(NumElements) + "!"); |
| 3498 | |
| 3499 | // Verify all elements are correct type! |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3500 | std::vector<Constant*> elems; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3501 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3502 | if (ETy != (*(yyvsp[-1].ConstVector))[i].cnst->getType()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3503 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3504 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3505 | (*(yyvsp[-1].ConstVector))[i].cnst->getType()->getDescription() + "'."); |
| 3506 | } else { |
| 3507 | elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst); |
| 3508 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3509 | } |
| 3510 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3511 | (yyval.ConstVal).cnst = ConstantArray::get(ATy, elems); |
| 3512 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3513 | delete (yyvsp[-3].TypeVal).type; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3514 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3515 | ;} |
| 3516 | break; |
| 3517 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3518 | case 115: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3519 | #line 1463 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3520 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3521 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3522 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3523 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3524 | ((yyvsp[-2].TypeVal).type->get())->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3525 | |
| 3526 | int NumElements = ATy->getNumElements(); |
| 3527 | if (NumElements != -1 && NumElements != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3528 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3529 | " arguments, but has size of " + itostr(NumElements) +"!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3530 | (yyval.ConstVal).cnst = ConstantArray::get(ATy, std::vector<llvm::Constant*>()); |
| 3531 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3532 | delete (yyvsp[-2].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3533 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3534 | ;} |
| 3535 | break; |
| 3536 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3537 | case 116: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3538 | #line 1478 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3539 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3540 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3541 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3542 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3543 | ((yyvsp[-2].TypeVal).type->get())->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3544 | |
| 3545 | int NumElements = ATy->getNumElements(); |
| 3546 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3547 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 3548 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3549 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3550 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3551 | " when array has size " + itostr(NumElements) + "!"); |
| 3552 | std::vector<Constant*> Vals; |
| 3553 | if (ETy == Type::SByteTy) { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3554 | for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 3555 | Vals.push_back(ConstantInt::get(ETy, *C)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3556 | } else if (ETy == Type::UByteTy) { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3557 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 3558 | C != (unsigned char*)EndStr; ++C) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 3559 | Vals.push_back(ConstantInt::get(ETy, *C)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3560 | } else { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3561 | free((yyvsp[0].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3562 | GEN_ERROR("Cannot build string arrays of non byte sized elements!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3563 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3564 | free((yyvsp[0].StrVal)); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3565 | (yyval.ConstVal).cnst = ConstantArray::get(ATy, Vals); |
| 3566 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3567 | delete (yyvsp[-2].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3568 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3569 | ;} |
| 3570 | break; |
| 3571 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3572 | case 117: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3573 | #line 1509 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3574 | { // Nonempty unsized arr |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3575 | const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3576 | if (PTy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3577 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3578 | (yyvsp[-3].TypeVal).type->get()->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3579 | const Type *ETy = PTy->getElementType(); |
| 3580 | int NumElements = PTy->getNumElements(); |
| 3581 | |
| 3582 | // Verify that we have the correct size... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3583 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3584 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3585 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3586 | itostr(NumElements) + "!"); |
| 3587 | |
| 3588 | // Verify all elements are correct type! |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3589 | std::vector<Constant*> elems; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3590 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3591 | if (ETy != (*(yyvsp[-1].ConstVector))[i].cnst->getType()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3592 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3593 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3594 | (*(yyvsp[-1].ConstVector))[i].cnst->getType()->getDescription() + "'."); |
| 3595 | } else |
| 3596 | elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3597 | } |
| 3598 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3599 | (yyval.ConstVal).cnst = ConstantPacked::get(PTy, elems); |
| 3600 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3601 | delete (yyvsp[-3].TypeVal).type; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3602 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3603 | ;} |
| 3604 | break; |
| 3605 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3606 | case 118: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3607 | #line 1539 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3608 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3609 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal).type->get()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3610 | if (STy == 0) |
| 3611 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3612 | (yyvsp[-3].TypeVal).type->get()->getDescription() + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3613 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3614 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3615 | GEN_ERROR("Illegal number of initializers for structure type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3616 | |
| 3617 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3618 | std::vector<Constant*> elems; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3619 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3620 | if ((*(yyvsp[-1].ConstVector))[i].cnst->getType() != STy->getElementType(i)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3621 | GEN_ERROR("Expected type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3622 | STy->getElementType(i)->getDescription() + |
| 3623 | "' for element #" + utostr(i) + |
| 3624 | " of structure initializer!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3625 | } else |
| 3626 | elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3627 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3628 | (yyval.ConstVal).cnst = ConstantStruct::get(STy, elems); |
| 3629 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3630 | delete (yyvsp[-3].TypeVal).type; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3631 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3632 | ;} |
| 3633 | break; |
| 3634 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3635 | case 119: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3636 | #line 1564 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3637 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3638 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3639 | if (STy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3640 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3641 | (yyvsp[-2].TypeVal).type->get()->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3642 | |
| 3643 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3644 | GEN_ERROR("Illegal number of initializers for structure type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3645 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3646 | (yyval.ConstVal).cnst = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3647 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3648 | delete (yyvsp[-2].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3649 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3650 | ;} |
| 3651 | break; |
| 3652 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3653 | case 120: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3654 | #line 1578 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3655 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3656 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3657 | if (PTy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3658 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3659 | (yyvsp[-1].TypeVal).type->get()->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3660 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3661 | (yyval.ConstVal).cnst = ConstantPointerNull::get(PTy); |
| 3662 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3663 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3664 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3665 | ;} |
| 3666 | break; |
| 3667 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3668 | case 121: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3669 | #line 1589 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3670 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3671 | (yyval.ConstVal).cnst = UndefValue::get((yyvsp[-1].TypeVal).type->get()); |
| 3672 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3673 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3674 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3675 | ;} |
| 3676 | break; |
| 3677 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3678 | case 122: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3679 | #line 1595 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3680 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3681 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3682 | if (Ty == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3683 | GEN_ERROR("Global const reference must be a pointer type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3684 | |
| 3685 | // ConstExprs can exist in the body of a function, thus creating |
| 3686 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3687 | // the context of a function, getValNonImprovising will search the functions |
| 3688 | // symbol table instead of the module symbol table for the global symbol, |
| 3689 | // which throws things all off. To get around this, we just tell |
| 3690 | // getValNonImprovising that we are at global scope here. |
| 3691 | // |
| 3692 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3693 | CurFun.CurrentFunction = 0; |
| 3694 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3695 | Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3696 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3697 | |
| 3698 | CurFun.CurrentFunction = SavedCurFn; |
| 3699 | |
| 3700 | // If this is an initializer for a constant pointer, which is referencing a |
| 3701 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3702 | // in the future with the right type of variable. |
| 3703 | // |
| 3704 | if (V == 0) { |
| 3705 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 3706 | const PointerType *PT = cast<PointerType>(Ty); |
| 3707 | |
| 3708 | // First check to see if the forward references value is already created! |
| 3709 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3710 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3711 | |
| 3712 | if (I != CurModule.GlobalRefs.end()) { |
| 3713 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3714 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3715 | } else { |
| 3716 | std::string Name; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3717 | if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3718 | |
| 3719 | // Create the forward referenced global. |
| 3720 | GlobalValue *GV; |
| 3721 | if (const FunctionType *FTy = |
| 3722 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3723 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3724 | CurModule.CurrentModule); |
| 3725 | } else { |
| 3726 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3727 | GlobalValue::ExternalLinkage, 0, |
| 3728 | Name, CurModule.CurrentModule); |
| 3729 | } |
| 3730 | |
| 3731 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3732 | 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] | 3733 | V = GV; |
| 3734 | } |
| 3735 | } |
| 3736 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3737 | (yyval.ConstVal).cnst = cast<GlobalValue>(V); |
| 3738 | (yyval.ConstVal).signedness = (yyvsp[-1].TypeVal).signedness; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3739 | delete (yyvsp[-1].TypeVal).type; // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3740 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3741 | ;} |
| 3742 | break; |
| 3743 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3744 | case 123: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3745 | #line 1657 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3746 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3747 | if ((yyvsp[-1].TypeVal).type->get() != (yyvsp[0].ConstVal).cnst->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3748 | GEN_ERROR("Mismatched types for constant expression!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3749 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3750 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3751 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3752 | ;} |
| 3753 | break; |
| 3754 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3755 | case 124: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3756 | #line 1664 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3757 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3758 | const Type *Ty = (yyvsp[-1].TypeVal).type->get(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3759 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3760 | GEN_ERROR("Cannot create a null initialized value of this type!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3761 | (yyval.ConstVal).cnst = Constant::getNullValue(Ty); |
| 3762 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3763 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3764 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3765 | ;} |
| 3766 | break; |
| 3767 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3768 | case 125: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3769 | #line 1674 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3770 | { // integral constants |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3771 | if (!ConstantInt::isValueValidForType((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].SInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3772 | GEN_ERROR("Constant value doesn't fit in type!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3773 | (yyval.ConstVal).cnst = ConstantInt::get((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].SInt64Val)); |
| 3774 | (yyval.ConstVal).signedness = (yyvsp[-1].TypeVal).signedness; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3775 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3776 | ;} |
| 3777 | break; |
| 3778 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3779 | case 126: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3780 | #line 1681 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3781 | { // integral constants |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3782 | if (!ConstantInt::isValueValidForType((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].UInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3783 | GEN_ERROR("Constant value doesn't fit in type!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3784 | (yyval.ConstVal).cnst = ConstantInt::get((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].UInt64Val)); |
| 3785 | (yyval.ConstVal).signedness = (yyvsp[-1].TypeVal).signedness; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3786 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3787 | ;} |
| 3788 | break; |
| 3789 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3790 | case 127: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3791 | #line 1688 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3792 | { // Boolean constants |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3793 | (yyval.ConstVal).cnst = ConstantBool::getTrue(); |
| 3794 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3795 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3796 | ;} |
| 3797 | break; |
| 3798 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3799 | case 128: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3800 | #line 1693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3801 | { // Boolean constants |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3802 | (yyval.ConstVal).cnst = ConstantBool::getFalse(); |
| 3803 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3804 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3805 | ;} |
| 3806 | break; |
| 3807 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3808 | case 129: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3809 | #line 1698 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3810 | { // Float & Double constants |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3811 | if (!ConstantFP::isValueValidForType((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].FPVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3812 | GEN_ERROR("Floating point constant invalid for type!!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3813 | (yyval.ConstVal).cnst = ConstantFP::get((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].FPVal)); |
| 3814 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3815 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3816 | ;} |
| 3817 | break; |
| 3818 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3819 | case 130: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3820 | #line 1707 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3821 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3822 | Constant *Val = (yyvsp[-3].ConstVal).cnst; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3823 | const Type *Ty = (yyvsp[-1].TypeVal).type->get(); |
| 3824 | if (!Val->getType()->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3825 | GEN_ERROR("cast constant expression from a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3826 | Val->getType()->getDescription() + "'!"); |
| 3827 | if (!Ty->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3828 | GEN_ERROR("cast constant expression to a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3829 | Ty->getDescription() + "'!"); |
| 3830 | if ((yyvsp[-5].CastOpVal).obsolete) { |
| 3831 | if (Ty == Type::BoolTy) { |
| 3832 | // The previous definition of cast to bool was a compare against zero. |
| 3833 | // We have to retain that semantic so we do it here. |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3834 | (yyval.ConstVal).cnst = ConstantExpr::get(Instruction::SetNE, Val, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3835 | Constant::getNullValue(Val->getType())); |
| 3836 | } else if (Val->getType()->isFloatingPoint() && isa<PointerType>(Ty)) { |
| 3837 | Constant *CE = ConstantExpr::getFPToUI(Val, Type::ULongTy); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3838 | (yyval.ConstVal).cnst = ConstantExpr::getIntToPtr(CE, Ty); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3839 | } else { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3840 | (yyval.ConstVal).cnst = ConstantExpr::getCast(Val, Ty); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3841 | } |
| 3842 | } else { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3843 | (yyval.ConstVal).cnst = ConstantExpr::getCast((yyvsp[-5].CastOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].TypeVal).type->get()); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3844 | } |
| 3845 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3846 | ;} |
| 3847 | break; |
| 3848 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3849 | case 131: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3850 | #line 1733 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3851 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3852 | if (!isa<PointerType>((yyvsp[-2].ConstVal).cnst->getType())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3853 | GEN_ERROR("GetElementPtr requires a pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3854 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3855 | std::vector<llvm::Value*> IdxVec; |
| 3856 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i < e; ++i) |
| 3857 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i].val)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3858 | IdxVec.push_back(C); |
| 3859 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3860 | GEN_ERROR("Indices to constant getelementptr must be constants!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3861 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3862 | const Type *IdxTy = |
| 3863 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal).cnst->getType(), IdxVec, true); |
| 3864 | if (!IdxTy) |
| 3865 | GEN_ERROR("Index list invalid for constant getelementptr!"); |
| 3866 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3867 | delete (yyvsp[-1].ValueList); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3868 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3869 | (yyval.ConstVal).cnst = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal).cnst, IdxVec); |
| 3870 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3871 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3872 | ;} |
| 3873 | break; |
| 3874 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3875 | case 132: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3876 | #line 1755 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3877 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3878 | if ((yyvsp[-5].ConstVal).cnst->getType() != Type::BoolTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3879 | GEN_ERROR("Select condition must be of boolean type!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3880 | if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3881 | GEN_ERROR("Select operand types must match!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3882 | (yyval.ConstVal).cnst = ConstantExpr::getSelect((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
| 3883 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3884 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3885 | ;} |
| 3886 | break; |
| 3887 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3888 | case 133: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3889 | #line 1764 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3890 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3891 | if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3892 | GEN_ERROR("Binary operator types must match!"); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3893 | // First, make sure we're dealing with the right opcode by upgrading from |
| 3894 | // obsolete versions. |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3895 | sanitizeOpcode((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal).cnst->getType()); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3896 | CHECK_FOR_ERROR; |
| 3897 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3898 | // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. |
| 3899 | // To retain backward compatibility with these early compilers, we emit a |
| 3900 | // cast to the appropriate integer type automatically if we are in the |
| 3901 | // broken case. See PR424 for more information. |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3902 | if (!isa<PointerType>((yyvsp[-3].ConstVal).cnst->getType())) { |
| 3903 | (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3904 | } else { |
| 3905 | const Type *IntPtrTy = 0; |
| 3906 | switch (CurModule.CurrentModule->getPointerSize()) { |
| 3907 | case Module::Pointer32: IntPtrTy = Type::IntTy; break; |
| 3908 | case Module::Pointer64: IntPtrTy = Type::LongTy; break; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3909 | default: GEN_ERROR("invalid pointer binary constant expr!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3910 | } |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3911 | (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, |
| 3912 | ConstantExpr::getCast((yyvsp[-3].ConstVal).cnst, IntPtrTy), |
| 3913 | ConstantExpr::getCast((yyvsp[-1].ConstVal).cnst, IntPtrTy)); |
| 3914 | (yyval.ConstVal).cnst = ConstantExpr::getCast((yyval.ConstVal).cnst, (yyvsp[-3].ConstVal).cnst->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3915 | } |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3916 | (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3917 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3918 | ;} |
| 3919 | break; |
| 3920 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3921 | case 134: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3922 | #line 1793 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3923 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3924 | if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3925 | GEN_ERROR("Logical operator types must match!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3926 | if (!(yyvsp[-3].ConstVal).cnst->getType()->isIntegral()) { |
| 3927 | if (!isa<PackedType>((yyvsp[-3].ConstVal).cnst->getType()) || |
| 3928 | !cast<PackedType>((yyvsp[-3].ConstVal).cnst->getType())->getElementType()->isIntegral()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3929 | GEN_ERROR("Logical operator requires integral operands!"); |
Chris Lattner | 524a131 | 2005-12-21 18:31:50 +0000 | [diff] [blame] | 3930 | } |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3931 | (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
| 3932 | (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3933 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3934 | ;} |
| 3935 | break; |
| 3936 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3937 | case 135: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3938 | #line 1805 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3939 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3940 | if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType()) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3941 | GEN_ERROR("setcc operand types must match!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3942 | (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
| 3943 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3944 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3945 | ;} |
| 3946 | break; |
| 3947 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3948 | case 136: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3949 | #line 1812 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3950 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3951 | if ((yyvsp[-1].ConstVal).cnst->getType() != Type::UByteTy) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3952 | GEN_ERROR("Shift count for shift constant must be unsigned byte!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3953 | if (!(yyvsp[-3].ConstVal).cnst->getType()->isInteger()) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3954 | GEN_ERROR("Shift constant expression requires integer operand!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3955 | // Handle opcode upgrade situations |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3956 | sanitizeOpcode((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal).cnst->getType()); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3957 | CHECK_FOR_ERROR; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3958 | (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].OtherOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
| 3959 | (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3960 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3961 | ;} |
| 3962 | break; |
| 3963 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3964 | case 137: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3965 | #line 1824 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3966 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3967 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3968 | GEN_ERROR("Invalid extractelement operands!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3969 | (yyval.ConstVal).cnst = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
| 3970 | (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3971 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3972 | ;} |
| 3973 | break; |
| 3974 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3975 | case 138: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3976 | #line 1831 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3977 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3978 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3979 | GEN_ERROR("Invalid insertelement operands!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3980 | (yyval.ConstVal).cnst = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
| 3981 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3982 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3983 | ;} |
| 3984 | break; |
| 3985 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3986 | case 139: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3987 | #line 1838 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3988 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3989 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3990 | GEN_ERROR("Invalid shufflevector operands!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3991 | (yyval.ConstVal).cnst = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst); |
| 3992 | (yyval.ConstVal).signedness = isSignless; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3993 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3994 | ;} |
| 3995 | break; |
| 3996 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3997 | case 140: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 3998 | #line 1848 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3999 | { |
| 4000 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4001 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4002 | ;} |
| 4003 | break; |
| 4004 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4005 | case 141: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4006 | #line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4007 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4008 | (yyval.ConstVector) = new std::vector<ConstInfo>(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4009 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4010 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4011 | ;} |
| 4012 | break; |
| 4013 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4014 | case 142: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4015 | #line 1860 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4016 | { (yyval.BoolVal) = false; ;} |
| 4017 | break; |
| 4018 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4019 | case 143: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4020 | #line 1860 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4021 | { (yyval.BoolVal) = true; ;} |
| 4022 | break; |
| 4023 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4024 | case 144: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4025 | #line 1870 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4026 | { |
| 4027 | (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4028 | CurModule.ModuleDone(); |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 4029 | CHECK_FOR_ERROR; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4030 | ;} |
| 4031 | break; |
| 4032 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4033 | case 145: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4034 | #line 1878 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4035 | { |
| 4036 | (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4037 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4038 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4039 | ;} |
| 4040 | break; |
| 4041 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4042 | case 146: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4043 | #line 1883 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4044 | { |
| 4045 | (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4046 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4047 | ;} |
| 4048 | break; |
| 4049 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4050 | case 147: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4051 | #line 1887 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4052 | { |
| 4053 | (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4054 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4055 | ;} |
| 4056 | break; |
| 4057 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4058 | case 148: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4059 | #line 1891 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4060 | { |
| 4061 | (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4062 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4063 | ;} |
| 4064 | break; |
| 4065 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4066 | case 149: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4067 | #line 1895 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4068 | { |
| 4069 | (yyval.ModuleVal) = CurModule.CurrentModule; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4070 | // Emit an error if there are any unresolved types left. |
| 4071 | if (!CurModule.LateResolveTypes.empty()) { |
| 4072 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4073 | if (DID.Type == ValID::NameVal) { |
| 4074 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4075 | } else { |
| 4076 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4077 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4078 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4079 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4080 | ;} |
| 4081 | break; |
| 4082 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4083 | case 150: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4084 | #line 1910 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4085 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4086 | // Eagerly resolve types. This is not an optimization, this is a |
| 4087 | // requirement that is due to the fact that we could have this: |
| 4088 | // |
| 4089 | // %list = type { %list * } |
| 4090 | // %list = type { %list * } ; repeated type decl |
| 4091 | // |
| 4092 | // If types are not resolved eagerly, then the two types will not be |
| 4093 | // determined to be the same type! |
| 4094 | // |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4095 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4096 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4097 | if (!setTypeName((yyvsp[0].TypeVal).type->get(), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4098 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4099 | // If this is a named type that is not a redefinition, add it to the slot |
| 4100 | // table. |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4101 | CurModule.Types.push_back(*((yyvsp[0].TypeVal).type)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4102 | } else { |
| 4103 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4104 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4105 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4106 | ;} |
| 4107 | break; |
| 4108 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4109 | case 151: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4110 | #line 1932 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4111 | { // Function prototypes can be in const pool |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4112 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4113 | ;} |
| 4114 | break; |
| 4115 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4116 | case 152: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4117 | #line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4118 | { // Asm blocks can be in the const pool |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4119 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4120 | ;} |
| 4121 | break; |
| 4122 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4123 | case 153: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4124 | #line 1938 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4125 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4126 | if ((yyvsp[0].ConstVal).cnst == 0) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4127 | GEN_ERROR("Global value initializer is not a constant!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4128 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal).cnst->getType(), (yyvsp[0].ConstVal).cnst); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4129 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4130 | ;} |
| 4131 | break; |
| 4132 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4133 | case 154: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4134 | #line 1943 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4135 | { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4136 | CurGV = 0; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4137 | ;} |
| 4138 | break; |
| 4139 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4140 | case 155: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4141 | #line 1946 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4142 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4143 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), |
| 4144 | (yyvsp[0].TypeVal).type->get(), 0); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4145 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4146 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4147 | ;} |
| 4148 | break; |
| 4149 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4150 | case 156: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4151 | #line 1951 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4152 | { |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4153 | CurGV = 0; |
| 4154 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4155 | ;} |
| 4156 | break; |
| 4157 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4158 | case 157: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4159 | #line 1955 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4160 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4161 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), |
| 4162 | (yyvsp[0].TypeVal).type->get(), 0); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4163 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4164 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4165 | ;} |
| 4166 | break; |
| 4167 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4168 | case 158: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4169 | #line 1960 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4170 | { |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4171 | CurGV = 0; |
| 4172 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4173 | ;} |
| 4174 | break; |
| 4175 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4176 | case 159: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4177 | #line 1964 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4178 | { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4179 | CurGV = |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4180 | ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), |
| 4181 | (yyvsp[0].TypeVal).type->get(), 0); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4182 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4183 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4184 | ;} |
| 4185 | break; |
| 4186 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4187 | case 160: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4188 | #line 1970 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4189 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4190 | CurGV = 0; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4191 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4192 | ;} |
| 4193 | break; |
| 4194 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4195 | case 161: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4196 | #line 1974 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4197 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4198 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4199 | ;} |
| 4200 | break; |
| 4201 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4202 | case 162: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4203 | #line 1977 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4204 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4205 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4206 | ;} |
| 4207 | break; |
| 4208 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4209 | case 163: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4210 | #line 1980 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4211 | { |
| 4212 | ;} |
| 4213 | break; |
| 4214 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4215 | case 164: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4216 | #line 1984 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4217 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4218 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4219 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4220 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4221 | free((yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4222 | |
| 4223 | if (AsmSoFar.empty()) |
| 4224 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4225 | else |
| 4226 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4227 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4228 | ;} |
| 4229 | break; |
| 4230 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4231 | case 165: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4232 | #line 1997 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4233 | { (yyval.Endianness) = Module::BigEndian; ;} |
| 4234 | break; |
| 4235 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4236 | case 166: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4237 | #line 1998 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4238 | { (yyval.Endianness) = Module::LittleEndian; ;} |
| 4239 | break; |
| 4240 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4241 | case 167: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4242 | #line 2000 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4243 | { |
| 4244 | CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4245 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4246 | ;} |
| 4247 | break; |
| 4248 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4249 | case 168: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4250 | #line 2004 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4251 | { |
| 4252 | if ((yyvsp[0].UInt64Val) == 32) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4253 | CurModule.CurrentModule->setPointerSize(Module::Pointer32); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4254 | else if ((yyvsp[0].UInt64Val) == 64) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4255 | CurModule.CurrentModule->setPointerSize(Module::Pointer64); |
| 4256 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4257 | GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4258 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4259 | ;} |
| 4260 | break; |
| 4261 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4262 | case 169: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4263 | #line 2013 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4264 | { |
| 4265 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4266 | free((yyvsp[0].StrVal)); |
| 4267 | ;} |
| 4268 | break; |
| 4269 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4270 | case 170: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4271 | #line 2017 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4272 | { |
| 4273 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4274 | free((yyvsp[0].StrVal)); |
| 4275 | ;} |
| 4276 | break; |
| 4277 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4278 | case 172: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4279 | #line 2024 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4280 | { |
| 4281 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4282 | free((yyvsp[0].StrVal)); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4283 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4284 | ;} |
| 4285 | break; |
| 4286 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4287 | case 173: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4288 | #line 2029 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4289 | { |
| 4290 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4291 | free((yyvsp[0].StrVal)); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4292 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4293 | ;} |
| 4294 | break; |
| 4295 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4296 | case 174: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4297 | #line 2034 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4298 | { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4299 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4300 | ;} |
| 4301 | break; |
| 4302 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4303 | case 178: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4304 | #line 2044 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4305 | { (yyval.StrVal) = 0; ;} |
| 4306 | break; |
| 4307 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4308 | case 179: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4309 | #line 2046 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4310 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4311 | if ((yyvsp[-1].TypeVal).type->get() == Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4312 | GEN_ERROR("void typed arguments are invalid!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4313 | (yyval.ArgVal) = new std::pair<TypeInfo, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4314 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4315 | ;} |
| 4316 | break; |
| 4317 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4318 | case 180: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4319 | #line 2053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4320 | { |
| 4321 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
| 4322 | (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); |
| 4323 | delete (yyvsp[0].ArgVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4324 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4325 | ;} |
| 4326 | break; |
| 4327 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4328 | case 181: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4329 | #line 2059 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4330 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4331 | (yyval.ArgList) = new std::vector<std::pair<TypeInfo,char*> >(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4332 | (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); |
| 4333 | delete (yyvsp[0].ArgVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4334 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4335 | ;} |
| 4336 | break; |
| 4337 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4338 | case 182: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4339 | #line 2066 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4340 | { |
| 4341 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4342 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4343 | ;} |
| 4344 | break; |
| 4345 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4346 | case 183: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4347 | #line 2070 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4348 | { |
| 4349 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4350 | TypeInfo TI; |
| 4351 | TI.type = new PATypeHolder(Type::VoidTy); |
| 4352 | TI.signedness = isSignless; |
| 4353 | (yyval.ArgList)->push_back(std::pair<TypeInfo,char*>(TI,(char*)0)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4354 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4355 | ;} |
| 4356 | break; |
| 4357 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4358 | case 184: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4359 | #line 2078 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4360 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4361 | (yyval.ArgList) = new std::vector<std::pair<TypeInfo,char*> >(); |
| 4362 | TypeInfo TI; |
| 4363 | TI.type = new PATypeHolder(Type::VoidTy); |
| 4364 | TI.signedness = isSignless; |
| 4365 | (yyval.ArgList)->push_back(std::make_pair(TI, (char*)0)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4366 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4367 | ;} |
| 4368 | break; |
| 4369 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4370 | case 185: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4371 | #line 2086 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4372 | { |
| 4373 | (yyval.ArgList) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4374 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4375 | ;} |
| 4376 | break; |
| 4377 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4378 | case 186: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4379 | #line 2092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4380 | { |
| 4381 | UnEscapeLexed((yyvsp[-5].StrVal)); |
| 4382 | std::string FunctionName((yyvsp[-5].StrVal)); |
| 4383 | free((yyvsp[-5].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4384 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4385 | if (!((yyvsp[-6].TypeVal).type->get())->isFirstClassType() && (yyvsp[-6].TypeVal).type->get() != Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4386 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4387 | |
| 4388 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4389 | if ((yyvsp[-3].ArgList)) { // If there are arguments... |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4390 | for (std::vector<std::pair<TypeInfo,char*> >::iterator I = (yyvsp[-3].ArgList)->begin(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4391 | I != (yyvsp[-3].ArgList)->end(); ++I) |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4392 | ParamTypeList.push_back(I->first.type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4393 | } |
| 4394 | |
| 4395 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4396 | if (isVarArg) ParamTypeList.pop_back(); |
| 4397 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4398 | const FunctionType *FT = FunctionType::get((yyvsp[-6].TypeVal).type->get(), ParamTypeList, |
| 4399 | isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4400 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4401 | delete (yyvsp[-6].TypeVal).type; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4402 | |
| 4403 | ValID ID; |
| 4404 | if (!FunctionName.empty()) { |
| 4405 | ID = ValID::create((char*)FunctionName.c_str()); |
| 4406 | } else { |
| 4407 | ID = ValID::create((int)CurModule.Values[PFT].size()); |
| 4408 | } |
| 4409 | |
| 4410 | Function *Fn = 0; |
| 4411 | // See if this function was forward referenced. If so, recycle the object. |
| 4412 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4413 | // Move the function to the end of the list, from whereever it was |
| 4414 | // previously inserted. |
| 4415 | Fn = cast<Function>(FWRef); |
| 4416 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4417 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4418 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4419 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4420 | // If this is the case, either we need to be a forward decl, or it needs |
| 4421 | // to be. |
| 4422 | if (!CurFun.isDeclare && !Fn->isExternal()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4423 | GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4424 | |
| 4425 | // Make sure to strip off any argument names so we can't get conflicts. |
| 4426 | if (Fn->isExternal()) |
| 4427 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4428 | AI != AE; ++AI) |
| 4429 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4430 | } else { // Not already defined? |
| 4431 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4432 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4433 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4434 | InsertValue(Fn, CurModule.Values); |
| 4435 | } |
| 4436 | |
| 4437 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4438 | |
| 4439 | if (CurFun.isDeclare) { |
| 4440 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4441 | // correctly handle cases, when pointer to function is passed as argument to |
| 4442 | // another function. |
| 4443 | Fn->setLinkage(CurFun.Linkage); |
| 4444 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4445 | Fn->setCallingConv((yyvsp[-7].UIntVal)); |
| 4446 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4447 | if ((yyvsp[-1].StrVal)) { |
| 4448 | Fn->setSection((yyvsp[-1].StrVal)); |
| 4449 | free((yyvsp[-1].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4450 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4451 | |
| 4452 | // Add all of the arguments we parsed to the function... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4453 | if ((yyvsp[-3].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4454 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4455 | assert((yyvsp[-3].ArgList)->back().first.type->get() == Type::VoidTy && |
| 4456 | (yyvsp[-3].ArgList)->back().second == 0 && "Not a varargs marker!"); |
| 4457 | delete (yyvsp[-3].ArgList)->back().first.type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4458 | (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4459 | } |
| 4460 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4461 | for (std::vector<std::pair<TypeInfo,char*> >::iterator I = (yyvsp[-3].ArgList)->begin(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4462 | I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4463 | delete I->first.type; // Delete the typeholder... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4464 | setValueName(ArgIt, I->second); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4465 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4466 | InsertValue(ArgIt); |
| 4467 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4468 | delete (yyvsp[-3].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4469 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4470 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4471 | ;} |
| 4472 | break; |
| 4473 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4474 | case 189: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4475 | #line 2187 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4476 | { |
| 4477 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4478 | |
| 4479 | // Make sure that we keep track of the linkage type even if there was a |
| 4480 | // previous "declare". |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4481 | (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); |
| 4482 | ;} |
| 4483 | break; |
| 4484 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4485 | case 192: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4486 | #line 2197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4487 | { |
| 4488 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4489 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4490 | ;} |
| 4491 | break; |
| 4492 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4493 | case 194: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4494 | #line 2203 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4495 | { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} |
| 4496 | break; |
| 4497 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4498 | case 195: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4499 | #line 2204 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4500 | { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} |
| 4501 | break; |
| 4502 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4503 | case 196: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4504 | #line 2206 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4505 | { CurFun.isDeclare = true; ;} |
| 4506 | break; |
| 4507 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4508 | case 197: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4509 | #line 2206 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4510 | { |
| 4511 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4512 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4513 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4514 | ;} |
| 4515 | break; |
| 4516 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4517 | case 198: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4518 | #line 2216 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4519 | { |
| 4520 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4521 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4522 | ;} |
| 4523 | break; |
| 4524 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4525 | case 199: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4526 | #line 2220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4527 | { |
| 4528 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4529 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4530 | ;} |
| 4531 | break; |
| 4532 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4533 | case 200: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4534 | #line 2225 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4535 | { // A reference to a direct constant |
| 4536 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4537 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4538 | ;} |
| 4539 | break; |
| 4540 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4541 | case 201: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4542 | #line 2229 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4543 | { |
| 4544 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4545 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4546 | ;} |
| 4547 | break; |
| 4548 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4549 | case 202: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4550 | #line 2233 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4551 | { // Perhaps it's an FP constant? |
| 4552 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4553 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4554 | ;} |
| 4555 | break; |
| 4556 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4557 | case 203: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4558 | #line 2237 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4559 | { |
| 4560 | (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4561 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4562 | ;} |
| 4563 | break; |
| 4564 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4565 | case 204: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4566 | #line 2241 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4567 | { |
| 4568 | (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4569 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4570 | ;} |
| 4571 | break; |
| 4572 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4573 | case 205: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4574 | #line 2245 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4575 | { |
| 4576 | (yyval.ValIDVal) = ValID::createNull(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4577 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4578 | ;} |
| 4579 | break; |
| 4580 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4581 | case 206: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4582 | #line 2249 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4583 | { |
| 4584 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4585 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4586 | ;} |
| 4587 | break; |
| 4588 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4589 | case 207: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4590 | #line 2253 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4591 | { // A vector zero constant. |
| 4592 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4593 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4594 | ;} |
| 4595 | break; |
| 4596 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4597 | case 208: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4598 | #line 2257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4599 | { // Nonempty unsized packed vector |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4600 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0].cnst->getType(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4601 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4602 | |
| 4603 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 4604 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4605 | HandleUpRefs(PackedType::get( ETy, NumElements))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4606 | |
| 4607 | // Verify all elements are correct type! |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4608 | std::vector<Constant*> elems; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4609 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4610 | if (ETy != (*(yyvsp[-1].ConstVector))[i].cnst->getType()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4611 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4612 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4613 | (*(yyvsp[-1].ConstVector))[i].cnst->getType()->getDescription() + "'."); |
| 4614 | } else |
| 4615 | elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4616 | } |
| 4617 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4618 | (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, elems)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4619 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4620 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4621 | ;} |
| 4622 | break; |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4623 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4624 | case 209: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4625 | #line 2280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4626 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4627 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal).cnst); |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4628 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4629 | ;} |
| 4630 | break; |
| 4631 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4632 | case 210: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4633 | #line 2284 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4634 | { |
| 4635 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 4636 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 4637 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4638 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 4639 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 4640 | free((yyvsp[-2].StrVal)); |
| 4641 | free((yyvsp[0].StrVal)); |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4642 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4643 | ;} |
| 4644 | break; |
| 4645 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4646 | case 211: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4647 | #line 2298 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4648 | { // Is it an integer reference...? |
| 4649 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); |
| 4650 | CHECK_FOR_ERROR |
| 4651 | ;} |
| 4652 | break; |
| 4653 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4654 | case 212: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4655 | #line 2302 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4656 | { // Is it a named reference...? |
| 4657 | (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); |
| 4658 | CHECK_FOR_ERROR |
| 4659 | ;} |
| 4660 | break; |
| 4661 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4662 | case 215: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4663 | #line 2314 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4664 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4665 | (yyval.ValueVal).val = getVal((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].ValIDVal)); |
| 4666 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4667 | CHECK_FOR_ERROR |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4668 | (yyval.ValueVal).signedness = (yyvsp[-1].TypeVal).signedness; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4669 | ;} |
| 4670 | break; |
| 4671 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4672 | case 216: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4673 | #line 2321 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4674 | { |
| 4675 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 4676 | CHECK_FOR_ERROR |
| 4677 | ;} |
| 4678 | break; |
| 4679 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4680 | case 217: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4681 | #line 2325 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4682 | { // Do not allow functions with 0 basic blocks |
| 4683 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 4684 | CHECK_FOR_ERROR |
| 4685 | ;} |
| 4686 | break; |
| 4687 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4688 | case 218: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4689 | #line 2334 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4690 | { |
| 4691 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
| 4692 | CHECK_FOR_ERROR |
| 4693 | InsertValue((yyvsp[0].TermInstVal)); |
| 4694 | |
| 4695 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 4696 | InsertValue((yyvsp[-2].BasicBlockVal)); |
| 4697 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
| 4698 | CHECK_FOR_ERROR |
| 4699 | ;} |
| 4700 | break; |
| 4701 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4702 | case 219: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4703 | #line 2345 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4704 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4705 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
| 4706 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4707 | if (CI2->getParent() == 0) |
| 4708 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4709 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 4710 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
| 4711 | CHECK_FOR_ERROR |
| 4712 | ;} |
| 4713 | break; |
| 4714 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4715 | case 220: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4716 | #line 2354 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4717 | { |
| 4718 | (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4719 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4720 | |
| 4721 | // Make sure to move the basic block to the correct location in the |
| 4722 | // function, instead of leaving it inserted wherever it was first |
| 4723 | // referenced. |
| 4724 | Function::BasicBlockListType &BBL = |
| 4725 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4726 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4727 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4728 | ;} |
| 4729 | break; |
| 4730 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4731 | case 221: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4732 | #line 2366 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4733 | { |
| 4734 | (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4735 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4736 | |
| 4737 | // Make sure to move the basic block to the correct location in the |
| 4738 | // function, instead of leaving it inserted wherever it was first |
| 4739 | // referenced. |
| 4740 | Function::BasicBlockListType &BBL = |
| 4741 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4742 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4743 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4744 | ;} |
| 4745 | break; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4746 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4747 | case 222: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4748 | #line 2379 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4749 | { // Return with a result... |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4750 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal).val); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4751 | CHECK_FOR_ERROR |
| 4752 | ;} |
| 4753 | break; |
| 4754 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4755 | case 223: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4756 | #line 2383 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4757 | { // Return with no result... |
| 4758 | (yyval.TermInstVal) = new ReturnInst(); |
| 4759 | CHECK_FOR_ERROR |
| 4760 | ;} |
| 4761 | break; |
| 4762 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4763 | case 224: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4764 | #line 2387 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4765 | { // Unconditional Branch... |
| 4766 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4767 | CHECK_FOR_ERROR |
| 4768 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 4769 | ;} |
| 4770 | break; |
| 4771 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4772 | case 225: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4773 | #line 2392 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4774 | { |
| 4775 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 4776 | CHECK_FOR_ERROR |
| 4777 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4778 | CHECK_FOR_ERROR |
| 4779 | Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); |
| 4780 | CHECK_FOR_ERROR |
| 4781 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 4782 | ;} |
| 4783 | break; |
| 4784 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4785 | case 226: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4786 | #line 2401 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4787 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4788 | Value* tmpVal = getVal((yyvsp[-7].TypeVal).type->get(), (yyvsp[-6].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4789 | CHECK_FOR_ERROR |
| 4790 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 4791 | CHECK_FOR_ERROR |
| 4792 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 4793 | (yyval.TermInstVal) = S; |
| 4794 | |
| 4795 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 4796 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4797 | for (; I != E; ++I) { |
| 4798 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4799 | S->addCase(CI, I->second); |
| 4800 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4801 | GEN_ERROR("Switch case is constant, but not a simple integer!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4802 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4803 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4804 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4805 | ;} |
| 4806 | break; |
| 4807 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4808 | case 227: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4809 | #line 2420 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4810 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4811 | Value* tmpVal = getVal((yyvsp[-6].TypeVal).type->get(), (yyvsp[-5].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4812 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4813 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4814 | CHECK_FOR_ERROR |
| 4815 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4816 | (yyval.TermInstVal) = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4817 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4818 | ;} |
| 4819 | break; |
| 4820 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4821 | case 228: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4822 | #line 2430 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4823 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4824 | const PointerType *PFTy; |
| 4825 | const FunctionType *Ty; |
| 4826 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4827 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal).type->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4828 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 4829 | // Pull out the types of all of the arguments... |
| 4830 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4831 | if ((yyvsp[-7].ValueList)) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4832 | for (std::vector<ValueInfo>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4833 | I != E; ++I) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4834 | ParamTypes.push_back((*I).val->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4835 | } |
| 4836 | |
| 4837 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 4838 | if (isVarArg) ParamTypes.pop_back(); |
| 4839 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4840 | Ty = FunctionType::get((yyvsp[-10].TypeVal).type->get(), ParamTypes, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4841 | PFTy = PointerType::get(Ty); |
| 4842 | } |
| 4843 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4844 | Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4845 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4846 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4847 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4848 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4849 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4850 | |
| 4851 | // Create the call node... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4852 | if (!(yyvsp[-7].ValueList)) { // Has no arguments? |
| 4853 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4854 | } else { // Has arguments? |
| 4855 | // Loop through FunctionType's arguments and ensure they are specified |
| 4856 | // correctly! |
| 4857 | // |
| 4858 | FunctionType::param_iterator I = Ty->param_begin(); |
| 4859 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4860 | std::vector<ValueInfo>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4861 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4862 | std::vector<Value*> args; |
| 4863 | for (; ArgI != ArgE; ++ArgI) |
| 4864 | if (I == E) { |
| 4865 | if (Ty->isVarArg()) { |
| 4866 | args.push_back((*ArgI).val); |
| 4867 | } else { |
| 4868 | GEN_ERROR("Too many parameters for function of type " + |
| 4869 | Ty->getDescription()); |
| 4870 | } |
| 4871 | } else { |
| 4872 | if ((*ArgI).val->getType() != *I) { |
| 4873 | GEN_ERROR("Parameter " + (*ArgI).val->getName() + |
| 4874 | " is not of type '" + (*I)->getDescription() + "'!"); |
| 4875 | } else |
| 4876 | args.push_back((*ArgI).val); |
| 4877 | ++I; |
| 4878 | } |
| 4879 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, args); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4880 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4881 | cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4882 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4883 | delete (yyvsp[-10].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4884 | delete (yyvsp[-7].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4885 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4886 | ;} |
| 4887 | break; |
| 4888 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4889 | case 229: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4890 | #line 2494 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4891 | { |
| 4892 | (yyval.TermInstVal) = new UnwindInst(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4893 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4894 | ;} |
| 4895 | break; |
| 4896 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4897 | case 230: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4898 | #line 2498 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4899 | { |
| 4900 | (yyval.TermInstVal) = new UnreachableInst(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4901 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4902 | ;} |
| 4903 | break; |
| 4904 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4905 | case 231: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4906 | #line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4907 | { |
| 4908 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4909 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].TypeVal).type->get(), (yyvsp[-3].ValIDVal))); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4910 | CHECK_FOR_ERROR |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4911 | if (V == 0) |
| 4912 | GEN_ERROR("May only switch on a constant pool value!"); |
| 4913 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4914 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4915 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4916 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 4917 | ;} |
| 4918 | break; |
| 4919 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4920 | case 232: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4921 | #line 2516 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4922 | { |
| 4923 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4924 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].TypeVal).type->get(), (yyvsp[-3].ValIDVal))); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4925 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4926 | |
| 4927 | if (V == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4928 | GEN_ERROR("May only switch on a constant pool value!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4929 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4930 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4931 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4932 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 4933 | ;} |
| 4934 | break; |
| 4935 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4936 | case 233: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4937 | #line 2529 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4938 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4939 | // Is this definition named?? if so, assign the name... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4940 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4941 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4942 | InsertValue((yyvsp[0].InstVal)); |
| 4943 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4944 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4945 | ;} |
| 4946 | break; |
| 4947 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4948 | case 234: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4949 | #line 2538 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4950 | { // Used for PHI nodes |
| 4951 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4952 | Value* tmpVal = getVal((yyvsp[-5].TypeVal).type->get(), (yyvsp[-3].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4953 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4954 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4955 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4956 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4957 | delete (yyvsp[-5].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4958 | ;} |
| 4959 | break; |
| 4960 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4961 | case 235: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4962 | #line 2547 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4963 | { |
| 4964 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 4965 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4966 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4967 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4968 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4969 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 4970 | ;} |
| 4971 | break; |
| 4972 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4973 | case 236: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4974 | #line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4975 | { // Used for call statements, and memory insts... |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4976 | (yyval.ValueList) = new std::vector<ValueInfo>(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4977 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
| 4978 | ;} |
| 4979 | break; |
| 4980 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4981 | case 237: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4982 | #line 2561 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4983 | { |
| 4984 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 4985 | (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4986 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4987 | ;} |
| 4988 | break; |
| 4989 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4990 | case 238: |
| 4991 | #line 2568 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4992 | { |
| 4993 | (yyval.ValueList) = (yyvsp[0].ValueList); |
| 4994 | ;} |
| 4995 | break; |
| 4996 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4997 | case 239: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 4998 | #line 2571 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4999 | { |
| 5000 | (yyval.ValueList) = 0; |
| 5001 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5002 | break; |
| 5003 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5004 | case 240: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5005 | #line 2575 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5006 | { |
| 5007 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5008 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5009 | ;} |
| 5010 | break; |
| 5011 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5012 | case 241: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5013 | #line 2579 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5014 | { |
| 5015 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5016 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5017 | ;} |
| 5018 | break; |
| 5019 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5020 | case 242: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5021 | #line 2584 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5022 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5023 | if (!(yyvsp[-3].TypeVal).type->get()->isInteger() && !(yyvsp[-3].TypeVal).type->get()->isFloatingPoint() && |
| 5024 | !isa<PackedType>((yyvsp[-3].TypeVal).type->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5025 | GEN_ERROR( |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5026 | "Arithmetic operator requires integer, FP, or packed operands!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5027 | if (isa<PackedType>((yyvsp[-3].TypeVal).type->get()) && |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5028 | ((yyvsp[-4].BinaryOpVal).opcode == Instruction::URem || |
| 5029 | (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem || |
| 5030 | (yyvsp[-4].BinaryOpVal).opcode == Instruction::FRem)) |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 5031 | GEN_ERROR("U/S/FRem not supported on packed types!"); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 5032 | // Upgrade the opcode from obsolete versions before we do anything with it. |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5033 | sanitizeOpcode((yyvsp[-4].BinaryOpVal),(yyvsp[-3].TypeVal).type->get()); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 5034 | CHECK_FOR_ERROR; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5035 | Value* val1 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5036 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5037 | Value* val2 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5038 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5039 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, val1, val2); |
| 5040 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5041 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5042 | delete (yyvsp[-3].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5043 | ;} |
| 5044 | break; |
| 5045 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5046 | case 243: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5047 | #line 2606 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5048 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5049 | if (!(yyvsp[-3].TypeVal).type->get()->isIntegral()) { |
| 5050 | if (!isa<PackedType>((yyvsp[-3].TypeVal).type->get()) || |
| 5051 | !cast<PackedType>((yyvsp[-3].TypeVal).type->get())->getElementType()->isIntegral()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5052 | GEN_ERROR("Logical operator requires integral operands!"); |
Chris Lattner | 524a131 | 2005-12-21 18:31:50 +0000 | [diff] [blame] | 5053 | } |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5054 | Value* tmpVal1 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5055 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5056 | Value* tmpVal2 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5057 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5058 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2); |
| 5059 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5060 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5061 | delete (yyvsp[-3].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5062 | ;} |
| 5063 | break; |
| 5064 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5065 | case 244: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5066 | #line 2621 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5067 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5068 | if(isa<PackedType>((yyvsp[-3].TypeVal).type->get())) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5069 | GEN_ERROR( |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5070 | "PackedTypes currently not supported in setcc instructions!"); |
| 5071 | } |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5072 | Value* tmpVal1 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5073 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5074 | Value* tmpVal2 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5075 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5076 | (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2); |
| 5077 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5078 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5079 | delete (yyvsp[-3].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5080 | ;} |
| 5081 | break; |
| 5082 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5083 | case 245: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5084 | #line 2635 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5085 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5086 | std::cerr << "WARNING: Use of eliminated 'not' instruction:" |
| 5087 | << " Replacing with 'xor'.\n"; |
| 5088 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5089 | Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal).val->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5090 | if (Ones == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5091 | GEN_ERROR("Expected integral type for not instruction!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5092 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5093 | (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal).val, Ones); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5094 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5095 | GEN_ERROR("Could not create a xor instruction!"); |
| 5096 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5097 | ;} |
| 5098 | break; |
| 5099 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5100 | case 246: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5101 | #line 2648 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5102 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5103 | if ((yyvsp[0].ValueVal).val->getType() != Type::UByteTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5104 | GEN_ERROR("Shift amount must be ubyte!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5105 | if (!(yyvsp[-2].ValueVal).val->getType()->isInteger()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5106 | GEN_ERROR("Shift constant expression requires integer operand!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5107 | // Handle opcode upgrade situations |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5108 | sanitizeOpcode((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal).val->getType()); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5109 | CHECK_FOR_ERROR; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5110 | (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal).opcode, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5111 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5112 | ;} |
| 5113 | break; |
| 5114 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5115 | case 247: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5116 | #line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5117 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5118 | Value* Val = (yyvsp[-2].ValueVal).val; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5119 | const Type* Ty = (yyvsp[0].TypeVal).type->get(); |
| 5120 | if (!Val->getType()->isFirstClassType()) |
| 5121 | GEN_ERROR("cast from a non-primitive type: '" + |
| 5122 | Val->getType()->getDescription() + "'!"); |
| 5123 | if (!Ty->isFirstClassType()) |
| 5124 | GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!"); |
| 5125 | |
| 5126 | if ((yyvsp[-3].CastOpVal).obsolete) { |
| 5127 | if (Ty == Type::BoolTy) { |
| 5128 | // The previous definition of cast to bool was a compare against zero. |
| 5129 | // We have to retain that semantic so we do it here. |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5130 | (yyval.InstVal) = new SetCondInst(Instruction::SetNE, (yyvsp[-2].ValueVal).val, |
| 5131 | Constant::getNullValue((yyvsp[-2].ValueVal).val->getType())); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5132 | } else if (Val->getType()->isFloatingPoint() && isa<PointerType>(Ty)) { |
| 5133 | CastInst *CI = new FPToUIInst(Val, Type::ULongTy); |
| 5134 | (yyval.InstVal) = new IntToPtrInst(CI, Ty); |
| 5135 | } else { |
| 5136 | (yyval.InstVal) = CastInst::createInferredCast(Val, Ty); |
| 5137 | } |
| 5138 | } else { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5139 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal).opcode, (yyvsp[-2].ValueVal).val, (yyvsp[0].TypeVal).type->get()); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5140 | } |
| 5141 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5142 | ;} |
| 5143 | break; |
| 5144 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5145 | case 248: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5146 | #line 2685 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5147 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5148 | if ((yyvsp[-4].ValueVal).val->getType() != Type::BoolTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5149 | GEN_ERROR("select condition must be boolean!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5150 | if ((yyvsp[-2].ValueVal).val->getType() != (yyvsp[0].ValueVal).val->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5151 | GEN_ERROR("select value types should match!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5152 | (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5153 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5154 | ;} |
| 5155 | break; |
| 5156 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5157 | case 249: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5158 | #line 2693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5159 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5160 | NewVarArgs = true; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5161 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal).val, (yyvsp[0].TypeVal).type->get()); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5162 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5163 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5164 | ;} |
| 5165 | break; |
| 5166 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5167 | case 250: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5168 | #line 2699 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5169 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5170 | ObsoleteVarArgs = true; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5171 | const Type* ArgTy = (yyvsp[-2].ValueVal).val->getType(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5172 | Function* NF = CurModule.CurrentModule-> |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 5173 | getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5174 | |
| 5175 | //b = vaarg a, t -> |
| 5176 | //foo = alloca 1 of t |
| 5177 | //bar = vacopy a |
| 5178 | //store bar -> foo |
| 5179 | //b = vaarg foo, t |
| 5180 | AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); |
| 5181 | CurBB->getInstList().push_back(foo); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5182 | CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal).val); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5183 | CurBB->getInstList().push_back(bar); |
| 5184 | CurBB->getInstList().push_back(new StoreInst(bar, foo)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5185 | (yyval.InstVal) = new VAArgInst(foo, (yyvsp[0].TypeVal).type->get()); |
| 5186 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5187 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5188 | ;} |
| 5189 | break; |
| 5190 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5191 | case 251: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5192 | #line 2719 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5193 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5194 | ObsoleteVarArgs = true; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5195 | const Type* ArgTy = (yyvsp[-2].ValueVal).val->getType(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5196 | Function* NF = CurModule.CurrentModule-> |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 5197 | getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5198 | |
| 5199 | //b = vanext a, t -> |
| 5200 | //foo = alloca 1 of t |
| 5201 | //bar = vacopy a |
| 5202 | //store bar -> foo |
| 5203 | //tmp = vaarg foo, t |
| 5204 | //b = load foo |
| 5205 | AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); |
| 5206 | CurBB->getInstList().push_back(foo); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5207 | CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal).val); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5208 | CurBB->getInstList().push_back(bar); |
| 5209 | CurBB->getInstList().push_back(new StoreInst(bar, foo)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5210 | Instruction* tmp = new VAArgInst(foo, (yyvsp[0].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5211 | CurBB->getInstList().push_back(tmp); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5212 | (yyval.InstVal) = new LoadInst(foo); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5213 | delete (yyvsp[0].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5214 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5215 | ;} |
| 5216 | break; |
| 5217 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5218 | case 252: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5219 | #line 2742 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5220 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5221 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5222 | GEN_ERROR("Invalid extractelement operands!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5223 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5224 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5225 | ;} |
| 5226 | break; |
| 5227 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5228 | case 253: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5229 | #line 2748 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5230 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5231 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5232 | GEN_ERROR("Invalid insertelement operands!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5233 | (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5234 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5235 | ;} |
| 5236 | break; |
| 5237 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5238 | case 254: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5239 | #line 2754 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5240 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5241 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5242 | GEN_ERROR("Invalid shufflevector operands!"); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5243 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5244 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5245 | ;} |
| 5246 | break; |
| 5247 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5248 | case 255: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5249 | #line 2760 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5250 | { |
| 5251 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5252 | if (!Ty->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5253 | GEN_ERROR("PHI node operands must be of first class type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5254 | (yyval.InstVal) = new PHINode(Ty); |
| 5255 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5256 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5257 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5258 | GEN_ERROR("All elements of a PHI node must be of the same type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5259 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5260 | (yyvsp[0].PHIList)->pop_front(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5261 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5262 | delete (yyvsp[0].PHIList); // Free the list... |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5263 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5264 | ;} |
| 5265 | break; |
| 5266 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5267 | case 256: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5268 | #line 2775 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5269 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5270 | const PointerType *PFTy = 0; |
| 5271 | const FunctionType *Ty = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5272 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5273 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal).type->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5274 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5275 | // Pull out the types of all of the arguments... |
| 5276 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5277 | if ((yyvsp[-1].ValueList)) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5278 | for (std::vector<ValueInfo>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5279 | I != E; ++I) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5280 | ParamTypes.push_back((*I).val->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5281 | } |
| 5282 | |
| 5283 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 5284 | if (isVarArg) ParamTypes.pop_back(); |
| 5285 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5286 | if (!(yyvsp[-4].TypeVal).type->get()->isFirstClassType() && |
| 5287 | (yyvsp[-4].TypeVal).type->get() != Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5288 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5289 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5290 | Ty = FunctionType::get((yyvsp[-4].TypeVal).type->get(), ParamTypes, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5291 | PFTy = PointerType::get(Ty); |
| 5292 | } |
| 5293 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5294 | Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5295 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5296 | |
| 5297 | // Create the call node... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5298 | if (!(yyvsp[-1].ValueList)) { // Has no arguments? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5299 | // Make sure no arguments is a good thing! |
| 5300 | if (Ty->getNumParams() != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5301 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5302 | "expects arguments!"); |
| 5303 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5304 | (yyval.InstVal) = new CallInst(V, std::vector<Value*>()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5305 | } else { // Has arguments? |
| 5306 | // Loop through FunctionType's arguments and ensure they are specified |
| 5307 | // correctly! |
| 5308 | // |
| 5309 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5310 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5311 | std::vector<ValueInfo>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5312 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5313 | std::vector<Value*> args; |
| 5314 | for (; ArgI != ArgE ; ++ArgI) |
| 5315 | if (I == E) { |
| 5316 | if (Ty->isVarArg()) { |
| 5317 | args.push_back((*ArgI).val); |
| 5318 | } else { |
| 5319 | GEN_ERROR("Too many parameters for function of type " + |
| 5320 | Ty->getDescription()); |
| 5321 | } |
| 5322 | } else { |
| 5323 | if ((*ArgI).val->getType() != *I) { |
| 5324 | GEN_ERROR("Parameter " + (*ArgI).val->getName() + |
| 5325 | " is not of type '" + (*I)->getDescription() + "'!"); |
| 5326 | } else |
| 5327 | args.push_back((*ArgI).val); |
| 5328 | ++I; |
| 5329 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5330 | |
| 5331 | if (I != E || (ArgI != ArgE && !Ty->isVarArg())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5332 | GEN_ERROR("Invalid number of parameters detected!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5333 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5334 | (yyval.InstVal) = new CallInst(V, args); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5335 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5336 | cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal)); |
| 5337 | cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5338 | delete (yyvsp[-4].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5339 | delete (yyvsp[-1].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5340 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5341 | ;} |
| 5342 | break; |
| 5343 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5344 | case 257: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5345 | #line 2848 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5346 | { |
| 5347 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5348 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5349 | ;} |
| 5350 | break; |
| 5351 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5352 | case 258: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5353 | #line 2855 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5354 | { |
| 5355 | (yyval.ValueList) = (yyvsp[0].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5356 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5357 | ;} |
| 5358 | break; |
| 5359 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5360 | case 259: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5361 | #line 2858 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5362 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5363 | (yyval.ValueList) = new std::vector<ValueInfo>(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5364 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5365 | ;} |
| 5366 | break; |
| 5367 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5368 | case 260: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5369 | #line 2863 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5370 | { |
| 5371 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5372 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5373 | ;} |
| 5374 | break; |
| 5375 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5376 | case 261: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5377 | #line 2867 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5378 | { |
| 5379 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5380 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5381 | ;} |
| 5382 | break; |
| 5383 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5384 | case 262: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5385 | #line 2874 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5386 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5387 | (yyval.InstVal) = new MallocInst((yyvsp[-1].TypeVal).type->get(), 0, (yyvsp[0].UIntVal)); |
| 5388 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5389 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5390 | ;} |
| 5391 | break; |
| 5392 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5393 | case 263: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5394 | #line 2879 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5395 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5396 | Value* tmpVal = getVal((yyvsp[-2].TypeVal).type->get(), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5397 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5398 | (yyval.InstVal) = new MallocInst((yyvsp[-4].TypeVal).type->get(), tmpVal, (yyvsp[0].UIntVal)); |
| 5399 | delete (yyvsp[-4].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5400 | ;} |
| 5401 | break; |
| 5402 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5403 | case 264: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5404 | #line 2885 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5405 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5406 | (yyval.InstVal) = new AllocaInst((yyvsp[-1].TypeVal).type->get(), 0, (yyvsp[0].UIntVal)); |
| 5407 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5408 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5409 | ;} |
| 5410 | break; |
| 5411 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5412 | case 265: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5413 | #line 2890 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5414 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5415 | Value* tmpVal = getVal((yyvsp[-2].TypeVal).type->get(), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5416 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5417 | (yyval.InstVal) = new AllocaInst((yyvsp[-4].TypeVal).type->get(), tmpVal, (yyvsp[0].UIntVal)); |
| 5418 | delete (yyvsp[-4].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5419 | ;} |
| 5420 | break; |
| 5421 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5422 | case 266: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5423 | #line 2896 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5424 | { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5425 | if (!isa<PointerType>((yyvsp[0].ValueVal).val->getType())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5426 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5427 | (yyvsp[0].ValueVal).val->getType()->getDescription() + "!"); |
| 5428 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal).val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5429 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5430 | ;} |
| 5431 | break; |
| 5432 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5433 | case 267: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5434 | #line 2904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5435 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5436 | if (!isa<PointerType>((yyvsp[-1].TypeVal).type->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5437 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5438 | (yyvsp[-1].TypeVal).type->get()->getDescription()); |
| 5439 | if (!cast<PointerType>((yyvsp[-1].TypeVal).type->get())->getElementType()->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5440 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5441 | (yyvsp[-1].TypeVal).type->get()->getDescription()); |
| 5442 | Value* tmpVal = getVal((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5443 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5444 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5445 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5446 | ;} |
| 5447 | break; |
| 5448 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5449 | case 268: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5450 | #line 2916 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5451 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5452 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal).type->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5453 | if (!PT) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5454 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5455 | ((yyvsp[-1].TypeVal).type->get())->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5456 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5457 | if (ElTy != (yyvsp[-3].ValueVal).val->getType()) |
| 5458 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal).val->getType()->getDescription() + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5459 | "' into space of type '" + ElTy->getDescription() + "'!"); |
| 5460 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5461 | Value* tmpVal = getVal((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5462 | CHECK_FOR_ERROR |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5463 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal).val, tmpVal, (yyvsp[-5].BoolVal)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5464 | delete (yyvsp[-1].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5465 | ;} |
| 5466 | break; |
| 5467 | |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5468 | case 269: |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5469 | #line 2931 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5470 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5471 | if (!isa<PointerType>((yyvsp[-2].TypeVal).type->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5472 | GEN_ERROR("getelementptr insn requires pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5473 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5474 | std::vector<Value*> indices; |
| 5475 | for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e; ++i) |
| 5476 | indices.push_back((*(yyvsp[0].ValueList))[i].val); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5477 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5478 | if (!GetElementPtrInst::getIndexedType((yyvsp[-2].TypeVal).type->get(), indices, true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5479 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5480 | (yyvsp[-2].TypeVal).type->get()->getDescription()+ "'!"); |
| 5481 | Value* tmpVal = getVal((yyvsp[-2].TypeVal).type->get(), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5482 | CHECK_FOR_ERROR |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5483 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, indices); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5484 | delete (yyvsp[-2].TypeVal).type; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5485 | delete (yyvsp[0].ValueList); |
| 5486 | ;} |
| 5487 | break; |
| 5488 | |
| 5489 | |
| 5490 | default: break; |
| 5491 | } |
| 5492 | |
| 5493 | /* Line 1126 of yacc.c. */ |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5494 | #line 5495 "llvmAsmParser.tab.c" |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5495 | |
| 5496 | yyvsp -= yylen; |
| 5497 | yyssp -= yylen; |
| 5498 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5499 | |
| 5500 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5501 | |
| 5502 | *++yyvsp = yyval; |
| 5503 | |
| 5504 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5505 | /* Now `shift' the result of the reduction. Determine what state |
| 5506 | that goes to, based on the state we popped back to and the rule |
| 5507 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5508 | |
| 5509 | yyn = yyr1[yyn]; |
| 5510 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5511 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5512 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5513 | yystate = yytable[yystate]; |
| 5514 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5515 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5516 | |
| 5517 | goto yynewstate; |
| 5518 | |
| 5519 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5520 | /*------------------------------------. |
| 5521 | | yyerrlab -- here on detecting error | |
| 5522 | `------------------------------------*/ |
| 5523 | yyerrlab: |
| 5524 | /* If not already recovering from an error, report this error. */ |
| 5525 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5526 | { |
| 5527 | ++yynerrs; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5528 | #if YYERROR_VERBOSE |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5529 | yyn = yypact[yystate]; |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 5530 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5531 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5532 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5533 | int yytype = YYTRANSLATE (yychar); |
| 5534 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5535 | YYSIZE_T yysize = yysize0; |
| 5536 | YYSIZE_T yysize1; |
| 5537 | int yysize_overflow = 0; |
| 5538 | char *yymsg = 0; |
| 5539 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5540 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5541 | int yyx; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5542 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5543 | #if 0 |
| 5544 | /* This is so xgettext sees the translatable formats that are |
| 5545 | constructed on the fly. */ |
| 5546 | YY_("syntax error, unexpected %s"); |
| 5547 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5548 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5549 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5550 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5551 | #endif |
| 5552 | char *yyfmt; |
| 5553 | char const *yyf; |
| 5554 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5555 | static char const yyexpecting[] = ", expecting %s"; |
| 5556 | static char const yyor[] = " or %s"; |
| 5557 | char yyformat[sizeof yyunexpected |
| 5558 | + sizeof yyexpecting - 1 |
| 5559 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5560 | * (sizeof yyor - 1))]; |
| 5561 | char const *yyprefix = yyexpecting; |
| 5562 | |
| 5563 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5564 | YYCHECK. */ |
| 5565 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5566 | |
| 5567 | /* Stay within bounds of both yycheck and yytname. */ |
| 5568 | int yychecklim = YYLAST - yyn; |
| 5569 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5570 | int yycount = 1; |
| 5571 | |
| 5572 | yyarg[0] = yytname[yytype]; |
| 5573 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5574 | |
| 5575 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5576 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5577 | { |
| 5578 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 5579 | { |
| 5580 | yycount = 1; |
| 5581 | yysize = yysize0; |
| 5582 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 5583 | break; |
| 5584 | } |
| 5585 | yyarg[yycount++] = yytname[yyx]; |
| 5586 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5587 | yysize_overflow |= yysize1 < yysize; |
| 5588 | yysize = yysize1; |
| 5589 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5590 | yyprefix = yyor; |
| 5591 | } |
| 5592 | |
| 5593 | yyf = YY_(yyformat); |
| 5594 | yysize1 = yysize + yystrlen (yyf); |
| 5595 | yysize_overflow |= yysize1 < yysize; |
| 5596 | yysize = yysize1; |
| 5597 | |
| 5598 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5599 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5600 | if (yymsg) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5601 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5602 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5603 | Don't have undefined behavior even if the translation |
| 5604 | produced a string with the wrong number of "%s"s. */ |
| 5605 | char *yyp = yymsg; |
| 5606 | int yyi = 0; |
| 5607 | while ((*yyp = *yyf)) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5608 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5609 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5610 | { |
| 5611 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5612 | yyf += 2; |
| 5613 | } |
| 5614 | else |
| 5615 | { |
| 5616 | yyp++; |
| 5617 | yyf++; |
| 5618 | } |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5619 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5620 | yyerror (yymsg); |
| 5621 | YYSTACK_FREE (yymsg); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5622 | } |
| 5623 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5624 | { |
| 5625 | yyerror (YY_("syntax error")); |
| 5626 | goto yyexhaustedlab; |
| 5627 | } |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5628 | } |
| 5629 | else |
| 5630 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5631 | yyerror (YY_("syntax error")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5632 | } |
| 5633 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5634 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5635 | |
| 5636 | if (yyerrstatus == 3) |
| 5637 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5638 | /* If just tried and failed to reuse look-ahead token after an |
| 5639 | error, discard it. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5640 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5641 | if (yychar <= YYEOF) |
| 5642 | { |
| 5643 | /* Return failure if at end of input. */ |
| 5644 | if (yychar == YYEOF) |
| 5645 | YYABORT; |
| 5646 | } |
| 5647 | else |
| 5648 | { |
| 5649 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 5650 | yychar = YYEMPTY; |
| 5651 | } |
| 5652 | } |
| 5653 | |
| 5654 | /* Else will try to reuse look-ahead token after shifting the error |
| 5655 | token. */ |
| 5656 | goto yyerrlab1; |
| 5657 | |
| 5658 | |
| 5659 | /*---------------------------------------------------. |
| 5660 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5661 | `---------------------------------------------------*/ |
| 5662 | yyerrorlab: |
| 5663 | |
| 5664 | /* Pacify compilers like GCC when the user code never invokes |
| 5665 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5666 | code. */ |
| 5667 | if (0) |
| 5668 | goto yyerrorlab; |
| 5669 | |
| 5670 | yyvsp -= yylen; |
| 5671 | yyssp -= yylen; |
| 5672 | yystate = *yyssp; |
| 5673 | goto yyerrlab1; |
| 5674 | |
| 5675 | |
| 5676 | /*-------------------------------------------------------------. |
| 5677 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5678 | `-------------------------------------------------------------*/ |
| 5679 | yyerrlab1: |
| 5680 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5681 | |
| 5682 | for (;;) |
| 5683 | { |
| 5684 | yyn = yypact[yystate]; |
| 5685 | if (yyn != YYPACT_NINF) |
| 5686 | { |
| 5687 | yyn += YYTERROR; |
| 5688 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5689 | { |
| 5690 | yyn = yytable[yyn]; |
| 5691 | if (0 < yyn) |
| 5692 | break; |
| 5693 | } |
| 5694 | } |
| 5695 | |
| 5696 | /* Pop the current state because it cannot handle the error token. */ |
| 5697 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5698 | YYABORT; |
| 5699 | |
Chris Lattner | 8335e84 | 2006-01-23 23:05:42 +0000 | [diff] [blame] | 5700 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5701 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 5702 | YYPOPSTACK; |
| 5703 | yystate = *yyssp; |
| 5704 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5705 | } |
| 5706 | |
| 5707 | if (yyn == YYFINAL) |
| 5708 | YYACCEPT; |
| 5709 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5710 | *++yyvsp = yylval; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5711 | |
| 5712 | |
| 5713 | /* Shift the error token. */ |
| 5714 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5715 | |
| 5716 | yystate = yyn; |
| 5717 | goto yynewstate; |
| 5718 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5719 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5720 | /*-------------------------------------. |
| 5721 | | yyacceptlab -- YYACCEPT comes here. | |
| 5722 | `-------------------------------------*/ |
| 5723 | yyacceptlab: |
| 5724 | yyresult = 0; |
| 5725 | goto yyreturn; |
| 5726 | |
| 5727 | /*-----------------------------------. |
| 5728 | | yyabortlab -- YYABORT comes here. | |
| 5729 | `-----------------------------------*/ |
| 5730 | yyabortlab: |
| 5731 | yyresult = 1; |
| 5732 | goto yyreturn; |
| 5733 | |
| 5734 | #ifndef yyoverflow |
| 5735 | /*-------------------------------------------------. |
| 5736 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5737 | `-------------------------------------------------*/ |
| 5738 | yyexhaustedlab: |
| 5739 | yyerror (YY_("memory exhausted")); |
| 5740 | yyresult = 2; |
| 5741 | /* Fall through. */ |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5742 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5743 | |
| 5744 | yyreturn: |
| 5745 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5746 | yydestruct ("Cleanup: discarding lookahead", |
| 5747 | yytoken, &yylval); |
| 5748 | while (yyssp != yyss) |
| 5749 | { |
| 5750 | yydestruct ("Cleanup: popping", |
| 5751 | yystos[*yyssp], yyvsp); |
| 5752 | YYPOPSTACK; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5753 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5754 | #ifndef yyoverflow |
| 5755 | if (yyss != yyssa) |
| 5756 | YYSTACK_FREE (yyss); |
| 5757 | #endif |
| 5758 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5759 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5760 | |
| 5761 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame^] | 5762 | #line 2950 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5763 | |
| 5764 | |
| 5765 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5766 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5767 | // TODO: column number in exception |
| 5768 | if (TheParseError) |
| 5769 | TheParseError->setError(CurFilename, message, LineNo); |
| 5770 | TriggerError = 1; |
| 5771 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5772 | |
| 5773 | int yyerror(const char *ErrorMsg) { |
| 5774 | std::string where |
| 5775 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5776 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5777 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5778 | if (yychar == YYEMPTY || yychar == 0) |
| 5779 | errMsg += "end-of-file."; |
| 5780 | else |
| 5781 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5782 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5783 | return 0; |
| 5784 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5785 | |