Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +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 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 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 |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 20 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 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. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 25 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 26 | /* Written by Richard Stallman by simplifying the original so called |
| 27 | ``semantic'' parser. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 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 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 39 | /* Bison version. */ |
| 40 | #define YYBISON_VERSION "2.1" |
| 41 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 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 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 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, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 74 | INT8 = 265, |
| 75 | INT16 = 266, |
| 76 | INT32 = 267, |
| 77 | INT64 = 268, |
| 78 | FLOAT = 269, |
| 79 | DOUBLE = 270, |
| 80 | LABEL = 271, |
| 81 | TYPE = 272, |
| 82 | VAR_ID = 273, |
| 83 | LABELSTR = 274, |
| 84 | STRINGCONSTANT = 275, |
| 85 | IMPLEMENTATION = 276, |
| 86 | ZEROINITIALIZER = 277, |
| 87 | TRUETOK = 278, |
| 88 | FALSETOK = 279, |
| 89 | BEGINTOK = 280, |
| 90 | ENDTOK = 281, |
| 91 | DECLARE = 282, |
| 92 | DEFINE = 283, |
| 93 | GLOBAL = 284, |
| 94 | CONSTANT = 285, |
| 95 | SECTION = 286, |
| 96 | VOLATILE = 287, |
| 97 | TO = 288, |
| 98 | DOTDOTDOT = 289, |
| 99 | NULL_TOK = 290, |
| 100 | UNDEF = 291, |
| 101 | INTERNAL = 292, |
| 102 | LINKONCE = 293, |
| 103 | WEAK = 294, |
| 104 | APPENDING = 295, |
| 105 | DLLIMPORT = 296, |
| 106 | DLLEXPORT = 297, |
| 107 | EXTERN_WEAK = 298, |
| 108 | OPAQUE = 299, |
| 109 | NOT = 300, |
| 110 | EXTERNAL = 301, |
| 111 | TARGET = 302, |
| 112 | TRIPLE = 303, |
| 113 | ENDIAN = 304, |
| 114 | POINTERSIZE = 305, |
| 115 | LITTLE = 306, |
| 116 | BIG = 307, |
| 117 | ALIGN = 308, |
| 118 | DEPLIBS = 309, |
| 119 | CALL = 310, |
| 120 | TAIL = 311, |
| 121 | ASM_TOK = 312, |
| 122 | MODULE = 313, |
| 123 | SIDEEFFECT = 314, |
| 124 | CC_TOK = 315, |
| 125 | CCC_TOK = 316, |
| 126 | CSRETCC_TOK = 317, |
| 127 | FASTCC_TOK = 318, |
| 128 | COLDCC_TOK = 319, |
| 129 | X86_STDCALLCC_TOK = 320, |
| 130 | X86_FASTCALLCC_TOK = 321, |
| 131 | DATALAYOUT = 322, |
| 132 | RET = 323, |
| 133 | BR = 324, |
| 134 | SWITCH = 325, |
| 135 | INVOKE = 326, |
| 136 | UNWIND = 327, |
| 137 | UNREACHABLE = 328, |
| 138 | ADD = 329, |
| 139 | SUB = 330, |
| 140 | MUL = 331, |
| 141 | UDIV = 332, |
| 142 | SDIV = 333, |
| 143 | FDIV = 334, |
| 144 | UREM = 335, |
| 145 | SREM = 336, |
| 146 | FREM = 337, |
| 147 | AND = 338, |
| 148 | OR = 339, |
| 149 | XOR = 340, |
| 150 | ICMP = 341, |
| 151 | FCMP = 342, |
| 152 | EQ = 343, |
| 153 | NE = 344, |
| 154 | SLT = 345, |
| 155 | SGT = 346, |
| 156 | SLE = 347, |
| 157 | SGE = 348, |
| 158 | ULT = 349, |
| 159 | UGT = 350, |
| 160 | ULE = 351, |
| 161 | UGE = 352, |
| 162 | OEQ = 353, |
| 163 | ONE = 354, |
| 164 | OLT = 355, |
| 165 | OGT = 356, |
| 166 | OLE = 357, |
| 167 | OGE = 358, |
| 168 | ORD = 359, |
| 169 | UNO = 360, |
| 170 | UEQ = 361, |
| 171 | UNE = 362, |
| 172 | MALLOC = 363, |
| 173 | ALLOCA = 364, |
| 174 | FREE = 365, |
| 175 | LOAD = 366, |
| 176 | STORE = 367, |
| 177 | GETELEMENTPTR = 368, |
| 178 | TRUNC = 369, |
| 179 | ZEXT = 370, |
| 180 | SEXT = 371, |
| 181 | FPTRUNC = 372, |
| 182 | FPEXT = 373, |
| 183 | BITCAST = 374, |
| 184 | UITOFP = 375, |
| 185 | SITOFP = 376, |
| 186 | FPTOUI = 377, |
| 187 | FPTOSI = 378, |
| 188 | INTTOPTR = 379, |
| 189 | PTRTOINT = 380, |
| 190 | PHI_TOK = 381, |
| 191 | SELECT = 382, |
| 192 | SHL = 383, |
| 193 | LSHR = 384, |
| 194 | ASHR = 385, |
| 195 | VAARG = 386, |
| 196 | EXTRACTELEMENT = 387, |
| 197 | INSERTELEMENT = 388, |
| 198 | SHUFFLEVECTOR = 389 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 199 | }; |
| 200 | #endif |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 201 | /* Tokens. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 202 | #define ESINT64VAL 258 |
| 203 | #define EUINT64VAL 259 |
| 204 | #define SINTVAL 260 |
| 205 | #define UINTVAL 261 |
| 206 | #define FPVAL 262 |
| 207 | #define VOID 263 |
| 208 | #define BOOL 264 |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 209 | #define INT8 265 |
| 210 | #define INT16 266 |
| 211 | #define INT32 267 |
| 212 | #define INT64 268 |
| 213 | #define FLOAT 269 |
| 214 | #define DOUBLE 270 |
| 215 | #define LABEL 271 |
| 216 | #define TYPE 272 |
| 217 | #define VAR_ID 273 |
| 218 | #define LABELSTR 274 |
| 219 | #define STRINGCONSTANT 275 |
| 220 | #define IMPLEMENTATION 276 |
| 221 | #define ZEROINITIALIZER 277 |
| 222 | #define TRUETOK 278 |
| 223 | #define FALSETOK 279 |
| 224 | #define BEGINTOK 280 |
| 225 | #define ENDTOK 281 |
| 226 | #define DECLARE 282 |
| 227 | #define DEFINE 283 |
| 228 | #define GLOBAL 284 |
| 229 | #define CONSTANT 285 |
| 230 | #define SECTION 286 |
| 231 | #define VOLATILE 287 |
| 232 | #define TO 288 |
| 233 | #define DOTDOTDOT 289 |
| 234 | #define NULL_TOK 290 |
| 235 | #define UNDEF 291 |
| 236 | #define INTERNAL 292 |
| 237 | #define LINKONCE 293 |
| 238 | #define WEAK 294 |
| 239 | #define APPENDING 295 |
| 240 | #define DLLIMPORT 296 |
| 241 | #define DLLEXPORT 297 |
| 242 | #define EXTERN_WEAK 298 |
| 243 | #define OPAQUE 299 |
| 244 | #define NOT 300 |
| 245 | #define EXTERNAL 301 |
| 246 | #define TARGET 302 |
| 247 | #define TRIPLE 303 |
| 248 | #define ENDIAN 304 |
| 249 | #define POINTERSIZE 305 |
| 250 | #define LITTLE 306 |
| 251 | #define BIG 307 |
| 252 | #define ALIGN 308 |
| 253 | #define DEPLIBS 309 |
| 254 | #define CALL 310 |
| 255 | #define TAIL 311 |
| 256 | #define ASM_TOK 312 |
| 257 | #define MODULE 313 |
| 258 | #define SIDEEFFECT 314 |
| 259 | #define CC_TOK 315 |
| 260 | #define CCC_TOK 316 |
| 261 | #define CSRETCC_TOK 317 |
| 262 | #define FASTCC_TOK 318 |
| 263 | #define COLDCC_TOK 319 |
| 264 | #define X86_STDCALLCC_TOK 320 |
| 265 | #define X86_FASTCALLCC_TOK 321 |
| 266 | #define DATALAYOUT 322 |
| 267 | #define RET 323 |
| 268 | #define BR 324 |
| 269 | #define SWITCH 325 |
| 270 | #define INVOKE 326 |
| 271 | #define UNWIND 327 |
| 272 | #define UNREACHABLE 328 |
| 273 | #define ADD 329 |
| 274 | #define SUB 330 |
| 275 | #define MUL 331 |
| 276 | #define UDIV 332 |
| 277 | #define SDIV 333 |
| 278 | #define FDIV 334 |
| 279 | #define UREM 335 |
| 280 | #define SREM 336 |
| 281 | #define FREM 337 |
| 282 | #define AND 338 |
| 283 | #define OR 339 |
| 284 | #define XOR 340 |
| 285 | #define ICMP 341 |
| 286 | #define FCMP 342 |
| 287 | #define EQ 343 |
| 288 | #define NE 344 |
| 289 | #define SLT 345 |
| 290 | #define SGT 346 |
| 291 | #define SLE 347 |
| 292 | #define SGE 348 |
| 293 | #define ULT 349 |
| 294 | #define UGT 350 |
| 295 | #define ULE 351 |
| 296 | #define UGE 352 |
| 297 | #define OEQ 353 |
| 298 | #define ONE 354 |
| 299 | #define OLT 355 |
| 300 | #define OGT 356 |
| 301 | #define OLE 357 |
| 302 | #define OGE 358 |
| 303 | #define ORD 359 |
| 304 | #define UNO 360 |
| 305 | #define UEQ 361 |
| 306 | #define UNE 362 |
| 307 | #define MALLOC 363 |
| 308 | #define ALLOCA 364 |
| 309 | #define FREE 365 |
| 310 | #define LOAD 366 |
| 311 | #define STORE 367 |
| 312 | #define GETELEMENTPTR 368 |
| 313 | #define TRUNC 369 |
| 314 | #define ZEXT 370 |
| 315 | #define SEXT 371 |
| 316 | #define FPTRUNC 372 |
| 317 | #define FPEXT 373 |
| 318 | #define BITCAST 374 |
| 319 | #define UITOFP 375 |
| 320 | #define SITOFP 376 |
| 321 | #define FPTOUI 377 |
| 322 | #define FPTOSI 378 |
| 323 | #define INTTOPTR 379 |
| 324 | #define PTRTOINT 380 |
| 325 | #define PHI_TOK 381 |
| 326 | #define SELECT 382 |
| 327 | #define SHL 383 |
| 328 | #define LSHR 384 |
| 329 | #define ASHR 385 |
| 330 | #define VAARG 386 |
| 331 | #define EXTRACTELEMENT 387 |
| 332 | #define INSERTELEMENT 388 |
| 333 | #define SHUFFLEVECTOR 389 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | /* Copy the first part of user declarations. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 339 | #line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 340 | |
| 341 | #include "ParserInternals.h" |
| 342 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 343 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 344 | #include "llvm/Instructions.h" |
| 345 | #include "llvm/Module.h" |
| 346 | #include "llvm/SymbolTable.h" |
| 347 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 348 | #include "llvm/Support/CommandLine.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 349 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 350 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 351 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 352 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 353 | #include <list> |
| 354 | #include <utility> |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 355 | #ifndef NDEBUG |
| 356 | #define YYDEBUG 1 |
| 357 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 358 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 359 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 360 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 361 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 362 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 363 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 364 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 365 | // GenerateError are made from inside productions and they must simulate the |
| 366 | // previous exception behavior by exiting the production immediately. We have |
| 367 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 368 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 369 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 370 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 371 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 372 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 373 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 374 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 375 | int yylex(); // declaration" of xxx warnings. |
| 376 | int yyparse(); |
| 377 | |
| 378 | namespace llvm { |
| 379 | std::string CurFilename; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 380 | #if YYDEBUG |
| 381 | static cl::opt<bool> |
| 382 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), |
| 383 | cl::Hidden, cl::init(false)); |
| 384 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 385 | } |
| 386 | using namespace llvm; |
| 387 | |
| 388 | static Module *ParserResult; |
| 389 | |
| 390 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 391 | // relating to upreferences in the input stream. |
| 392 | // |
| 393 | //#define DEBUG_UPREFS 1 |
| 394 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 395 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 396 | #else |
| 397 | #define UR_OUT(X) |
| 398 | #endif |
| 399 | |
| 400 | #define YYERROR_VERBOSE 1 |
| 401 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 402 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 403 | |
| 404 | |
| 405 | // This contains info used when building the body of a function. It is |
| 406 | // destroyed when the function is completed. |
| 407 | // |
| 408 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 409 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 410 | static void |
| 411 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 412 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 413 | |
| 414 | static struct PerModuleInfo { |
| 415 | Module *CurrentModule; |
| 416 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 417 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 418 | std::vector<PATypeHolder> Types; |
| 419 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 420 | |
| 421 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 422 | /// 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] | 423 | /// that we can resolve them later and print error messages as appropriate. |
| 424 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 425 | |
| 426 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 427 | // references to global values. Global values may be referenced before they |
| 428 | // are defined, and if so, the temporary object that they represent is held |
| 429 | // here. This is used for forward references of GlobalValues. |
| 430 | // |
| 431 | typedef std::map<std::pair<const PointerType *, |
| 432 | ValID>, GlobalValue*> GlobalRefsType; |
| 433 | GlobalRefsType GlobalRefs; |
| 434 | |
| 435 | void ModuleDone() { |
| 436 | // If we could not resolve some functions at function compilation time |
| 437 | // (calls to functions before they are defined), resolve them now... Types |
| 438 | // are resolved when the constant pool has been completely parsed. |
| 439 | // |
| 440 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 441 | if (TriggerError) |
| 442 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 443 | |
| 444 | // Check to make sure that all global value forward references have been |
| 445 | // resolved! |
| 446 | // |
| 447 | if (!GlobalRefs.empty()) { |
| 448 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 449 | |
| 450 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 451 | I != E; ++I) { |
| 452 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 453 | I->first.second.getName() + "\n"; |
| 454 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 455 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 456 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | Values.clear(); // Clear out function local definitions |
| 460 | Types.clear(); |
| 461 | CurrentModule = 0; |
| 462 | } |
| 463 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 464 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 465 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 466 | // If not, just return null. |
| 467 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 468 | // Check to see if there is a forward reference to this global variable... |
| 469 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 470 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 471 | GlobalValue *Ret = 0; |
| 472 | if (I != GlobalRefs.end()) { |
| 473 | Ret = I->second; |
| 474 | GlobalRefs.erase(I); |
| 475 | } |
| 476 | return Ret; |
| 477 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 478 | |
| 479 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 480 | // If it isn't abstract, its resolved |
| 481 | const Type* Ty = PATy->get(); |
| 482 | if (!Ty->isAbstract()) |
| 483 | return false; |
| 484 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 485 | // we don't need to traverse that leg of the type. |
| 486 | std::vector<const Type*> WorkList, SeenList; |
| 487 | WorkList.push_back(Ty); |
| 488 | while (!WorkList.empty()) { |
| 489 | const Type* Ty = WorkList.back(); |
| 490 | SeenList.push_back(Ty); |
| 491 | WorkList.pop_back(); |
| 492 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 493 | // Check to see if this is an unresolved type |
| 494 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 495 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 496 | for ( ; I != E; ++I) { |
| 497 | if (I->second.get() == OpTy) |
| 498 | return true; |
| 499 | } |
| 500 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 501 | const Type* TheTy = SeqTy->getElementType(); |
| 502 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 503 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 504 | E = SeenList.end(); |
| 505 | for ( ; I != E; ++I) |
| 506 | if (*I == TheTy) |
| 507 | break; |
| 508 | if (I == E) |
| 509 | WorkList.push_back(TheTy); |
| 510 | } |
| 511 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 512 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 513 | const Type* TheTy = StrTy->getElementType(i); |
| 514 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 515 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 516 | E = SeenList.end(); |
| 517 | for ( ; I != E; ++I) |
| 518 | if (*I == TheTy) |
| 519 | break; |
| 520 | if (I == E) |
| 521 | WorkList.push_back(TheTy); |
| 522 | } |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | return false; |
| 527 | } |
| 528 | |
| 529 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 530 | } CurModule; |
| 531 | |
| 532 | static struct PerFunctionInfo { |
| 533 | Function *CurrentFunction; // Pointer to current function being created |
| 534 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 535 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 536 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 537 | bool isDeclare; // Is this function a forward declararation? |
| 538 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 539 | |
| 540 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 541 | /// track of them here. |
| 542 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 543 | std::vector<BasicBlock*> NumberedBlocks; |
| 544 | unsigned NextBBNum; |
| 545 | |
| 546 | inline PerFunctionInfo() { |
| 547 | CurrentFunction = 0; |
| 548 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 549 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | inline void FunctionStart(Function *M) { |
| 553 | CurrentFunction = M; |
| 554 | NextBBNum = 0; |
| 555 | } |
| 556 | |
| 557 | void FunctionDone() { |
| 558 | NumberedBlocks.clear(); |
| 559 | |
| 560 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 561 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 562 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 563 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 564 | return; |
| 565 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 566 | |
| 567 | // Resolve all forward references now. |
| 568 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 569 | |
| 570 | Values.clear(); // Clear out function local definitions |
| 571 | CurrentFunction = 0; |
| 572 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 573 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 574 | } |
| 575 | } CurFun; // Info for the current function... |
| 576 | |
| 577 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 578 | |
| 579 | |
| 580 | //===----------------------------------------------------------------------===// |
| 581 | // Code to handle definitions of all the types |
| 582 | //===----------------------------------------------------------------------===// |
| 583 | |
| 584 | static int InsertValue(Value *V, |
| 585 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 586 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 587 | |
| 588 | // Yes, insert the value into the value table... |
| 589 | ValueList &List = ValueTab[V->getType()]; |
| 590 | List.push_back(V); |
| 591 | return List.size()-1; |
| 592 | } |
| 593 | |
| 594 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 595 | switch (D.Type) { |
| 596 | case ValID::NumberVal: // Is it a numbered definition? |
| 597 | // Module constants occupy the lowest numbered slots... |
| 598 | if ((unsigned)D.Num < CurModule.Types.size()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 599 | return CurModule.Types[(unsigned)D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 600 | break; |
| 601 | case ValID::NameVal: // Is it a named definition? |
| 602 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 603 | D.destroy(); // Free old strdup'd memory... |
| 604 | return N; |
| 605 | } |
| 606 | break; |
| 607 | default: |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 608 | GenerateError("Internal parser error: Invalid symbol type reference!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 609 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 610 | } |
| 611 | |
| 612 | // If we reached here, we referenced either a symbol that we don't know about |
| 613 | // or an id number that hasn't been read yet. We may be referencing something |
| 614 | // forward, so just create an entry to be resolved later and get to it... |
| 615 | // |
| 616 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 617 | |
| 618 | |
| 619 | if (inFunctionScope()) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 620 | if (D.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 621 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 622 | return 0; |
| 623 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 624 | GenerateError("Reference to an undefined type: #" + itostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 625 | return 0; |
| 626 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 627 | } |
| 628 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 629 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 630 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 631 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 632 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 633 | Type *Typ = OpaqueType::get(); |
| 634 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 635 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 636 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 637 | |
| 638 | static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { |
| 639 | SymbolTable &SymTab = |
| 640 | inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : |
| 641 | CurModule.CurrentModule->getSymbolTable(); |
| 642 | return SymTab.lookup(Ty, Name); |
| 643 | } |
| 644 | |
| 645 | // getValNonImprovising - Look up the value specified by the provided type and |
| 646 | // the provided ValID. If the value exists and has already been defined, return |
| 647 | // it. Otherwise return null. |
| 648 | // |
| 649 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 650 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 651 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 652 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 653 | return 0; |
| 654 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 655 | |
| 656 | switch (D.Type) { |
| 657 | case ValID::NumberVal: { // Is it a numbered definition? |
| 658 | unsigned Num = (unsigned)D.Num; |
| 659 | |
| 660 | // Module constants occupy the lowest numbered slots... |
| 661 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 662 | if (VI != CurModule.Values.end()) { |
| 663 | if (Num < VI->second.size()) |
| 664 | return VI->second[Num]; |
| 665 | Num -= VI->second.size(); |
| 666 | } |
| 667 | |
| 668 | // Make sure that our type is within bounds |
| 669 | VI = CurFun.Values.find(Ty); |
| 670 | if (VI == CurFun.Values.end()) return 0; |
| 671 | |
| 672 | // Check that the number is within bounds... |
| 673 | if (VI->second.size() <= Num) return 0; |
| 674 | |
| 675 | return VI->second[Num]; |
| 676 | } |
| 677 | |
| 678 | case ValID::NameVal: { // Is it a named definition? |
| 679 | Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); |
| 680 | if (N == 0) return 0; |
| 681 | |
| 682 | D.destroy(); // Free old strdup'd memory... |
| 683 | return N; |
| 684 | } |
| 685 | |
| 686 | // Check to make sure that "Ty" is an integral type, and that our |
| 687 | // value will fit into the specified type... |
| 688 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 689 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 690 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 691 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 692 | Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 693 | return 0; |
| 694 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 695 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 696 | |
| 697 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 698 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 699 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 700 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 701 | "' is invalid or out of range!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 702 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 703 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 704 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 705 | } |
| 706 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 707 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 708 | } |
| 709 | |
| 710 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 711 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 712 | GenerateError("FP constant invalid for type!!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 713 | return 0; |
| 714 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 715 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 716 | |
| 717 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 718 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 719 | GenerateError("Cannot create a a non pointer null!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 720 | return 0; |
| 721 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 722 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 723 | |
| 724 | case ValID::ConstUndefVal: // Is it an undef value? |
| 725 | return UndefValue::get(Ty); |
| 726 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 727 | case ValID::ConstZeroVal: // Is it a zero value? |
| 728 | return Constant::getNullValue(Ty); |
| 729 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 730 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 731 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 732 | GenerateError("Constant expression type different from required type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 733 | return 0; |
| 734 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 735 | return D.ConstantValue; |
| 736 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 737 | case ValID::InlineAsmVal: { // Inline asm expression |
| 738 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 739 | const FunctionType *FTy = |
| 740 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 741 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 742 | GenerateError("Invalid type for asm constraint string!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 743 | return 0; |
| 744 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 745 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 746 | D.IAD->HasSideEffects); |
| 747 | D.destroy(); // Free InlineAsmDescriptor. |
| 748 | return IA; |
| 749 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 750 | default: |
| 751 | assert(0 && "Unhandled case!"); |
| 752 | return 0; |
| 753 | } // End of switch |
| 754 | |
| 755 | assert(0 && "Unhandled case!"); |
| 756 | return 0; |
| 757 | } |
| 758 | |
| 759 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 760 | // value is not already defined, it "improvises" by creating a placeholder var |
| 761 | // that looks and acts just like the requested variable. When the value is |
| 762 | // defined later, all uses of the placeholder variable are replaced with the |
| 763 | // real thing. |
| 764 | // |
| 765 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 766 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 767 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 768 | return 0; |
| 769 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 770 | |
| 771 | // See if the value has already been defined. |
| 772 | Value *V = getValNonImprovising(Ty, ID); |
| 773 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 774 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 775 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 776 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 777 | GenerateError("Invalid use of a composite type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 778 | return 0; |
| 779 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 780 | |
| 781 | // If we reached here, we referenced either a symbol that we don't know about |
| 782 | // or an id number that hasn't been read yet. We may be referencing something |
| 783 | // forward, so just create an entry to be resolved later and get to it... |
| 784 | // |
| 785 | V = new Argument(Ty); |
| 786 | |
| 787 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 788 | // to recycle these things?? |
| 789 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 790 | llvmAsmlineno))); |
| 791 | |
| 792 | if (inFunctionScope()) |
| 793 | InsertValue(V, CurFun.LateResolveValues); |
| 794 | else |
| 795 | InsertValue(V, CurModule.LateResolveValues); |
| 796 | return V; |
| 797 | } |
| 798 | |
| 799 | /// getBBVal - This is used for two purposes: |
| 800 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 801 | /// defined. |
| 802 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 803 | /// or may not be a forward reference. |
| 804 | /// |
| 805 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 806 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 807 | |
| 808 | std::string Name; |
| 809 | BasicBlock *BB = 0; |
| 810 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 811 | default: |
| 812 | GenerateError("Illegal label reference " + ID.getName()); |
| 813 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 814 | case ValID::NumberVal: // Is it a numbered definition? |
| 815 | if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) |
| 816 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 817 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 818 | break; |
| 819 | case ValID::NameVal: // Is it a named definition? |
| 820 | Name = ID.Name; |
| 821 | if (Value *N = CurFun.CurrentFunction-> |
| 822 | getSymbolTable().lookup(Type::LabelTy, Name)) |
| 823 | BB = cast<BasicBlock>(N); |
| 824 | break; |
| 825 | } |
| 826 | |
| 827 | // See if the block has already been defined. |
| 828 | if (BB) { |
| 829 | // If this is the definition of the block, make sure the existing value was |
| 830 | // just a forward reference. If it was a forward reference, there will be |
| 831 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 832 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 833 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 834 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 835 | return 0; |
| 836 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 837 | |
| 838 | ID.destroy(); // Free strdup'd memory. |
| 839 | return BB; |
| 840 | } |
| 841 | |
| 842 | // Otherwise this block has not been seen before. |
| 843 | BB = new BasicBlock("", CurFun.CurrentFunction); |
| 844 | if (ID.Type == ValID::NameVal) { |
| 845 | BB->setName(ID.Name); |
| 846 | } else { |
| 847 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 848 | } |
| 849 | |
| 850 | // If this is not a definition, keep track of it so we can use it as a forward |
| 851 | // reference. |
| 852 | if (!isDefinition) { |
| 853 | // Remember where this forward reference came from. |
| 854 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 855 | } else { |
| 856 | // The forward declaration could have been inserted anywhere in the |
| 857 | // function: insert it into the correct place now. |
| 858 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 859 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 860 | } |
| 861 | ID.destroy(); |
| 862 | return BB; |
| 863 | } |
| 864 | |
| 865 | |
| 866 | //===----------------------------------------------------------------------===// |
| 867 | // Code to handle forward references in instructions |
| 868 | //===----------------------------------------------------------------------===// |
| 869 | // |
| 870 | // This code handles the late binding needed with statements that reference |
| 871 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 872 | // a loop body. |
| 873 | // |
| 874 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 875 | // and back patchs after we are done. |
| 876 | // |
| 877 | |
| 878 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 879 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 880 | // defs now... |
| 881 | // |
| 882 | static void |
| 883 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 884 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 885 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 886 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 887 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 888 | ValueList &List = LRI->second; |
| 889 | while (!List.empty()) { |
| 890 | Value *V = List.back(); |
| 891 | List.pop_back(); |
| 892 | |
| 893 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 894 | CurModule.PlaceHolderInfo.find(V); |
| 895 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 896 | |
| 897 | ValID &DID = PHI->second.first; |
| 898 | |
| 899 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 900 | if (TriggerError) |
| 901 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 902 | if (TheRealValue) { |
| 903 | V->replaceAllUsesWith(TheRealValue); |
| 904 | delete V; |
| 905 | CurModule.PlaceHolderInfo.erase(PHI); |
| 906 | } else if (FutureLateResolvers) { |
| 907 | // Functions have their unresolved items forwarded to the module late |
| 908 | // resolver table |
| 909 | InsertValue(V, *FutureLateResolvers); |
| 910 | } else { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 911 | if (DID.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 912 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 913 | "' of type '" + V->getType()->getDescription() + "'", |
| 914 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 915 | return; |
| 916 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 917 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 918 | itostr(DID.Num) + " of type '" + |
| 919 | V->getType()->getDescription() + "'", |
| 920 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 921 | return; |
| 922 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 923 | } |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | LateResolvers.clear(); |
| 928 | } |
| 929 | |
| 930 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 931 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 932 | // refering to the number can be resolved. Do this now. |
| 933 | // |
| 934 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 935 | ValID D; |
| 936 | if (Name) D = ValID::create(Name); |
| 937 | else D = ValID::create((int)CurModule.Types.size()); |
| 938 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 939 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 940 | CurModule.LateResolveTypes.find(D); |
| 941 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 942 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 943 | CurModule.LateResolveTypes.erase(I); |
| 944 | } |
| 945 | } |
| 946 | |
| 947 | // setValueName - Set the specified value to the name given. The name may be |
| 948 | // null potentially, in which case this is a noop. The string passed in is |
| 949 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 950 | // |
| 951 | static void setValueName(Value *V, char *NameStr) { |
| 952 | if (NameStr) { |
| 953 | std::string Name(NameStr); // Copy string |
| 954 | free(NameStr); // Free old string |
| 955 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 956 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 957 | GenerateError("Can't assign name '" + Name+"' to value with void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 958 | return; |
| 959 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 960 | |
| 961 | assert(inFunctionScope() && "Must be in function scope!"); |
| 962 | SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 963 | if (ST.lookup(V->getType(), Name)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 964 | GenerateError("Redefinition of value named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 965 | V->getType()->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 966 | return; |
| 967 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 968 | |
| 969 | // Set the name. |
| 970 | V->setName(Name); |
| 971 | } |
| 972 | } |
| 973 | |
| 974 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 975 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 976 | static GlobalVariable * |
| 977 | ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, |
| 978 | bool isConstantGlobal, const Type *Ty, |
| 979 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 980 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 981 | GenerateError("Cannot declare global vars of function type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 982 | return 0; |
| 983 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 984 | |
| 985 | const PointerType *PTy = PointerType::get(Ty); |
| 986 | |
| 987 | std::string Name; |
| 988 | if (NameStr) { |
| 989 | Name = NameStr; // Copy string |
| 990 | free(NameStr); // Free old string |
| 991 | } |
| 992 | |
| 993 | // See if this global value was forward referenced. If so, recycle the |
| 994 | // object. |
| 995 | ValID ID; |
| 996 | if (!Name.empty()) { |
| 997 | ID = ValID::create((char*)Name.c_str()); |
| 998 | } else { |
| 999 | ID = ValID::create((int)CurModule.Values[PTy].size()); |
| 1000 | } |
| 1001 | |
| 1002 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1003 | // Move the global to the end of the list, from whereever it was |
| 1004 | // previously inserted. |
| 1005 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1006 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1007 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1008 | GV->setInitializer(Initializer); |
| 1009 | GV->setLinkage(Linkage); |
| 1010 | GV->setConstant(isConstantGlobal); |
| 1011 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1012 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | // If this global has a name, check to see if there is already a definition |
| 1016 | // of this global in the module. If so, merge as appropriate. Note that |
| 1017 | // this is really just a hack around problems in the CFE. :( |
| 1018 | if (!Name.empty()) { |
| 1019 | // We are a simple redefinition of a value, check to see if it is defined |
| 1020 | // the same as the old one. |
| 1021 | if (GlobalVariable *EGV = |
| 1022 | CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
| 1023 | // We are allowed to redefine a global variable in two circumstances: |
| 1024 | // 1. If at least one of the globals is uninitialized or |
| 1025 | // 2. If both initializers have the same value. |
| 1026 | // |
| 1027 | if (!EGV->hasInitializer() || !Initializer || |
| 1028 | EGV->getInitializer() == Initializer) { |
| 1029 | |
| 1030 | // Make sure the existing global version gets the initializer! Make |
| 1031 | // sure that it also gets marked const if the new version is. |
| 1032 | if (Initializer && !EGV->hasInitializer()) |
| 1033 | EGV->setInitializer(Initializer); |
| 1034 | if (isConstantGlobal) |
| 1035 | EGV->setConstant(true); |
| 1036 | EGV->setLinkage(Linkage); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1037 | return EGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1038 | } |
| 1039 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1040 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1041 | "' in the '" + Ty->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1042 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1043 | } |
| 1044 | } |
| 1045 | |
| 1046 | // Otherwise there is no existing GV to use, create one now. |
| 1047 | GlobalVariable *GV = |
| 1048 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1049 | CurModule.CurrentModule); |
| 1050 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1051 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1052 | } |
| 1053 | |
| 1054 | // setTypeName - Set the specified type to the name given. The name may be |
| 1055 | // null potentially, in which case this is a noop. The string passed in is |
| 1056 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1057 | // |
| 1058 | // This function returns true if the type has already been defined, but is |
| 1059 | // allowed to be redefined in the specified context. If the name is a new name |
| 1060 | // for the type plane, it is inserted and false is returned. |
| 1061 | static bool setTypeName(const Type *T, char *NameStr) { |
| 1062 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 1063 | if (NameStr == 0) return false; |
| 1064 | |
| 1065 | std::string Name(NameStr); // Copy string |
| 1066 | free(NameStr); // Free old string |
| 1067 | |
| 1068 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1069 | if (T == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1070 | GenerateError("Can't assign name '" + Name + "' to the void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1071 | return false; |
| 1072 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1073 | |
| 1074 | // Set the type name, checking for conflicts as we do so. |
| 1075 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1076 | |
| 1077 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1078 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1079 | assert(Existing && "Conflict but no matching type?"); |
| 1080 | |
| 1081 | // There is only one case where this is allowed: when we are refining an |
| 1082 | // opaque type. In this case, Existing will be an opaque type. |
| 1083 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1084 | // We ARE replacing an opaque type! |
| 1085 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1086 | return true; |
| 1087 | } |
| 1088 | |
| 1089 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1090 | // the redefinition is identical to the original. This will be so if |
| 1091 | // Existing and T point to the same Type object. In this one case we |
| 1092 | // allow the equivalent redefinition. |
| 1093 | if (Existing == T) return true; // Yes, it's equal. |
| 1094 | |
| 1095 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1096 | GenerateError("Redefinition of type named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1097 | T->getDescription() + "' type plane!"); |
| 1098 | } |
| 1099 | |
| 1100 | return false; |
| 1101 | } |
| 1102 | |
| 1103 | //===----------------------------------------------------------------------===// |
| 1104 | // Code for handling upreferences in type names... |
| 1105 | // |
| 1106 | |
| 1107 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1108 | // |
| 1109 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1110 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1111 | E) != Ty->subtype_end(); |
| 1112 | } |
| 1113 | |
| 1114 | namespace { |
| 1115 | struct UpRefRecord { |
| 1116 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1117 | // this type is resolved. |
| 1118 | unsigned NestingLevel; |
| 1119 | |
| 1120 | // LastContainedTy - This is the type at the current binding level for the |
| 1121 | // type. Every time we reduce the nesting level, this gets updated. |
| 1122 | const Type *LastContainedTy; |
| 1123 | |
| 1124 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1125 | // represented with. |
| 1126 | OpaqueType *UpRefTy; |
| 1127 | |
| 1128 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1129 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1130 | }; |
| 1131 | } |
| 1132 | |
| 1133 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1134 | static std::vector<UpRefRecord> UpRefs; |
| 1135 | |
| 1136 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1137 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1138 | /// currently active types. For each type, if the up reference is contained in |
| 1139 | /// the newly completed type, we decrement the level count. When the level |
| 1140 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1141 | /// thus we can complete the cycle. |
| 1142 | /// |
| 1143 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1144 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1145 | // nothing to resolve here. |
| 1146 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1147 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1148 | PATypeHolder Ty(ty); |
| 1149 | UR_OUT("Type '" << Ty->getDescription() << |
| 1150 | "' newly formed. Resolving upreferences.\n" << |
| 1151 | UpRefs.size() << " upreferences active!\n"); |
| 1152 | |
| 1153 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1154 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1155 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1156 | // this variable. |
| 1157 | OpaqueType *TypeToResolve = 0; |
| 1158 | |
| 1159 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1160 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1161 | << UpRefs[i].second->getDescription() << ") = " |
| 1162 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1163 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1164 | // Decrement level of upreference |
| 1165 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1166 | UpRefs[i].LastContainedTy = Ty; |
| 1167 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1168 | if (Level == 0) { // Upreference should be resolved! |
| 1169 | if (!TypeToResolve) { |
| 1170 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1171 | } else { |
| 1172 | UR_OUT(" * Resolving upreference for " |
| 1173 | << UpRefs[i].second->getDescription() << "\n"; |
| 1174 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1175 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1176 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1177 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1178 | } |
| 1179 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1180 | --i; // Do not skip the next element... |
| 1181 | } |
| 1182 | } |
| 1183 | } |
| 1184 | |
| 1185 | if (TypeToResolve) { |
| 1186 | UR_OUT(" * Resolving upreference for " |
| 1187 | << UpRefs[i].second->getDescription() << "\n"; |
| 1188 | std::string OldName = TypeToResolve->getDescription()); |
| 1189 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1190 | } |
| 1191 | |
| 1192 | return Ty; |
| 1193 | } |
| 1194 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1195 | //===----------------------------------------------------------------------===// |
| 1196 | // RunVMAsmParser - Define an interface to this parser |
| 1197 | //===----------------------------------------------------------------------===// |
| 1198 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1199 | static Module* RunParser(Module * M); |
| 1200 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1201 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1202 | set_scan_file(F); |
| 1203 | |
| 1204 | CurFilename = Filename; |
| 1205 | return RunParser(new Module(CurFilename)); |
| 1206 | } |
| 1207 | |
| 1208 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1209 | set_scan_string(AsmString); |
| 1210 | |
| 1211 | CurFilename = "from_memory"; |
| 1212 | if (M == NULL) { |
| 1213 | return RunParser(new Module (CurFilename)); |
| 1214 | } else { |
| 1215 | return RunParser(M); |
| 1216 | } |
| 1217 | } |
| 1218 | |
| 1219 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1220 | |
| 1221 | /* Enabling traces. */ |
| 1222 | #ifndef YYDEBUG |
| 1223 | # define YYDEBUG 0 |
| 1224 | #endif |
| 1225 | |
| 1226 | /* Enabling verbose error messages. */ |
| 1227 | #ifdef YYERROR_VERBOSE |
| 1228 | # undef YYERROR_VERBOSE |
| 1229 | # define YYERROR_VERBOSE 1 |
| 1230 | #else |
| 1231 | # define YYERROR_VERBOSE 0 |
| 1232 | #endif |
| 1233 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1234 | /* Enabling the token table. */ |
| 1235 | #ifndef YYTOKEN_TABLE |
| 1236 | # define YYTOKEN_TABLE 0 |
| 1237 | #endif |
| 1238 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1239 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 1240 | #line 895 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1241 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1242 | llvm::Module *ModuleVal; |
| 1243 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1244 | llvm::BasicBlock *BasicBlockVal; |
| 1245 | llvm::TerminatorInst *TermInstVal; |
| 1246 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1247 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1248 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1249 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1250 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1251 | llvm::PATypeHolder *TypeVal; |
| 1252 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1253 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1254 | llvm::ArgListType *ArgList; |
| 1255 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1256 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1257 | llvm::ValueRefList *ValueRefList; |
| 1258 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1259 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1260 | std::list<std::pair<llvm::Value*, |
| 1261 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1262 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1263 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1264 | |
| 1265 | llvm::GlobalValue::LinkageTypes Linkage; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1266 | llvm::FunctionType::ParameterAttributes ParamAttrs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1267 | int64_t SInt64Val; |
| 1268 | uint64_t UInt64Val; |
| 1269 | int SIntVal; |
| 1270 | unsigned UIntVal; |
| 1271 | double FPVal; |
| 1272 | bool BoolVal; |
| 1273 | |
| 1274 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1275 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1276 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1277 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1278 | llvm::Instruction::TermOps TermOpVal; |
| 1279 | llvm::Instruction::MemoryOps MemOpVal; |
| 1280 | llvm::Instruction::CastOps CastOpVal; |
| 1281 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1282 | llvm::Module::Endianness Endianness; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1283 | llvm::ICmpInst::Predicate IPredicate; |
| 1284 | llvm::FCmpInst::Predicate FPredicate; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1285 | } YYSTYPE; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1286 | /* Line 196 of yacc.c. */ |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 1287 | #line 1288 "llvmAsmParser.tab.c" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1288 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1289 | # define YYSTYPE_IS_DECLARED 1 |
| 1290 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1291 | #endif |
| 1292 | |
| 1293 | |
| 1294 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1295 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1296 | |
| 1297 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1298 | /* Line 219 of yacc.c. */ |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 1299 | #line 1300 "llvmAsmParser.tab.c" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1300 | |
| 1301 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1302 | # define YYSIZE_T __SIZE_TYPE__ |
| 1303 | #endif |
| 1304 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1305 | # define YYSIZE_T size_t |
| 1306 | #endif |
| 1307 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1308 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1309 | # define YYSIZE_T size_t |
| 1310 | #endif |
| 1311 | #if ! defined (YYSIZE_T) |
| 1312 | # define YYSIZE_T unsigned int |
| 1313 | #endif |
| 1314 | |
| 1315 | #ifndef YY_ |
| 1316 | # if YYENABLE_NLS |
| 1317 | # if ENABLE_NLS |
| 1318 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1319 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1320 | # endif |
| 1321 | # endif |
| 1322 | # ifndef YY_ |
| 1323 | # define YY_(msgid) msgid |
| 1324 | # endif |
| 1325 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1326 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1327 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 1328 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1329 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1330 | |
| 1331 | # ifdef YYSTACK_USE_ALLOCA |
| 1332 | # if YYSTACK_USE_ALLOCA |
| 1333 | # ifdef __GNUC__ |
| 1334 | # define YYSTACK_ALLOC __builtin_alloca |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1335 | # else |
| 1336 | # define YYSTACK_ALLOC alloca |
| 1337 | # if defined (__STDC__) || defined (__cplusplus) |
| 1338 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1339 | # define YYINCLUDED_STDLIB_H |
| 1340 | # endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1341 | # endif |
| 1342 | # endif |
| 1343 | # endif |
| 1344 | |
| 1345 | # ifdef YYSTACK_ALLOC |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1346 | /* Pacify GCC's `empty if-body' warning. */ |
| 1347 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1348 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1349 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1350 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1351 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1352 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1353 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1354 | # endif |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1355 | # else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1356 | # define YYSTACK_ALLOC YYMALLOC |
| 1357 | # define YYSTACK_FREE YYFREE |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1358 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1359 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1360 | # endif |
| 1361 | # ifdef __cplusplus |
| 1362 | extern "C" { |
| 1363 | # endif |
| 1364 | # ifndef YYMALLOC |
| 1365 | # define YYMALLOC malloc |
| 1366 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1367 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1368 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1369 | # endif |
| 1370 | # endif |
| 1371 | # ifndef YYFREE |
| 1372 | # define YYFREE free |
| 1373 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1374 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1375 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1376 | # endif |
| 1377 | # endif |
| 1378 | # ifdef __cplusplus |
| 1379 | } |
| 1380 | # endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1381 | # endif |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1382 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1383 | |
| 1384 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1385 | #if (! defined (yyoverflow) \ |
| 1386 | && (! defined (__cplusplus) \ |
| 1387 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1388 | |
| 1389 | /* A type that is properly aligned for any stack member. */ |
| 1390 | union yyalloc |
| 1391 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1392 | short int yyss; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1393 | YYSTYPE yyvs; |
| 1394 | }; |
| 1395 | |
| 1396 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1397 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1398 | |
| 1399 | /* The size of an array large to enough to hold all stacks, each with |
| 1400 | N elements. */ |
| 1401 | # define YYSTACK_BYTES(N) \ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1402 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1403 | + YYSTACK_GAP_MAXIMUM) |
| 1404 | |
| 1405 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1406 | not overlap. */ |
| 1407 | # ifndef YYCOPY |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1408 | # if defined (__GNUC__) && 1 < __GNUC__ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1409 | # define YYCOPY(To, From, Count) \ |
| 1410 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1411 | # else |
| 1412 | # define YYCOPY(To, From, Count) \ |
| 1413 | do \ |
| 1414 | { \ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1415 | YYSIZE_T yyi; \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1416 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1417 | (To)[yyi] = (From)[yyi]; \ |
| 1418 | } \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1419 | while (0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1420 | # endif |
| 1421 | # endif |
| 1422 | |
| 1423 | /* Relocate STACK from its old location to the new one. The |
| 1424 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1425 | elements in the stack, and YYPTR gives the new location of the |
| 1426 | stack. Advance YYPTR to a properly aligned location for the next |
| 1427 | stack. */ |
| 1428 | # define YYSTACK_RELOCATE(Stack) \ |
| 1429 | do \ |
| 1430 | { \ |
| 1431 | YYSIZE_T yynewbytes; \ |
| 1432 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1433 | Stack = &yyptr->Stack; \ |
| 1434 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1435 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1436 | } \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1437 | while (0) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 1438 | |
| 1439 | #endif |
| 1440 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1441 | #if defined (__STDC__) || defined (__cplusplus) |
| 1442 | typedef signed char yysigned_char; |
| 1443 | #else |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1444 | typedef short int yysigned_char; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1445 | #endif |
| 1446 | |
| 1447 | /* YYFINAL -- State number of the termination state. */ |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 1448 | #define YYFINAL 37 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1449 | /* YYLAST -- Last index in YYTABLE. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1450 | #define YYLAST 1503 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1451 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1452 | /* YYNTOKENS -- Number of terminals. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1453 | #define YYNTOKENS 150 |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1454 | /* YYNNTS -- Number of nonterminals. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1455 | #define YYNNTS 77 |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1456 | /* YYNRULES -- Number of rules. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1457 | #define YYNRULES 288 |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1458 | /* YYNRULES -- Number of states. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1459 | #define YYNSTATES 572 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1460 | |
| 1461 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1462 | #define YYUNDEFTOK 2 |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1463 | #define YYMAXUTOK 389 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1464 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1465 | #define YYTRANSLATE(YYX) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1466 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1467 | |
| 1468 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1469 | static const unsigned char yytranslate[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1470 | { |
| 1471 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1475 | 138, 139, 140, 2, 136, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1477 | 145, 135, 146, 2, 137, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1478 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1479 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1480 | 2, 142, 141, 144, 2, 2, 2, 2, 2, 149, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1481 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1482 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1483 | 143, 2, 2, 147, 2, 148, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1484 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1485 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1486 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1487 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1488 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1489 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1490 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1491 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1492 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1493 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1494 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1495 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1496 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1497 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1498 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1499 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1500 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1501 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1502 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1503 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1504 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1505 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1506 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1507 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1508 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1509 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1510 | }; |
| 1511 | |
| 1512 | #if YYDEBUG |
| 1513 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1514 | YYRHS. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1515 | static const unsigned short int yyprhs[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1516 | { |
| 1517 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1518 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1519 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1520 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1521 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1522 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1523 | 119, 121, 123, 125, 128, 129, 131, 133, 135, 137, |
| 1524 | 139, 141, 143, 145, 146, 148, 150, 151, 153, 155, |
| 1525 | 157, 159, 160, 162, 164, 166, 168, 170, 172, 175, |
| 1526 | 177, 179, 181, 185, 186, 189, 194, 195, 198, 199, |
| 1527 | 203, 206, 207, 209, 210, 214, 216, 219, 221, 223, |
| 1528 | 225, 227, 229, 231, 233, 235, 237, 239, 242, 244, |
| 1529 | 247, 253, 259, 265, 271, 275, 278, 284, 289, 292, |
| 1530 | 295, 298, 300, 304, 306, 310, 312, 313, 315, 319, |
| 1531 | 324, 328, 332, 337, 342, 346, 349, 352, 355, 358, |
| 1532 | 361, 364, 367, 370, 373, 376, 383, 389, 398, 405, |
| 1533 | 412, 420, 428, 435, 442, 451, 460, 464, 466, 468, |
| 1534 | 470, 472, 473, 475, 478, 479, 483, 484, 488, 492, |
| 1535 | 494, 498, 502, 503, 509, 510, 517, 518, 525, 528, |
| 1536 | 532, 534, 536, 538, 542, 546, 550, 554, 558, 562, |
| 1537 | 564, 565, 567, 569, 571, 572, 578, 582, 584, 588, |
| 1538 | 590, 591, 600, 602, 604, 608, 610, 612, 615, 618, |
| 1539 | 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, |
| 1540 | 641, 643, 649, 651, 653, 655, 657, 660, 663, 666, |
| 1541 | 670, 673, 674, 676, 679, 682, 686, 696, 706, 715, |
| 1542 | 729, 731, 733, 740, 746, 749, 756, 764, 768, 774, |
| 1543 | 775, 776, 780, 783, 785, 791, 797, 804, 811, 814, |
| 1544 | 819, 824, 831, 836, 841, 848, 855, 858, 866, 868, |
| 1545 | 870, 871, 875, 882, 886, 893, 896, 901, 908 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1546 | }; |
| 1547 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1548 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1549 | static const short int yyrhs[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1550 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1551 | 186, 0, -1, 5, -1, 6, -1, 74, -1, 75, |
| 1552 | -1, 76, -1, 77, -1, 78, -1, 79, -1, 80, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 1553 | -1, 81, -1, 82, -1, 83, -1, 84, -1, 85, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1554 | -1, 114, -1, 115, -1, 116, -1, 117, -1, 118, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 1555 | -1, 119, -1, 120, -1, 121, -1, 122, -1, 123, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1556 | -1, 124, -1, 125, -1, 128, -1, 129, -1, 130, |
| 1557 | -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 1558 | -1, 93, -1, 94, -1, 95, -1, 96, -1, 97, |
| 1559 | -1, 98, -1, 99, -1, 100, -1, 101, -1, 102, |
| 1560 | -1, 103, -1, 104, -1, 105, -1, 106, -1, 107, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1561 | -1, 94, -1, 95, -1, 96, -1, 97, -1, 23, |
| 1562 | -1, 24, -1, 13, -1, 12, -1, 11, -1, 10, |
| 1563 | -1, 14, -1, 15, -1, 199, 135, -1, -1, 37, |
| 1564 | -1, 39, -1, 38, -1, 40, -1, 42, -1, 41, |
| 1565 | -1, 43, -1, 46, -1, -1, 41, -1, 43, -1, |
| 1566 | -1, 37, -1, 38, -1, 39, -1, 42, -1, -1, |
| 1567 | 61, -1, 62, -1, 63, -1, 64, -1, 65, -1, |
| 1568 | 66, -1, 60, 4, -1, 115, -1, 116, -1, 166, |
| 1569 | -1, 167, 136, 166, -1, -1, 137, 166, -1, 137, |
| 1570 | 138, 167, 139, -1, -1, 53, 4, -1, -1, 136, |
| 1571 | 53, 4, -1, 31, 20, -1, -1, 171, -1, -1, |
| 1572 | 136, 174, 173, -1, 171, -1, 53, 4, -1, 9, |
| 1573 | -1, 10, -1, 11, -1, 12, -1, 13, -1, 14, |
| 1574 | -1, 15, -1, 16, -1, 44, -1, 175, -1, 176, |
| 1575 | 140, -1, 211, -1, 141, 4, -1, 176, 168, 138, |
| 1576 | 180, 139, -1, 8, 168, 138, 180, 139, -1, 142, |
| 1577 | 4, 143, 176, 144, -1, 145, 4, 143, 176, 146, |
| 1578 | -1, 147, 181, 148, -1, 147, 148, -1, 145, 147, |
| 1579 | 181, 148, 146, -1, 145, 147, 148, 146, -1, 176, |
| 1580 | 168, -1, 176, 168, -1, 8, 168, -1, 177, -1, |
| 1581 | 179, 136, 177, -1, 179, -1, 179, 136, 34, -1, |
| 1582 | 34, -1, -1, 176, -1, 181, 136, 176, -1, 176, |
| 1583 | 142, 184, 144, -1, 176, 142, 144, -1, 176, 149, |
| 1584 | 20, -1, 176, 145, 184, 146, -1, 176, 147, 184, |
| 1585 | 148, -1, 176, 147, 148, -1, 176, 35, -1, 176, |
| 1586 | 36, -1, 176, 211, -1, 176, 183, -1, 176, 22, |
| 1587 | -1, 158, 3, -1, 158, 4, -1, 9, 23, -1, |
| 1588 | 9, 24, -1, 159, 7, -1, 154, 138, 182, 33, |
| 1589 | 176, 139, -1, 113, 138, 182, 222, 139, -1, 127, |
| 1590 | 138, 182, 136, 182, 136, 182, 139, -1, 152, 138, |
| 1591 | 182, 136, 182, 139, -1, 153, 138, 182, 136, 182, |
| 1592 | 139, -1, 86, 156, 138, 182, 136, 182, 139, -1, |
| 1593 | 87, 157, 138, 182, 136, 182, 139, -1, 155, 138, |
| 1594 | 182, 136, 182, 139, -1, 132, 138, 182, 136, 182, |
| 1595 | 139, -1, 133, 138, 182, 136, 182, 136, 182, 139, |
| 1596 | -1, 134, 138, 182, 136, 182, 136, 182, 139, -1, |
| 1597 | 184, 136, 182, -1, 182, -1, 29, -1, 30, -1, |
| 1598 | 187, -1, -1, 188, -1, 187, 188, -1, -1, 28, |
| 1599 | 189, 207, -1, -1, 27, 190, 208, -1, 58, 57, |
| 1600 | 194, -1, 21, -1, 160, 17, 176, -1, 160, 17, |
| 1601 | 8, -1, -1, 160, 185, 182, 191, 173, -1, -1, |
| 1602 | 160, 161, 185, 182, 192, 173, -1, -1, 160, 162, |
| 1603 | 185, 176, 193, 173, -1, 47, 196, -1, 54, 135, |
| 1604 | 197, -1, 20, -1, 52, -1, 51, -1, 49, 135, |
| 1605 | 195, -1, 50, 135, 4, -1, 48, 135, 20, -1, |
| 1606 | 67, 135, 20, -1, 142, 198, 144, -1, 198, 136, |
| 1607 | 20, -1, 20, -1, -1, 18, -1, 20, -1, 199, |
| 1608 | -1, -1, 201, 136, 176, 168, 200, -1, 176, 168, |
| 1609 | 200, -1, 201, -1, 201, 136, 34, -1, 34, -1, |
| 1610 | -1, 165, 178, 199, 138, 202, 139, 172, 169, -1, |
| 1611 | 25, -1, 147, -1, 164, 203, 204, -1, 26, -1, |
| 1612 | 148, -1, 214, 206, -1, 163, 203, -1, -1, 59, |
| 1613 | -1, 3, -1, 4, -1, 7, -1, 23, -1, 24, |
| 1614 | -1, 35, -1, 36, -1, 22, -1, 145, 184, 146, |
| 1615 | -1, 183, -1, 57, 209, 20, 136, 20, -1, 151, |
| 1616 | -1, 199, -1, 211, -1, 210, -1, 176, 212, -1, |
| 1617 | 214, 215, -1, 205, 215, -1, 216, 160, 217, -1, |
| 1618 | 216, 219, -1, -1, 19, -1, 68, 213, -1, 68, |
| 1619 | 8, -1, 69, 16, 212, -1, 69, 9, 212, 136, |
| 1620 | 16, 212, 136, 16, 212, -1, 70, 158, 212, 136, |
| 1621 | 16, 212, 142, 218, 144, -1, 70, 158, 212, 136, |
| 1622 | 16, 212, 142, 144, -1, 71, 165, 178, 212, 138, |
| 1623 | 221, 139, 33, 16, 212, 72, 16, 212, -1, 72, |
| 1624 | -1, 73, -1, 218, 158, 210, 136, 16, 212, -1, |
| 1625 | 158, 210, 136, 16, 212, -1, 160, 224, -1, 176, |
| 1626 | 142, 212, 136, 212, 144, -1, 220, 136, 142, 212, |
| 1627 | 136, 212, 144, -1, 176, 212, 168, -1, 221, 136, |
| 1628 | 176, 212, 168, -1, -1, -1, 222, 136, 213, -1, |
| 1629 | 56, 55, -1, 55, -1, 152, 176, 212, 136, 212, |
| 1630 | -1, 153, 176, 212, 136, 212, -1, 86, 156, 176, |
| 1631 | 212, 136, 212, -1, 87, 157, 176, 212, 136, 212, |
| 1632 | -1, 45, 213, -1, 155, 213, 136, 213, -1, 154, |
| 1633 | 213, 33, 176, -1, 127, 213, 136, 213, 136, 213, |
| 1634 | -1, 131, 213, 136, 176, -1, 132, 213, 136, 213, |
| 1635 | -1, 133, 213, 136, 213, 136, 213, -1, 134, 213, |
| 1636 | 136, 213, 136, 213, -1, 126, 220, -1, 223, 165, |
| 1637 | 178, 212, 138, 221, 139, -1, 226, -1, 32, -1, |
| 1638 | -1, 108, 176, 170, -1, 108, 176, 136, 12, 212, |
| 1639 | 170, -1, 109, 176, 170, -1, 109, 176, 136, 12, |
| 1640 | 212, 170, -1, 110, 213, -1, 225, 111, 176, 212, |
| 1641 | -1, 225, 112, 213, 136, 176, 212, -1, 113, 176, |
| 1642 | 212, 222, -1 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1643 | }; |
| 1644 | |
| 1645 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1646 | static const unsigned short int yyrline[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1647 | { |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 1648 | 0, 1035, 1035, 1036, 1046, 1046, 1046, 1046, 1046, 1046, |
| 1649 | 1046, 1046, 1046, 1047, 1047, 1047, 1048, 1048, 1048, 1048, |
| 1650 | 1048, 1048, 1049, 1049, 1049, 1049, 1049, 1049, 1050, 1050, |
| 1651 | 1050, 1052, 1052, 1053, 1053, 1054, 1054, 1055, 1055, 1056, |
| 1652 | 1056, 1060, 1060, 1061, 1061, 1062, 1062, 1063, 1063, 1064, |
| 1653 | 1064, 1065, 1065, 1066, 1066, 1067, 1068, 1073, 1073, 1073, |
| 1654 | 1073, 1074, 1074, 1077, 1081, 1087, 1088, 1089, 1090, 1091, |
| 1655 | 1095, 1096, 1097, 1101, 1102, 1103, 1107, 1108, 1109, 1110, |
| 1656 | 1111, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1128, |
| 1657 | 1129, 1132, 1133, 1138, 1139, 1140, 1145, 1146, 1152, 1153, |
| 1658 | 1161, 1169, 1170, 1175, 1176, 1177, 1182, 1195, 1195, 1195, |
| 1659 | 1195, 1195, 1195, 1195, 1195, 1198, 1202, 1206, 1213, 1218, |
| 1660 | 1226, 1244, 1262, 1267, 1279, 1289, 1293, 1303, 1310, 1317, |
| 1661 | 1325, 1331, 1336, 1343, 1344, 1351, 1358, 1366, 1371, 1382, |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 1662 | 1410, 1426, 1455, 1483, 1504, 1519, 1531, 1538, 1601, 1611, |
| 1663 | 1621, 1627, 1633, 1637, 1641, 1649, 1663, 1684, 1692, 1698, |
| 1664 | 1709, 1714, 1719, 1728, 1734, 1740, 1749, 1753, 1761, 1761, |
| 1665 | 1772, 1777, 1785, 1786, 1790, 1790, 1794, 1794, 1797, 1800, |
| 1666 | 1812, 1836, 1847, 1847, 1856, 1856, 1864, 1864, 1874, 1877, |
| 1667 | 1883, 1896, 1897, 1899, 1903, 1912, 1916, 1921, 1923, 1928, |
| 1668 | 1933, 1942, 1942, 1943, 1943, 1945, 1955, 1966, 1970, 1979, |
| 1669 | 1988, 1993, 2098, 2098, 2100, 2108, 2108, 2110, 2115, 2126, |
| 1670 | 2130, 2135, 2139, 2143, 2147, 2151, 2155, 2159, 2163, 2167, |
| 1671 | 2192, 2196, 2210, 2214, 2220, 2220, 2226, 2235, 2239, 2248, |
| 1672 | 2259, 2268, 2280, 2293, 2297, 2301, 2306, 2315, 2334, 2343, |
| 1673 | 2410, 2414, 2421, 2432, 2445, 2454, 2465, 2475, 2483, 2491, |
| 1674 | 2494, 2495, 2502, 2506, 2511, 2532, 2549, 2560, 2571, 2584, |
| 1675 | 2593, 2606, 2614, 2621, 2627, 2633, 2639, 2654, 2716, 2721, |
| 1676 | 2725, 2732, 2739, 2747, 2754, 2762, 2770, 2784, 2801 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1677 | }; |
| 1678 | #endif |
| 1679 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1680 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1681 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1682 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1683 | static const char *const yytname[] = |
| 1684 | { |
| 1685 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1686 | "UINTVAL", "FPVAL", "VOID", "BOOL", "INT8", "INT16", "INT32", "INT64", |
| 1687 | "FLOAT", "DOUBLE", "LABEL", "TYPE", "VAR_ID", "LABELSTR", |
| 1688 | "STRINGCONSTANT", "IMPLEMENTATION", "ZEROINITIALIZER", "TRUETOK", |
| 1689 | "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", |
| 1690 | "CONSTANT", "SECTION", "VOLATILE", "TO", "DOTDOTDOT", "NULL_TOK", |
| 1691 | "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT", |
| 1692 | "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "NOT", "EXTERNAL", "TARGET", |
| 1693 | "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS", |
| 1694 | "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", |
| 1695 | "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", |
| 1696 | "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", |
| 1697 | "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", |
| 1698 | "UREM", "SREM", "FREM", "AND", "OR", "XOR", "ICMP", "FCMP", "EQ", "NE", |
| 1699 | "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", |
| 1700 | "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", |
| 1701 | "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", |
| 1702 | "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", |
| 1703 | "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR", |
| 1704 | "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
| 1705 | "'='", "','", "'@'", "'('", "')'", "'*'", "'\\\\'", "'['", "'x'", "']'", |
| 1706 | "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "INTVAL", "ArithmeticOps", |
| 1707 | "LogicalOps", "CastOps", "ShiftOps", "IPredicates", "FPredicates", |
| 1708 | "IntType", "FPType", "OptAssign", "GVInternalLinkage", |
| 1709 | "GVExternalLinkage", "FunctionDeclareLinkage", "FunctionDefineLinkage", |
| 1710 | "OptCallingConv", "ParamAttr", "ParamAttrList", "OptParamAttrs", |
| 1711 | "OptAlign", "OptCAlign", "SectionString", "OptSection", |
| 1712 | "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", |
| 1713 | "ArgType", "ResultType", "ArgTypeList", "ArgTypeListI", "TypeListI", |
| 1714 | "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module", |
| 1715 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1716 | "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList", |
| 1717 | "Name", "OptName", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 1718 | "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect", |
| 1719 | "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", |
| 1720 | "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1721 | "JumpTable", "Inst", "PHIList", "ValueRefList", "IndexList", |
| 1722 | "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1723 | }; |
| 1724 | #endif |
| 1725 | |
| 1726 | # ifdef YYPRINT |
| 1727 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1728 | token YYLEX-NUM. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1729 | static const unsigned short int yytoknum[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1730 | { |
| 1731 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1732 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1733 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1734 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1735 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1736 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1737 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1738 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1739 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1740 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1741 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1742 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1743 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1744 | 385, 386, 387, 388, 389, 61, 44, 64, 40, 41, |
| 1745 | 42, 92, 91, 120, 93, 60, 62, 123, 125, 99 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1746 | }; |
| 1747 | # endif |
| 1748 | |
| 1749 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1750 | static const unsigned char yyr1[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1751 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1752 | 0, 150, 151, 151, 152, 152, 152, 152, 152, 152, |
| 1753 | 152, 152, 152, 153, 153, 153, 154, 154, 154, 154, |
| 1754 | 154, 154, 154, 154, 154, 154, 154, 154, 155, 155, |
| 1755 | 155, 156, 156, 156, 156, 156, 156, 156, 156, 156, |
| 1756 | 156, 157, 157, 157, 157, 157, 157, 157, 157, 157, |
| 1757 | 157, 157, 157, 157, 157, 157, 157, 158, 158, 158, |
| 1758 | 158, 159, 159, 160, 160, 161, 161, 161, 161, 161, |
| 1759 | 162, 162, 162, 163, 163, 163, 164, 164, 164, 164, |
| 1760 | 164, 165, 165, 165, 165, 165, 165, 165, 165, 166, |
| 1761 | 166, 167, 167, 168, 168, 168, 169, 169, 170, 170, |
| 1762 | 171, 172, 172, 173, 173, 174, 174, 175, 175, 175, |
| 1763 | 175, 175, 175, 175, 175, 176, 176, 176, 176, 176, |
| 1764 | 176, 176, 176, 176, 176, 176, 176, 176, 177, 178, |
| 1765 | 178, 179, 179, 180, 180, 180, 180, 181, 181, 182, |
| 1766 | 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, |
| 1767 | 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, |
| 1768 | 183, 183, 183, 183, 183, 183, 184, 184, 185, 185, |
| 1769 | 186, 186, 187, 187, 189, 188, 190, 188, 188, 188, |
| 1770 | 188, 188, 191, 188, 192, 188, 193, 188, 188, 188, |
| 1771 | 194, 195, 195, 196, 196, 196, 196, 197, 198, 198, |
| 1772 | 198, 199, 199, 200, 200, 201, 201, 202, 202, 202, |
| 1773 | 202, 203, 204, 204, 205, 206, 206, 207, 208, 209, |
| 1774 | 209, 210, 210, 210, 210, 210, 210, 210, 210, 210, |
| 1775 | 210, 210, 211, 211, 212, 212, 213, 214, 214, 215, |
| 1776 | 216, 216, 216, 217, 217, 217, 217, 217, 217, 217, |
| 1777 | 217, 217, 218, 218, 219, 220, 220, 221, 221, 221, |
| 1778 | 222, 222, 223, 223, 224, 224, 224, 224, 224, 224, |
| 1779 | 224, 224, 224, 224, 224, 224, 224, 224, 224, 225, |
| 1780 | 225, 226, 226, 226, 226, 226, 226, 226, 226 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1781 | }; |
| 1782 | |
| 1783 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1784 | static const unsigned char yyr2[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1785 | { |
| 1786 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1787 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1788 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1789 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1790 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1791 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1792 | 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, |
| 1793 | 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, |
| 1794 | 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, |
| 1795 | 1, 1, 3, 0, 2, 4, 0, 2, 0, 3, |
| 1796 | 2, 0, 1, 0, 3, 1, 2, 1, 1, 1, |
| 1797 | 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, |
| 1798 | 5, 5, 5, 5, 3, 2, 5, 4, 2, 2, |
| 1799 | 2, 1, 3, 1, 3, 1, 0, 1, 3, 4, |
| 1800 | 3, 3, 4, 4, 3, 2, 2, 2, 2, 2, |
| 1801 | 2, 2, 2, 2, 2, 6, 5, 8, 6, 6, |
| 1802 | 7, 7, 6, 6, 8, 8, 3, 1, 1, 1, |
| 1803 | 1, 0, 1, 2, 0, 3, 0, 3, 3, 1, |
| 1804 | 3, 3, 0, 5, 0, 6, 0, 6, 2, 3, |
| 1805 | 1, 1, 1, 3, 3, 3, 3, 3, 3, 1, |
| 1806 | 0, 1, 1, 1, 0, 5, 3, 1, 3, 1, |
| 1807 | 0, 8, 1, 1, 3, 1, 1, 2, 2, 0, |
| 1808 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, |
| 1809 | 1, 5, 1, 1, 1, 1, 2, 2, 2, 3, |
| 1810 | 2, 0, 1, 2, 2, 3, 9, 9, 8, 13, |
| 1811 | 1, 1, 6, 5, 2, 6, 7, 3, 5, 0, |
| 1812 | 0, 3, 2, 1, 5, 5, 6, 6, 2, 4, |
| 1813 | 4, 6, 4, 4, 6, 6, 2, 7, 1, 1, |
| 1814 | 0, 3, 6, 3, 6, 2, 4, 6, 4 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1815 | }; |
| 1816 | |
| 1817 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1818 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1819 | means the default is an error. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1820 | static const unsigned short int yydefact[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1821 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1822 | 64, 201, 202, 179, 176, 174, 0, 0, 0, 0, |
| 1823 | 0, 64, 172, 0, 73, 76, 0, 0, 0, 0, |
| 1824 | 188, 0, 0, 0, 168, 169, 65, 67, 66, 68, |
| 1825 | 70, 69, 71, 72, 0, 0, 0, 1, 173, 63, |
| 1826 | 74, 75, 81, 177, 77, 78, 79, 80, 81, 241, |
| 1827 | 175, 241, 0, 0, 0, 0, 200, 189, 190, 178, |
| 1828 | 2, 3, 181, 107, 108, 109, 110, 111, 112, 113, |
| 1829 | 114, 115, 0, 0, 0, 0, 232, 116, 180, 233, |
| 1830 | 118, 0, 0, 93, 107, 108, 109, 110, 111, 112, |
| 1831 | 113, 0, 0, 93, 182, 0, 82, 83, 84, 85, |
| 1832 | 86, 87, 0, 218, 0, 242, 238, 64, 215, 216, |
| 1833 | 217, 237, 195, 192, 191, 193, 194, 196, 199, 0, |
| 1834 | 0, 0, 119, 0, 0, 0, 125, 137, 0, 117, |
| 1835 | 0, 184, 186, 152, 153, 150, 151, 154, 149, 145, |
| 1836 | 146, 4, 5, 6, 7, 8, 9, 10, 11, 12, |
| 1837 | 13, 14, 15, 0, 0, 0, 16, 17, 18, 19, |
| 1838 | 20, 21, 22, 23, 24, 25, 26, 27, 0, 28, |
| 1839 | 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1840 | 0, 0, 0, 148, 147, 103, 88, 93, 93, 0, |
| 1841 | 212, 213, 214, 280, 240, 0, 197, 89, 90, 0, |
| 1842 | 94, 136, 0, 0, 0, 0, 0, 124, 136, 103, |
| 1843 | 103, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
| 1844 | 40, 0, 55, 56, 51, 52, 53, 54, 41, 42, |
| 1845 | 43, 44, 45, 46, 47, 48, 49, 50, 0, 0, |
| 1846 | 0, 0, 0, 0, 140, 167, 0, 0, 144, 0, |
| 1847 | 141, 0, 0, 0, 0, 0, 183, 130, 129, 0, |
| 1848 | 279, 0, 263, 0, 0, 0, 0, 81, 250, 251, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1849 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1850 | 0, 0, 0, 0, 0, 0, 239, 81, 254, 0, |
| 1851 | 278, 198, 91, 0, 135, 93, 131, 133, 0, 93, |
| 1852 | 93, 127, 0, 138, 0, 185, 187, 0, 0, 260, |
| 1853 | 0, 0, 0, 0, 0, 139, 142, 143, 0, 0, |
| 1854 | 0, 0, 0, 0, 105, 103, 210, 93, 268, 262, |
| 1855 | 244, 243, 0, 0, 60, 59, 58, 57, 0, 0, |
| 1856 | 0, 0, 98, 98, 285, 93, 93, 276, 0, 0, |
| 1857 | 0, 0, 0, 93, 93, 0, 0, 0, 0, 0, |
| 1858 | 0, 95, 128, 0, 121, 122, 123, 126, 120, 0, |
| 1859 | 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, |
| 1860 | 0, 100, 106, 104, 209, 93, 207, 0, 221, 222, |
| 1861 | 223, 228, 224, 225, 226, 227, 219, 0, 230, 235, |
| 1862 | 234, 236, 0, 245, 0, 0, 93, 93, 0, 281, |
| 1863 | 0, 283, 260, 0, 0, 0, 0, 0, 0, 0, |
| 1864 | 0, 0, 0, 0, 0, 93, 0, 92, 134, 132, |
| 1865 | 0, 0, 0, 156, 0, 0, 0, 0, 0, 0, |
| 1866 | 93, 0, 204, 0, 101, 220, 0, 0, 0, 0, |
| 1867 | 0, 0, 0, 0, 0, 0, 288, 0, 0, 0, |
| 1868 | 272, 273, 0, 0, 0, 0, 270, 269, 0, 286, |
| 1869 | 0, 0, 0, 261, 0, 163, 0, 0, 158, 159, |
| 1870 | 155, 162, 203, 206, 208, 93, 102, 96, 0, 229, |
| 1871 | 0, 0, 259, 0, 0, 98, 99, 98, 0, 0, |
| 1872 | 0, 0, 0, 264, 265, 259, 93, 160, 161, 0, |
| 1873 | 0, 0, 204, 0, 211, 0, 0, 0, 93, 0, |
| 1874 | 266, 267, 0, 282, 284, 0, 0, 271, 274, 275, |
| 1875 | 0, 287, 157, 164, 165, 205, 97, 231, 0, 0, |
| 1876 | 93, 0, 0, 255, 0, 277, 0, 248, 0, 0, |
| 1877 | 257, 93, 0, 256, 246, 0, 247, 0, 93, 0, |
| 1878 | 0, 0, 258, 0, 0, 0, 0, 253, 0, 0, |
| 1879 | 252, 249 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1880 | }; |
| 1881 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 1882 | /* YYDEFGOTO[NTERM-NUM]. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1883 | static const short int yydefgoto[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1884 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1885 | -1, 76, 179, 180, 181, 182, 221, 238, 91, 92, |
| 1886 | 9, 34, 35, 42, 48, 102, 200, 293, 130, 514, |
| 1887 | 409, 324, 487, 256, 325, 77, 93, 296, 189, 297, |
| 1888 | 298, 128, 245, 398, 246, 36, 10, 11, 12, 15, |
| 1889 | 14, 185, 209, 210, 59, 115, 20, 57, 119, 79, |
| 1890 | 483, 386, 387, 103, 192, 49, 110, 50, 43, 446, |
| 1891 | 399, 80, 401, 328, 51, 106, 107, 286, 549, 194, |
| 1892 | 347, 519, 371, 287, 288, 289, 290 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1893 | }; |
| 1894 | |
| 1895 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1896 | STATE-NUM. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1897 | #define YYPACT_NINF -444 |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1898 | static const short int yypact[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1899 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1900 | 76, -444, -444, -444, -444, -444, -14, -77, 12, 548, |
| 1901 | 89, 91, -444, -40, 79, 116, -36, -29, -11, -3, |
| 1902 | -444, 14, 119, 949, -444, -444, -444, -444, -444, -444, |
| 1903 | -444, -444, -444, -444, 15, 15, 1230, -444, -444, -444, |
| 1904 | -444, -444, 131, -444, -444, -444, -444, -444, 131, 124, |
| 1905 | -444, -2, 130, -12, 173, 179, 188, -444, -444, -444, |
| 1906 | -444, -444, 25, -444, -444, -444, -444, -444, -444, -444, |
| 1907 | -444, -444, 212, 214, 4, 72, -444, -444, 44, -444, |
| 1908 | -444, 1230, 1271, 103, 152, 207, 225, 243, 260, 230, |
| 1909 | 241, 262, 269, 575, -444, 263, -444, -444, -444, -444, |
| 1910 | -444, -444, 1288, -444, -16, -444, -444, 117, -444, -444, |
| 1911 | -444, -444, -444, -444, -444, -444, -444, -444, -444, -19, |
| 1912 | -84, 140, -444, 136, 139, 539, -444, 44, -99, -444, |
| 1913 | 150, -444, 44, -444, -444, -444, -444, -444, -444, -444, |
| 1914 | -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, |
| 1915 | -444, -444, -444, 77, 283, 151, -444, -444, -444, -444, |
| 1916 | -444, -444, -444, -444, -444, -444, -444, -444, 154, -444, |
| 1917 | -444, -444, 156, 157, 158, 806, 1230, 720, 270, 159, |
| 1918 | 162, 166, 170, -444, -444, 155, -444, 103, 20, 117, |
| 1919 | -444, -444, -444, 1369, -444, 289, -444, -444, -444, 153, |
| 1920 | -444, 1123, 1271, 1271, 164, -98, 1271, -444, 1123, 155, |
| 1921 | 155, -444, -444, -444, -444, -444, -444, -444, -444, -444, |
| 1922 | -444, 174, -444, -444, -444, -444, -444, -444, -444, -444, |
| 1923 | -444, -444, -444, -444, -444, -444, -444, -444, 175, 1230, |
| 1924 | 1230, 1230, 1230, 1230, -444, -444, -15, -90, -444, -93, |
| 1925 | -444, 1230, 1230, 1230, 1230, -5, -444, 140, 150, 177, |
| 1926 | -444, 1271, -444, 256, 1329, 84, 176, 131, -444, -444, |
| 1927 | 77, 283, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, |
| 1928 | 1271, 1271, 1271, 1271, 1271, 1271, -444, 131, -444, 160, |
| 1929 | -444, -444, -444, 5, -444, 20, -444, 178, 180, -4, |
| 1930 | -39, -444, 181, 44, 182, -444, -444, 1230, 1230, -444, |
| 1931 | 184, 186, 187, 190, 1230, -444, -444, -444, 192, 193, |
| 1932 | 291, 194, 311, 328, -444, 155, 1169, 756, -444, -444, |
| 1933 | 25, -444, 899, 899, -444, -444, -444, -444, 899, 1288, |
| 1934 | 1271, 1271, 67, 85, -444, 756, -27, 197, 201, 202, |
| 1935 | 203, 205, 206, 756, 756, 310, 208, 1288, 1271, 1271, |
| 1936 | 153, -444, 150, 1186, -444, -444, -444, -444, -444, 209, |
| 1937 | 210, 73, 1230, 1230, 1230, 1230, -444, 1230, 1230, 1271, |
| 1938 | 1230, -444, -444, -444, -444, 20, 211, 213, -444, -444, |
| 1939 | -444, -444, -444, -444, -444, -444, 290, 1230, -444, -444, |
| 1940 | -444, -444, 215, -444, 221, 899, 756, 756, 13, -444, |
| 1941 | 17, -444, -444, 899, 216, 1271, 1271, 1271, 1271, 1271, |
| 1942 | 223, 224, 1271, 1271, 899, 756, 226, -444, -444, -444, |
| 1943 | 1230, 1230, 1271, -444, 231, 235, 234, 240, 236, 252, |
| 1944 | -66, 258, 10, 1213, 317, -444, 330, -71, 382, 386, |
| 1945 | 266, 271, 272, 899, 401, 899, 278, 279, 899, 281, |
| 1946 | 44, -444, 282, 288, 899, 899, 44, -444, 292, -444, |
| 1947 | 1271, 280, 287, -444, 1230, -444, 1230, 1230, -444, -444, |
| 1948 | -444, -444, -444, -444, -444, 20, -444, 374, 293, -444, |
| 1949 | 899, 899, 1271, 899, 899, 297, -444, 297, 899, 298, |
| 1950 | 1271, 1271, 1271, -444, -444, 1271, 756, -444, -444, 296, |
| 1951 | 301, 305, 10, 424, -444, 416, 309, 295, 756, 88, |
| 1952 | -444, -444, 395, -444, -444, 306, 899, -444, -444, -444, |
| 1953 | 100, -444, -444, -444, -444, -444, -444, -444, 433, 3, |
| 1954 | 103, 1271, 418, -444, 308, -444, 899, -444, 1031, 8, |
| 1955 | -444, 756, 437, -444, -444, 319, -444, 1031, 103, 899, |
| 1956 | 440, 321, -444, 387, 899, 442, 444, -444, 899, 899, |
| 1957 | -444, -444 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1958 | }; |
| 1959 | |
| 1960 | /* YYPGOTO[NTERM-NUM]. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1961 | static const short int yypgoto[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1962 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1963 | -444, -444, 268, 277, 294, 299, 218, 191, -262, -444, |
| 1964 | 356, -444, -444, -444, -444, -245, -196, -444, -60, -444, |
| 1965 | -336, 27, -444, -199, -444, -444, -23, 101, -306, -444, |
| 1966 | 264, 348, -9, 383, -171, 239, -444, -444, 464, -444, |
| 1967 | -444, -444, -444, -444, -444, -444, -444, -444, -444, 1, |
| 1968 | -31, -444, -444, 438, -444, -444, -444, -444, -444, -444, |
| 1969 | -443, -52, 78, -217, -444, 439, -444, -444, -444, -444, |
| 1970 | -444, -10, 81, -444, -444, -444, -444 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1971 | }; |
| 1972 | |
| 1973 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 1974 | positive, shift that token. If negative, reduce the rule which |
| 1975 | number is the opposite. If zero, do what YYDEFACT says. |
| 1976 | If YYTABLE_NINF, syntax error. */ |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1977 | #define YYTABLE_NINF -172 |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1978 | static const short int yytable[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1979 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1980 | 78, 13, 121, 292, 338, 247, 249, 411, 124, 190, |
| 1981 | 305, 306, 13, 334, 335, 336, 337, 105, 334, 335, |
| 1982 | 336, 337, 339, 121, 108, 453, 322, 94, 1, 455, |
| 1983 | 2, 197, 198, 405, 16, 17, 18, 206, 206, 113, |
| 1984 | 114, 184, 357, 314, 24, 25, 314, 331, 323, 207, |
| 1985 | 302, 424, 127, 19, 199, 317, 316, 344, 21, 132, |
| 1986 | 348, 349, 350, 351, 352, 314, 454, 355, 356, 22, |
| 1987 | 454, 120, 131, 480, 129, 489, -171, 60, 61, 188, |
| 1988 | 83, 63, 64, 65, 66, 67, 68, 69, 70, 37, |
| 1989 | 1, -170, 2, 332, 1, 39, 2, 3, 120, 52, |
| 1990 | 333, 129, 127, 4, 5, 555, 53, 366, 13, 1, |
| 1991 | 120, 2, 3, 129, 561, 413, 71, 195, 4, 5, |
| 1992 | 40, 314, 41, 6, 54, 196, 383, 257, 258, 315, |
| 1993 | 7, 191, 55, 120, 8, 1, 129, 2, 6, 58, |
| 1994 | 365, 360, 426, 105, 361, 7, 109, 547, 208, 8, |
| 1995 | 112, 125, 556, 44, 45, 46, 56, 120, 47, 523, |
| 1996 | 129, 524, 120, -93, 427, 211, 212, 213, 214, 215, |
| 1997 | 216, 217, 218, 219, 220, 133, 134, 116, 295, 299, |
| 1998 | 300, 120, -93, 303, 129, 295, 334, 335, 336, 337, |
| 1999 | 259, 95, 96, 97, 98, 99, 100, 101, 459, 117, |
| 2000 | 461, 462, 463, 408, 120, -93, 467, 129, 118, 432, |
| 2001 | -60, -60, 433, 72, 73, 473, 122, 74, 123, 75, |
| 2002 | 126, 410, 120, -93, 541, 129, 447, 542, -59, -59, |
| 2003 | 309, 310, 311, 312, 313, 362, 541, -61, 327, 545, |
| 2004 | 120, 327, 318, 319, 320, 321, -58, -58, -62, 342, |
| 2005 | 343, 327, 345, 346, 327, 327, 327, 327, 327, 353, |
| 2006 | 354, 327, 327, -57, -57, 135, 136, 186, 197, 198, |
| 2007 | 121, 358, 359, 81, 82, 400, 137, 548, 201, 202, |
| 2008 | 400, 400, 203, 527, 528, 529, 400, 557, 208, 239, |
| 2009 | 250, 255, 240, 400, 241, 242, 243, 251, 369, 370, |
| 2010 | 252, 400, 400, 385, 253, 376, 222, 223, 254, 291, |
| 2011 | 301, 329, 307, 308, 363, 326, 188, 406, 407, 364, |
| 2012 | 372, 368, 373, 374, 379, 442, 375, 367, 377, 378, |
| 2013 | 380, 381, 382, 414, 188, 425, 327, 415, 416, 417, |
| 2014 | 295, 418, 419, 422, 423, 430, 431, 443, 322, 445, |
| 2015 | 488, 448, 444, 400, 400, 400, 440, 449, 458, 464, |
| 2016 | 465, 400, 470, 434, 435, 436, 437, 474, 438, 439, |
| 2017 | 476, 441, 400, 400, 475, 478, 477, 224, 225, 226, |
| 2018 | 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, |
| 2019 | 237, 479, 327, 460, 327, 327, 327, 481, 490, 466, |
| 2020 | 327, 400, 491, 400, 492, 496, 400, 493, 494, 327, |
| 2021 | 402, 403, 400, 400, 432, 498, 404, 500, 501, 507, |
| 2022 | 485, 471, 472, 412, 502, 512, 508, 513, 536, 515, |
| 2023 | 505, 420, 421, 522, 526, 532, 537, 539, 400, 400, |
| 2024 | 533, 400, 400, 482, 534, 538, 400, 506, 454, 546, |
| 2025 | 543, 552, 553, 559, 400, 560, 564, 565, 568, 566, |
| 2026 | 569, 282, 341, 193, 429, 509, 400, 510, 511, 518, |
| 2027 | 283, 486, 304, 205, 400, 38, 183, 327, 327, 327, |
| 2028 | 550, 535, 518, 450, 451, 452, 104, 284, 340, 0, |
| 2029 | 111, 457, 285, 456, 400, 530, 0, 0, 562, 400, |
| 2030 | 0, 0, 468, 469, 0, 0, 0, 400, 0, 0, |
| 2031 | 0, 0, 400, 482, 0, 0, 400, 400, 551, 0, |
| 2032 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2033 | 0, 495, 0, 497, 0, 0, 499, 0, 0, 0, |
| 2034 | 0, 0, 503, 504, 60, 61, 0, 83, 63, 64, |
| 2035 | 65, 66, 67, 68, 69, 70, 0, 1, 0, 2, |
| 2036 | 0, 0, 0, 0, 0, 23, 0, 0, 516, 517, |
| 2037 | 0, 520, 521, 0, 0, 0, 525, 24, 25, 0, |
| 2038 | 60, 61, 0, 71, 531, 26, 27, 28, 29, 30, |
| 2039 | 31, 32, 0, 1, 33, 2, 540, 138, 0, 0, |
| 2040 | 0, 0, 0, 0, 544, 0, 0, 0, 0, 0, |
| 2041 | 139, 140, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2042 | 0, 0, 0, 0, 554, 0, 0, 0, 0, 558, |
| 2043 | 0, 0, 0, 0, 0, 0, 0, 563, 0, 0, |
| 2044 | 0, 0, 567, 0, 0, 0, 570, 571, 0, 141, |
| 2045 | 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, |
| 2046 | 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, |
| 2047 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2048 | 72, 73, 0, 0, 74, 0, 75, 204, 155, 156, |
| 2049 | 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, |
| 2050 | 167, 0, 168, 169, 170, 171, 0, 172, 173, 174, |
| 2051 | 0, 0, 120, 0, 0, 129, 0, 175, 0, 0, |
| 2052 | 176, 0, 177, 0, 178, 60, 61, 0, 83, 84, |
| 2053 | 85, 86, 87, 88, 89, 90, 70, 0, 1, 0, |
| 2054 | 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2055 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 388, |
| 2056 | 389, 60, 61, 390, 71, 0, 0, 0, 0, 0, |
| 2057 | 0, 0, 0, 0, 1, 0, 2, 0, 391, 392, |
| 2058 | 393, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2059 | 0, 394, 395, 0, 0, 0, 0, 0, 0, 0, |
| 2060 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2061 | 0, 60, 61, 396, 83, 84, 85, 86, 87, 88, |
| 2062 | 89, 90, 70, 0, 1, 0, 2, 0, 0, 0, |
| 2063 | 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, |
| 2064 | 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, |
| 2065 | 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2066 | 0, 72, 73, 0, 0, 74, 0, 75, 248, 155, |
| 2067 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2068 | 166, 167, 0, 168, 169, 170, 171, 0, 172, 173, |
| 2069 | 174, 0, 0, 120, 0, 0, 129, 0, 0, 0, |
| 2070 | 0, 397, 388, 389, 60, 61, 390, 0, 0, 0, |
| 2071 | 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, |
| 2072 | 0, 391, 392, 393, 0, 0, 0, 0, 0, 0, |
| 2073 | 0, 0, 0, 0, 394, 395, 0, 0, 0, 0, |
| 2074 | 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, |
| 2075 | 244, 74, 0, 75, 60, 61, 396, 62, 63, 64, |
| 2076 | 65, 66, 67, 68, 69, 70, 0, 1, 0, 2, |
| 2077 | 0, 0, 0, 141, 142, 143, 144, 145, 146, 147, |
| 2078 | 148, 149, 150, 151, 152, 153, 154, 0, 0, 0, |
| 2079 | 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, |
| 2080 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2081 | 0, 0, 155, 156, 157, 158, 159, 160, 161, 162, |
| 2082 | 163, 164, 165, 166, 167, 0, 168, 169, 170, 171, |
| 2083 | 0, 172, 173, 174, 388, 389, 0, 0, 390, 0, |
| 2084 | 0, 0, 0, 0, 397, 0, 0, 0, 0, 0, |
| 2085 | 0, 0, 0, 391, 392, 393, 0, 0, 0, 0, |
| 2086 | 0, 0, 0, 0, 0, 0, 394, 395, 0, 0, |
| 2087 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2088 | 0, 0, 0, 0, 0, 0, 0, 0, 396, 0, |
| 2089 | 72, 73, 0, 0, 74, 0, 75, 0, 0, 0, |
| 2090 | 0, 0, 0, 0, 0, 141, 142, 143, 144, 145, |
| 2091 | 146, 147, 148, 149, 150, 151, 152, 153, 154, 0, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2092 | 0, 0, 0, 0, 0, 0, 0, 0, 60, 61, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2093 | 0, 83, 63, 64, 65, 66, 67, 68, 69, 70, |
| 2094 | 0, 1, 0, 2, 155, 156, 157, 158, 159, 160, |
| 2095 | 161, 162, 163, 164, 165, 166, 167, 294, 168, 169, |
| 2096 | 170, 171, 0, 172, 173, 174, 0, 71, 0, 0, |
| 2097 | 0, 0, 0, 0, 60, 61, 397, 83, 63, 64, |
| 2098 | 65, 66, 67, 68, 69, 70, 0, 1, 0, 2, |
| 2099 | 0, 60, 61, 0, 83, 63, 64, 65, 66, 67, |
| 2100 | 68, 69, 70, 384, 1, 0, 2, 0, 0, 0, |
| 2101 | 0, 0, 0, 71, 0, 0, 0, 0, 60, 61, |
| 2102 | 428, 83, 63, 64, 65, 66, 67, 68, 69, 70, |
| 2103 | 71, 1, 0, 2, 0, 60, 61, 0, 83, 84, |
| 2104 | 85, 86, 87, 88, 89, 90, 70, 484, 1, 0, |
| 2105 | 2, 0, 0, 0, 0, 0, 0, 71, 0, 0, |
| 2106 | 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, |
| 2107 | 75, 0, 0, 0, 71, 0, 60, 61, 0, 83, |
| 2108 | 63, 64, 65, 66, 67, 68, 69, 70, 0, 1, |
| 2109 | 0, 2, 0, 60, 61, 0, 187, 63, 64, 65, |
| 2110 | 66, 67, 68, 69, 70, 0, 1, 0, 2, 0, |
| 2111 | 72, 73, 0, 0, 74, 71, 75, 0, 0, 0, |
| 2112 | 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, |
| 2113 | 0, 74, 71, 75, 60, 61, 0, 330, 63, 64, |
| 2114 | 65, 66, 67, 68, 69, 70, 0, 1, 0, 2, |
| 2115 | 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, |
| 2116 | 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2117 | 0, 72, 73, 71, 0, 74, 0, 75, 0, 0, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2118 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2119 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2120 | 0, 260, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2121 | 0, 0, 72, 73, 261, 0, 74, 0, 75, 0, |
| 2122 | 0, 0, 0, 0, 262, 263, 0, 0, 0, 72, |
| 2123 | 73, 0, 0, 74, 0, 75, 0, 264, 265, 266, |
| 2124 | 267, 268, 269, 141, 142, 143, 144, 145, 146, 147, |
| 2125 | 148, 149, 150, 151, 152, 270, 271, 0, 0, 0, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2126 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2127 | 72, 73, 0, 0, 74, 0, 75, 272, 273, 274, |
| 2128 | 0, 0, 275, 156, 157, 158, 159, 160, 161, 162, |
| 2129 | 163, 164, 165, 166, 167, 276, 277, 169, 170, 171, |
| 2130 | 278, 279, 280, 281 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2131 | }; |
| 2132 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2133 | static const short int yycheck[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2134 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2135 | 23, 0, 62, 199, 266, 176, 177, 343, 4, 25, |
| 2136 | 209, 210, 11, 10, 11, 12, 13, 19, 10, 11, |
| 2137 | 12, 13, 267, 83, 26, 12, 31, 36, 18, 12, |
| 2138 | 20, 115, 116, 339, 48, 49, 50, 136, 136, 51, |
| 2139 | 52, 93, 287, 136, 29, 30, 136, 264, 53, 148, |
| 2140 | 148, 357, 75, 67, 138, 148, 146, 274, 135, 82, |
| 2141 | 277, 278, 279, 280, 281, 136, 53, 284, 285, 57, |
| 2142 | 53, 137, 81, 139, 140, 146, 0, 5, 6, 102, |
| 2143 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, |
| 2144 | 18, 0, 20, 9, 18, 135, 20, 21, 137, 135, |
| 2145 | 16, 140, 125, 27, 28, 548, 135, 146, 107, 18, |
| 2146 | 137, 20, 21, 140, 557, 142, 44, 136, 27, 28, |
| 2147 | 41, 136, 43, 47, 135, 144, 325, 187, 188, 144, |
| 2148 | 54, 147, 135, 137, 58, 18, 140, 20, 47, 20, |
| 2149 | 144, 136, 359, 19, 139, 54, 148, 144, 138, 58, |
| 2150 | 20, 147, 144, 37, 38, 39, 142, 137, 42, 495, |
| 2151 | 140, 497, 137, 138, 360, 88, 89, 90, 91, 92, |
| 2152 | 93, 94, 95, 96, 97, 23, 24, 4, 201, 202, |
| 2153 | 203, 137, 138, 206, 140, 208, 10, 11, 12, 13, |
| 2154 | 189, 60, 61, 62, 63, 64, 65, 66, 415, 20, |
| 2155 | 417, 418, 419, 136, 137, 138, 423, 140, 20, 136, |
| 2156 | 3, 4, 139, 141, 142, 432, 4, 145, 4, 147, |
| 2157 | 148, 136, 137, 138, 136, 140, 397, 139, 3, 4, |
| 2158 | 239, 240, 241, 242, 243, 295, 136, 7, 261, 139, |
| 2159 | 137, 264, 251, 252, 253, 254, 3, 4, 7, 272, |
| 2160 | 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, |
| 2161 | 283, 284, 285, 3, 4, 3, 4, 4, 115, 116, |
| 2162 | 330, 111, 112, 34, 35, 327, 7, 539, 138, 143, |
| 2163 | 332, 333, 143, 500, 501, 502, 338, 549, 138, 138, |
| 2164 | 20, 136, 138, 345, 138, 138, 138, 138, 307, 308, |
| 2165 | 138, 353, 354, 326, 138, 314, 23, 24, 138, 20, |
| 2166 | 146, 55, 138, 138, 136, 138, 339, 340, 341, 139, |
| 2167 | 136, 139, 136, 136, 33, 385, 136, 146, 136, 136, |
| 2168 | 136, 20, 4, 136, 357, 358, 359, 136, 136, 136, |
| 2169 | 363, 136, 136, 33, 136, 136, 136, 136, 31, 59, |
| 2170 | 20, 136, 139, 405, 406, 407, 379, 136, 142, 136, |
| 2171 | 136, 413, 136, 372, 373, 374, 375, 136, 377, 378, |
| 2172 | 136, 380, 424, 425, 139, 139, 136, 94, 95, 96, |
| 2173 | 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, |
| 2174 | 107, 139, 415, 416, 417, 418, 419, 139, 16, 422, |
| 2175 | 423, 453, 16, 455, 138, 4, 458, 136, 136, 432, |
| 2176 | 332, 333, 464, 465, 136, 136, 338, 136, 136, 139, |
| 2177 | 443, 430, 431, 345, 136, 485, 139, 53, 4, 136, |
| 2178 | 138, 353, 354, 136, 136, 139, 20, 142, 490, 491, |
| 2179 | 139, 493, 494, 442, 139, 136, 498, 470, 53, 16, |
| 2180 | 144, 33, 144, 16, 506, 136, 16, 136, 16, 72, |
| 2181 | 16, 193, 271, 107, 363, 474, 518, 476, 477, 492, |
| 2182 | 193, 444, 208, 125, 526, 11, 93, 500, 501, 502, |
| 2183 | 540, 512, 505, 405, 406, 407, 48, 193, 270, -1, |
| 2184 | 51, 413, 193, 412, 546, 505, -1, -1, 558, 551, |
| 2185 | -1, -1, 424, 425, -1, -1, -1, 559, -1, -1, |
| 2186 | -1, -1, 564, 512, -1, -1, 568, 569, 541, -1, |
| 2187 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2188 | -1, 453, -1, 455, -1, -1, 458, -1, -1, -1, |
| 2189 | -1, -1, 464, 465, 5, 6, -1, 8, 9, 10, |
| 2190 | 11, 12, 13, 14, 15, 16, -1, 18, -1, 20, |
| 2191 | -1, -1, -1, -1, -1, 17, -1, -1, 490, 491, |
| 2192 | -1, 493, 494, -1, -1, -1, 498, 29, 30, -1, |
| 2193 | 5, 6, -1, 44, 506, 37, 38, 39, 40, 41, |
| 2194 | 42, 43, -1, 18, 46, 20, 518, 22, -1, -1, |
| 2195 | -1, -1, -1, -1, 526, -1, -1, -1, -1, -1, |
| 2196 | 35, 36, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2197 | -1, -1, -1, -1, 546, -1, -1, -1, -1, 551, |
| 2198 | -1, -1, -1, -1, -1, -1, -1, 559, -1, -1, |
| 2199 | -1, -1, 564, -1, -1, -1, 568, 569, -1, 74, |
| 2200 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 2201 | 85, 86, 87, -1, -1, -1, -1, -1, -1, -1, |
| 2202 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2203 | 141, 142, -1, -1, 145, -1, 147, 148, 113, 114, |
| 2204 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 2205 | 125, -1, 127, 128, 129, 130, -1, 132, 133, 134, |
| 2206 | -1, -1, 137, -1, -1, 140, -1, 142, -1, -1, |
| 2207 | 145, -1, 147, -1, 149, 5, 6, -1, 8, 9, |
| 2208 | 10, 11, 12, 13, 14, 15, 16, -1, 18, -1, |
| 2209 | 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2210 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, |
| 2211 | 4, 5, 6, 7, 44, -1, -1, -1, -1, -1, |
| 2212 | -1, -1, -1, -1, 18, -1, 20, -1, 22, 23, |
| 2213 | 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2214 | -1, 35, 36, -1, -1, -1, -1, -1, -1, -1, |
| 2215 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2216 | -1, 5, 6, 57, 8, 9, 10, 11, 12, 13, |
| 2217 | 14, 15, 16, -1, 18, -1, 20, -1, -1, -1, |
| 2218 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2219 | 84, 85, 86, 87, -1, -1, -1, -1, -1, -1, |
| 2220 | 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2221 | -1, 141, 142, -1, -1, 145, -1, 147, 148, 113, |
| 2222 | 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, |
| 2223 | 124, 125, -1, 127, 128, 129, 130, -1, 132, 133, |
| 2224 | 134, -1, -1, 137, -1, -1, 140, -1, -1, -1, |
| 2225 | -1, 145, 3, 4, 5, 6, 7, -1, -1, -1, |
| 2226 | -1, -1, -1, -1, -1, -1, -1, 18, -1, 20, |
| 2227 | -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, |
| 2228 | -1, -1, -1, -1, 35, 36, -1, -1, -1, -1, |
| 2229 | -1, -1, -1, -1, -1, -1, -1, 141, 142, -1, |
| 2230 | 144, 145, -1, 147, 5, 6, 57, 8, 9, 10, |
| 2231 | 11, 12, 13, 14, 15, 16, -1, 18, -1, 20, |
| 2232 | -1, -1, -1, 74, 75, 76, 77, 78, 79, 80, |
| 2233 | 81, 82, 83, 84, 85, 86, 87, -1, -1, -1, |
| 2234 | -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, |
| 2235 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2236 | -1, -1, 113, 114, 115, 116, 117, 118, 119, 120, |
| 2237 | 121, 122, 123, 124, 125, -1, 127, 128, 129, 130, |
| 2238 | -1, 132, 133, 134, 3, 4, -1, -1, 7, -1, |
| 2239 | -1, -1, -1, -1, 145, -1, -1, -1, -1, -1, |
| 2240 | -1, -1, -1, 22, 23, 24, -1, -1, -1, -1, |
| 2241 | -1, -1, -1, -1, -1, -1, 35, 36, -1, -1, |
| 2242 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2243 | -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, |
| 2244 | 141, 142, -1, -1, 145, -1, 147, -1, -1, -1, |
| 2245 | -1, -1, -1, -1, -1, 74, 75, 76, 77, 78, |
| 2246 | 79, 80, 81, 82, 83, 84, 85, 86, 87, -1, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2247 | -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2248 | -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2249 | -1, 18, -1, 20, 113, 114, 115, 116, 117, 118, |
| 2250 | 119, 120, 121, 122, 123, 124, 125, 34, 127, 128, |
| 2251 | 129, 130, -1, 132, 133, 134, -1, 44, -1, -1, |
| 2252 | -1, -1, -1, -1, 5, 6, 145, 8, 9, 10, |
| 2253 | 11, 12, 13, 14, 15, 16, -1, 18, -1, 20, |
| 2254 | -1, 5, 6, -1, 8, 9, 10, 11, 12, 13, |
| 2255 | 14, 15, 16, 34, 18, -1, 20, -1, -1, -1, |
| 2256 | -1, -1, -1, 44, -1, -1, -1, -1, 5, 6, |
| 2257 | 34, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2258 | 44, 18, -1, 20, -1, 5, 6, -1, 8, 9, |
| 2259 | 10, 11, 12, 13, 14, 15, 16, 34, 18, -1, |
| 2260 | 20, -1, -1, -1, -1, -1, -1, 44, -1, -1, |
| 2261 | -1, -1, -1, -1, 141, 142, -1, -1, 145, -1, |
| 2262 | 147, -1, -1, -1, 44, -1, 5, 6, -1, 8, |
| 2263 | 9, 10, 11, 12, 13, 14, 15, 16, -1, 18, |
| 2264 | -1, 20, -1, 5, 6, -1, 8, 9, 10, 11, |
| 2265 | 12, 13, 14, 15, 16, -1, 18, -1, 20, -1, |
| 2266 | 141, 142, -1, -1, 145, 44, 147, -1, -1, -1, |
| 2267 | -1, -1, -1, -1, -1, -1, -1, 141, 142, -1, |
| 2268 | -1, 145, 44, 147, 5, 6, -1, 8, 9, 10, |
| 2269 | 11, 12, 13, 14, 15, 16, -1, 18, -1, 20, |
| 2270 | -1, -1, -1, -1, 141, 142, -1, -1, 145, -1, |
| 2271 | 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2272 | -1, 141, 142, 44, -1, 145, -1, 147, -1, -1, |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2273 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2274 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2275 | -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2276 | -1, -1, 141, 142, 45, -1, 145, -1, 147, -1, |
| 2277 | -1, -1, -1, -1, 55, 56, -1, -1, -1, 141, |
| 2278 | 142, -1, -1, 145, -1, 147, -1, 68, 69, 70, |
| 2279 | 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, |
| 2280 | 81, 82, 83, 84, 85, 86, 87, -1, -1, -1, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2281 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2282 | 141, 142, -1, -1, 145, -1, 147, 108, 109, 110, |
| 2283 | -1, -1, 113, 114, 115, 116, 117, 118, 119, 120, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2284 | 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2285 | 131, 132, 133, 134 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2286 | }; |
| 2287 | |
| 2288 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2289 | symbol of state STATE-NUM. */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2290 | static const unsigned char yystos[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2291 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2292 | 0, 18, 20, 21, 27, 28, 47, 54, 58, 160, |
| 2293 | 186, 187, 188, 199, 190, 189, 48, 49, 50, 67, |
| 2294 | 196, 135, 57, 17, 29, 30, 37, 38, 39, 40, |
| 2295 | 41, 42, 43, 46, 161, 162, 185, 0, 188, 135, |
| 2296 | 41, 43, 163, 208, 37, 38, 39, 42, 164, 205, |
| 2297 | 207, 214, 135, 135, 135, 135, 142, 197, 20, 194, |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 2298 | 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2299 | 16, 44, 141, 142, 145, 147, 151, 175, 176, 199, |
| 2300 | 211, 185, 185, 8, 9, 10, 11, 12, 13, 14, |
| 2301 | 15, 158, 159, 176, 182, 60, 61, 62, 63, 64, |
| 2302 | 65, 66, 165, 203, 203, 19, 215, 216, 26, 148, |
| 2303 | 206, 215, 20, 51, 52, 195, 4, 20, 20, 198, |
| 2304 | 137, 168, 4, 4, 4, 147, 148, 176, 181, 140, |
| 2305 | 168, 182, 176, 23, 24, 3, 4, 7, 22, 35, |
| 2306 | 36, 74, 75, 76, 77, 78, 79, 80, 81, 82, |
| 2307 | 83, 84, 85, 86, 87, 113, 114, 115, 116, 117, |
| 2308 | 118, 119, 120, 121, 122, 123, 124, 125, 127, 128, |
| 2309 | 129, 130, 132, 133, 134, 142, 145, 147, 149, 152, |
| 2310 | 153, 154, 155, 183, 211, 191, 4, 8, 176, 178, |
| 2311 | 25, 147, 204, 160, 219, 136, 144, 115, 116, 138, |
| 2312 | 166, 138, 143, 143, 148, 181, 136, 148, 138, 192, |
| 2313 | 193, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 2314 | 97, 156, 23, 24, 94, 95, 96, 97, 98, 99, |
| 2315 | 100, 101, 102, 103, 104, 105, 106, 107, 157, 138, |
| 2316 | 138, 138, 138, 138, 144, 182, 184, 184, 148, 184, |
| 2317 | 20, 138, 138, 138, 138, 136, 173, 168, 168, 199, |
| 2318 | 32, 45, 55, 56, 68, 69, 70, 71, 72, 73, |
| 2319 | 86, 87, 108, 109, 110, 113, 126, 127, 131, 132, |
| 2320 | 133, 134, 152, 153, 154, 155, 217, 223, 224, 225, |
| 2321 | 226, 20, 166, 167, 34, 176, 177, 179, 180, 176, |
| 2322 | 176, 146, 148, 176, 180, 173, 173, 138, 138, 182, |
| 2323 | 182, 182, 182, 182, 136, 144, 146, 148, 182, 182, |
| 2324 | 182, 182, 31, 53, 171, 174, 138, 176, 213, 55, |
| 2325 | 8, 213, 9, 16, 10, 11, 12, 13, 158, 165, |
| 2326 | 156, 157, 176, 176, 213, 176, 176, 220, 213, 213, |
| 2327 | 213, 213, 213, 176, 176, 213, 213, 165, 111, 112, |
| 2328 | 136, 139, 168, 136, 139, 144, 146, 146, 139, 182, |
| 2329 | 182, 222, 136, 136, 136, 136, 182, 136, 136, 33, |
| 2330 | 136, 20, 4, 173, 34, 176, 201, 202, 3, 4, |
| 2331 | 7, 22, 23, 24, 35, 36, 57, 145, 183, 210, |
| 2332 | 211, 212, 212, 212, 212, 178, 176, 176, 136, 170, |
| 2333 | 136, 170, 212, 142, 136, 136, 136, 136, 136, 136, |
| 2334 | 212, 212, 33, 136, 178, 176, 213, 166, 34, 177, |
| 2335 | 136, 136, 136, 139, 182, 182, 182, 182, 182, 182, |
| 2336 | 176, 182, 168, 136, 139, 59, 209, 184, 136, 136, |
| 2337 | 212, 212, 212, 12, 53, 12, 222, 212, 142, 213, |
| 2338 | 176, 213, 213, 213, 136, 136, 176, 213, 212, 212, |
| 2339 | 136, 182, 182, 213, 136, 139, 136, 136, 139, 139, |
| 2340 | 139, 139, 199, 200, 34, 176, 171, 172, 20, 146, |
| 2341 | 16, 16, 138, 136, 136, 212, 4, 212, 136, 212, |
| 2342 | 136, 136, 136, 212, 212, 138, 176, 139, 139, 182, |
| 2343 | 182, 182, 168, 53, 169, 136, 212, 212, 176, 221, |
| 2344 | 212, 212, 136, 170, 170, 212, 136, 213, 213, 213, |
| 2345 | 221, 212, 139, 139, 139, 200, 4, 20, 136, 142, |
| 2346 | 212, 136, 139, 144, 212, 139, 16, 144, 158, 218, |
| 2347 | 168, 176, 33, 144, 212, 210, 144, 158, 212, 16, |
| 2348 | 136, 210, 168, 212, 16, 136, 72, 212, 16, 16, |
| 2349 | 212, 212 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2350 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2351 | |
| 2352 | #define yyerrok (yyerrstatus = 0) |
| 2353 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2354 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2355 | #define YYEOF 0 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2356 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2357 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2358 | #define YYABORT goto yyabortlab |
| 2359 | #define YYERROR goto yyerrorlab |
| 2360 | |
| 2361 | |
| 2362 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2363 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2364 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2365 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2366 | #define YYFAIL goto yyerrlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2367 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2368 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2369 | |
| 2370 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2371 | do \ |
| 2372 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2373 | { \ |
| 2374 | yychar = (Token); \ |
| 2375 | yylval = (Value); \ |
| 2376 | yytoken = YYTRANSLATE (yychar); \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2377 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2378 | goto yybackup; \ |
| 2379 | } \ |
| 2380 | else \ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2381 | { \ |
| 2382 | yyerror (YY_("syntax error: cannot back up")); \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2383 | YYERROR; \ |
| 2384 | } \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2385 | while (0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2386 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2387 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2388 | #define YYTERROR 1 |
| 2389 | #define YYERRCODE 256 |
| 2390 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2391 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2392 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2393 | If N is 0, then set CURRENT to the empty location which ends |
| 2394 | the previous symbol: RHS[0] (always defined). */ |
| 2395 | |
| 2396 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2397 | #ifndef YYLLOC_DEFAULT |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2398 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2399 | do \ |
| 2400 | if (N) \ |
| 2401 | { \ |
| 2402 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2403 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2404 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2405 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2406 | } \ |
| 2407 | else \ |
| 2408 | { \ |
| 2409 | (Current).first_line = (Current).last_line = \ |
| 2410 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2411 | (Current).first_column = (Current).last_column = \ |
| 2412 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2413 | } \ |
| 2414 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2415 | #endif |
| 2416 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2417 | |
| 2418 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2419 | This macro was not mandated originally: define only if we know |
| 2420 | we won't break user code: when these are the locations we know. */ |
| 2421 | |
| 2422 | #ifndef YY_LOCATION_PRINT |
| 2423 | # if YYLTYPE_IS_TRIVIAL |
| 2424 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2425 | fprintf (File, "%d.%d-%d.%d", \ |
| 2426 | (Loc).first_line, (Loc).first_column, \ |
| 2427 | (Loc).last_line, (Loc).last_column) |
| 2428 | # else |
| 2429 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2430 | # endif |
| 2431 | #endif |
| 2432 | |
| 2433 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2434 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2435 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2436 | #ifdef YYLEX_PARAM |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2437 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2438 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2439 | # define YYLEX yylex () |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2440 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2441 | |
| 2442 | /* Enable debugging if requested. */ |
| 2443 | #if YYDEBUG |
| 2444 | |
| 2445 | # ifndef YYFPRINTF |
| 2446 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2447 | # define YYFPRINTF fprintf |
| 2448 | # endif |
| 2449 | |
| 2450 | # define YYDPRINTF(Args) \ |
| 2451 | do { \ |
| 2452 | if (yydebug) \ |
| 2453 | YYFPRINTF Args; \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2454 | } while (0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2455 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2456 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2457 | do { \ |
| 2458 | if (yydebug) \ |
| 2459 | { \ |
| 2460 | YYFPRINTF (stderr, "%s ", Title); \ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2461 | yysymprint (stderr, \ |
| 2462 | Type, Value); \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2463 | YYFPRINTF (stderr, "\n"); \ |
| 2464 | } \ |
| 2465 | } while (0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2466 | |
| 2467 | /*------------------------------------------------------------------. |
| 2468 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2469 | | TOP (included). | |
| 2470 | `------------------------------------------------------------------*/ |
| 2471 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2472 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2473 | static void |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2474 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2475 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2476 | static void |
| 2477 | yy_stack_print (bottom, top) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2478 | short int *bottom; |
| 2479 | short int *top; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2480 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2481 | { |
| 2482 | YYFPRINTF (stderr, "Stack now"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2483 | for (/* Nothing. */; bottom <= top; ++bottom) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2484 | YYFPRINTF (stderr, " %d", *bottom); |
| 2485 | YYFPRINTF (stderr, "\n"); |
| 2486 | } |
| 2487 | |
| 2488 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2489 | do { \ |
| 2490 | if (yydebug) \ |
| 2491 | yy_stack_print ((Bottom), (Top)); \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2492 | } while (0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2493 | |
| 2494 | |
| 2495 | /*------------------------------------------------. |
| 2496 | | Report that the YYRULE is going to be reduced. | |
| 2497 | `------------------------------------------------*/ |
| 2498 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2499 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2500 | static void |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2501 | yy_reduce_print (int yyrule) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2502 | #else |
| 2503 | static void |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2504 | yy_reduce_print (yyrule) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2505 | int yyrule; |
Chris Lattner | 1ae022f | 2006-10-22 06:08:13 +0000 | [diff] [blame] | 2506 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2507 | { |
| 2508 | int yyi; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2509 | unsigned long int yylno = yyrline[yyrule]; |
| 2510 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2511 | yyrule - 1, yylno); |
| 2512 | /* Print the symbols being reduced, and their result. */ |
| 2513 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2514 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2515 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2516 | } |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2517 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2518 | # define YY_REDUCE_PRINT(Rule) \ |
| 2519 | do { \ |
| 2520 | if (yydebug) \ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2521 | yy_reduce_print (Rule); \ |
| 2522 | } while (0) |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2523 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2524 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2525 | multiple parsers can coexist. */ |
| 2526 | int yydebug; |
| 2527 | #else /* !YYDEBUG */ |
| 2528 | # define YYDPRINTF(Args) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2529 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2530 | # define YY_STACK_PRINT(Bottom, Top) |
| 2531 | # define YY_REDUCE_PRINT(Rule) |
| 2532 | #endif /* !YYDEBUG */ |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2533 | |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2534 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2535 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2536 | #ifndef YYINITDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2537 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2538 | #endif |
| 2539 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2540 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2541 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2542 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2543 | Do not make this value too large; the results are undefined if |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2544 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2545 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2546 | |
| 2547 | #ifndef YYMAXDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2548 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2549 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2550 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2551 | |
| 2552 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2553 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2554 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2555 | # ifndef yystrlen |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2556 | # if defined (__GLIBC__) && defined (_STRING_H) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2557 | # define yystrlen strlen |
| 2558 | # else |
| 2559 | /* Return the length of YYSTR. */ |
| 2560 | static YYSIZE_T |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2561 | # if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2562 | yystrlen (const char *yystr) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2563 | # else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2564 | yystrlen (yystr) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2565 | const char *yystr; |
| 2566 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2567 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2568 | const char *yys = yystr; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2569 | |
| 2570 | while (*yys++ != '\0') |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2571 | continue; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2572 | |
| 2573 | return yys - yystr - 1; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2574 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2575 | # endif |
| 2576 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2577 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2578 | # ifndef yystpcpy |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2579 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2580 | # define yystpcpy stpcpy |
| 2581 | # else |
| 2582 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2583 | YYDEST. */ |
| 2584 | static char * |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2585 | # if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2586 | yystpcpy (char *yydest, const char *yysrc) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2587 | # else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2588 | yystpcpy (yydest, yysrc) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2589 | char *yydest; |
| 2590 | const char *yysrc; |
| 2591 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2592 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2593 | char *yyd = yydest; |
| 2594 | const char *yys = yysrc; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2595 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2596 | while ((*yyd++ = *yys++) != '\0') |
| 2597 | continue; |
| 2598 | |
| 2599 | return yyd - 1; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2600 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2601 | # endif |
| 2602 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2603 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2604 | # ifndef yytnamerr |
| 2605 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2606 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2607 | heuristic is that double-quoting is unnecessary unless the string |
| 2608 | contains an apostrophe, a comma, or backslash (other than |
| 2609 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2610 | null, do not copy; instead, return the length of what the result |
| 2611 | would have been. */ |
| 2612 | static YYSIZE_T |
| 2613 | yytnamerr (char *yyres, const char *yystr) |
| 2614 | { |
| 2615 | if (*yystr == '"') |
| 2616 | { |
| 2617 | size_t yyn = 0; |
| 2618 | char const *yyp = yystr; |
| 2619 | |
| 2620 | for (;;) |
| 2621 | switch (*++yyp) |
| 2622 | { |
| 2623 | case '\'': |
| 2624 | case ',': |
| 2625 | goto do_not_strip_quotes; |
| 2626 | |
| 2627 | case '\\': |
| 2628 | if (*++yyp != '\\') |
| 2629 | goto do_not_strip_quotes; |
| 2630 | /* Fall through. */ |
| 2631 | default: |
| 2632 | if (yyres) |
| 2633 | yyres[yyn] = *yyp; |
| 2634 | yyn++; |
| 2635 | break; |
| 2636 | |
| 2637 | case '"': |
| 2638 | if (yyres) |
| 2639 | yyres[yyn] = '\0'; |
| 2640 | return yyn; |
| 2641 | } |
| 2642 | do_not_strip_quotes: ; |
| 2643 | } |
| 2644 | |
| 2645 | if (! yyres) |
| 2646 | return yystrlen (yystr); |
| 2647 | |
| 2648 | return yystpcpy (yyres, yystr) - yyres; |
| 2649 | } |
| 2650 | # endif |
| 2651 | |
| 2652 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2653 | |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2654 | |
| 2655 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2656 | #if YYDEBUG |
| 2657 | /*--------------------------------. |
| 2658 | | Print this symbol on YYOUTPUT. | |
| 2659 | `--------------------------------*/ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2660 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2661 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2662 | static void |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2663 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2664 | #else |
| 2665 | static void |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2666 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2667 | FILE *yyoutput; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2668 | int yytype; |
| 2669 | YYSTYPE *yyvaluep; |
| 2670 | #endif |
| 2671 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2672 | /* Pacify ``unused variable'' warnings. */ |
| 2673 | (void) yyvaluep; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2674 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2675 | if (yytype < YYNTOKENS) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2676 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2677 | else |
| 2678 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2679 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2680 | |
| 2681 | # ifdef YYPRINT |
| 2682 | if (yytype < YYNTOKENS) |
| 2683 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2684 | # endif |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2685 | switch (yytype) |
| 2686 | { |
| 2687 | default: |
| 2688 | break; |
| 2689 | } |
| 2690 | YYFPRINTF (yyoutput, ")"); |
| 2691 | } |
| 2692 | |
| 2693 | #endif /* ! YYDEBUG */ |
| 2694 | /*-----------------------------------------------. |
| 2695 | | Release the memory associated to this symbol. | |
| 2696 | `-----------------------------------------------*/ |
| 2697 | |
| 2698 | #if defined (__STDC__) || defined (__cplusplus) |
| 2699 | static void |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2700 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2701 | #else |
| 2702 | static void |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2703 | yydestruct (yymsg, yytype, yyvaluep) |
| 2704 | const char *yymsg; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2705 | int yytype; |
| 2706 | YYSTYPE *yyvaluep; |
| 2707 | #endif |
| 2708 | { |
| 2709 | /* Pacify ``unused variable'' warnings. */ |
| 2710 | (void) yyvaluep; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2711 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2712 | if (!yymsg) |
| 2713 | yymsg = "Deleting"; |
| 2714 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2715 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2716 | switch (yytype) |
| 2717 | { |
| 2718 | |
| 2719 | default: |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2720 | break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2721 | } |
| 2722 | } |
| 2723 | |
| 2724 | |
| 2725 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2726 | |
| 2727 | #ifdef YYPARSE_PARAM |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2728 | # if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2729 | int yyparse (void *YYPARSE_PARAM); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2730 | # else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2731 | int yyparse (); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2732 | # endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2733 | #else /* ! YYPARSE_PARAM */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2734 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2735 | int yyparse (void); |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2736 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2737 | int yyparse (); |
| 2738 | #endif |
| 2739 | #endif /* ! YYPARSE_PARAM */ |
| 2740 | |
| 2741 | |
| 2742 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2743 | /* The look-ahead symbol. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2744 | int yychar; |
| 2745 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2746 | /* The semantic value of the look-ahead symbol. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2747 | YYSTYPE yylval; |
| 2748 | |
| 2749 | /* Number of syntax errors so far. */ |
| 2750 | int yynerrs; |
| 2751 | |
| 2752 | |
| 2753 | |
| 2754 | /*----------. |
| 2755 | | yyparse. | |
| 2756 | `----------*/ |
| 2757 | |
| 2758 | #ifdef YYPARSE_PARAM |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2759 | # if defined (__STDC__) || defined (__cplusplus) |
| 2760 | int yyparse (void *YYPARSE_PARAM) |
| 2761 | # else |
| 2762 | int yyparse (YYPARSE_PARAM) |
| 2763 | void *YYPARSE_PARAM; |
| 2764 | # endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2765 | #else /* ! YYPARSE_PARAM */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2766 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2767 | int |
| 2768 | yyparse (void) |
| 2769 | #else |
| 2770 | int |
| 2771 | yyparse () |
| 2772 | |
| 2773 | #endif |
| 2774 | #endif |
| 2775 | { |
| 2776 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2777 | int yystate; |
| 2778 | int yyn; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2779 | int yyresult; |
| 2780 | /* Number of tokens to shift before error messages enabled. */ |
| 2781 | int yyerrstatus; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2782 | /* Look-ahead token as an internal (translated) token number. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2783 | int yytoken = 0; |
| 2784 | |
| 2785 | /* Three stacks and their tools: |
| 2786 | `yyss': related to states, |
| 2787 | `yyvs': related to semantic values, |
| 2788 | `yyls': related to locations. |
| 2789 | |
| 2790 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2791 | to reallocate them elsewhere. */ |
| 2792 | |
| 2793 | /* The state stack. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2794 | short int yyssa[YYINITDEPTH]; |
| 2795 | short int *yyss = yyssa; |
| 2796 | short int *yyssp; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2797 | |
| 2798 | /* The semantic value stack. */ |
| 2799 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2800 | YYSTYPE *yyvs = yyvsa; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2801 | YYSTYPE *yyvsp; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2802 | |
| 2803 | |
| 2804 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2805 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2806 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2807 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2808 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2809 | /* The variables used to return semantic value and location from the |
| 2810 | action routines. */ |
| 2811 | YYSTYPE yyval; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2812 | |
| 2813 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2814 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2815 | rule. */ |
| 2816 | int yylen; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2817 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2818 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2819 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2820 | yystate = 0; |
| 2821 | yyerrstatus = 0; |
| 2822 | yynerrs = 0; |
| 2823 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2824 | |
| 2825 | /* Initialize stack pointers. |
| 2826 | Waste one element of value and location stack |
| 2827 | so that they stay on the same level as the state stack. |
| 2828 | The wasted elements are never initialized. */ |
| 2829 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2830 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2831 | yyvsp = yyvs; |
| 2832 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2833 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2834 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2835 | /*------------------------------------------------------------. |
| 2836 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2837 | `------------------------------------------------------------*/ |
| 2838 | yynewstate: |
| 2839 | /* In all cases, when you get here, the value and location stacks |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2840 | have just been pushed. so pushing a state here evens the stacks. |
| 2841 | */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2842 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2843 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2844 | yysetstate: |
| 2845 | *yyssp = yystate; |
| 2846 | |
| 2847 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2848 | { |
| 2849 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2850 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2851 | |
| 2852 | #ifdef yyoverflow |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2853 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2854 | /* Give user a chance to reallocate the stack. Use copies of |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2855 | these so that the &'s don't force the real ones into |
| 2856 | memory. */ |
| 2857 | YYSTYPE *yyvs1 = yyvs; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2858 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2859 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2860 | |
| 2861 | /* Each stack pointer address is followed by the size of the |
| 2862 | data in use in that stack, in bytes. This used to be a |
| 2863 | conditional around just the two extra args, but that might |
| 2864 | be undefined if yyoverflow is a macro. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2865 | yyoverflow (YY_("memory exhausted"), |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2866 | &yyss1, yysize * sizeof (*yyssp), |
| 2867 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2868 | |
| 2869 | &yystacksize); |
| 2870 | |
| 2871 | yyss = yyss1; |
| 2872 | yyvs = yyvs1; |
| 2873 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2874 | #else /* no yyoverflow */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2875 | # ifndef YYSTACK_RELOCATE |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2876 | goto yyexhaustedlab; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2877 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2878 | /* Extend the stack our own way. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2879 | if (YYMAXDEPTH <= yystacksize) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2880 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2881 | yystacksize *= 2; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2882 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2883 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2884 | |
| 2885 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2886 | short int *yyss1 = yyss; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2887 | union yyalloc *yyptr = |
| 2888 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2889 | if (! yyptr) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2890 | goto yyexhaustedlab; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2891 | YYSTACK_RELOCATE (yyss); |
| 2892 | YYSTACK_RELOCATE (yyvs); |
| 2893 | |
| 2894 | # undef YYSTACK_RELOCATE |
| 2895 | if (yyss1 != yyssa) |
| 2896 | YYSTACK_FREE (yyss1); |
| 2897 | } |
| 2898 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2899 | #endif /* no yyoverflow */ |
| 2900 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2901 | yyssp = yyss + yysize - 1; |
| 2902 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2903 | |
| 2904 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2905 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2906 | (unsigned long int) yystacksize)); |
| 2907 | |
| 2908 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2909 | YYABORT; |
| 2910 | } |
| 2911 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2912 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2913 | |
| 2914 | goto yybackup; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2915 | |
| 2916 | /*-----------. |
| 2917 | | yybackup. | |
| 2918 | `-----------*/ |
| 2919 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2920 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2921 | /* Do appropriate processing given the current state. */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2922 | /* Read a look-ahead token if we need one and don't already have one. */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2923 | /* yyresume: */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2924 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2925 | /* First try to decide what to do without reference to look-ahead token. */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2926 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2927 | yyn = yypact[yystate]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2928 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2929 | goto yydefault; |
| 2930 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2931 | /* 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] | 2932 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2933 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2934 | if (yychar == YYEMPTY) |
| 2935 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2936 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2937 | yychar = YYLEX; |
| 2938 | } |
| 2939 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2940 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2941 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2942 | yychar = yytoken = YYEOF; |
| 2943 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2944 | } |
| 2945 | else |
| 2946 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2947 | yytoken = YYTRANSLATE (yychar); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2948 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2949 | } |
| 2950 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2951 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 2952 | detect an error, take that action. */ |
| 2953 | yyn += yytoken; |
| 2954 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2955 | goto yydefault; |
| 2956 | yyn = yytable[yyn]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2957 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2958 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2959 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2960 | goto yyerrlab; |
| 2961 | yyn = -yyn; |
| 2962 | goto yyreduce; |
| 2963 | } |
| 2964 | |
| 2965 | if (yyn == YYFINAL) |
| 2966 | YYACCEPT; |
| 2967 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2968 | /* Shift the look-ahead token. */ |
| 2969 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2970 | |
| 2971 | /* Discard the token being shifted unless it is eof. */ |
| 2972 | if (yychar != YYEOF) |
| 2973 | yychar = YYEMPTY; |
| 2974 | |
| 2975 | *++yyvsp = yylval; |
| 2976 | |
| 2977 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2978 | /* Count tokens shifted since error; after three, turn off error |
| 2979 | status. */ |
| 2980 | if (yyerrstatus) |
| 2981 | yyerrstatus--; |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 2982 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2983 | yystate = yyn; |
| 2984 | goto yynewstate; |
| 2985 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2986 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2987 | /*-----------------------------------------------------------. |
| 2988 | | yydefault -- do the default action for the current state. | |
| 2989 | `-----------------------------------------------------------*/ |
| 2990 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2991 | yyn = yydefact[yystate]; |
| 2992 | if (yyn == 0) |
| 2993 | goto yyerrlab; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2994 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2995 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2996 | |
| 2997 | /*-----------------------------. |
| 2998 | | yyreduce -- Do a reduction. | |
| 2999 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3000 | yyreduce: |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3001 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3002 | yylen = yyr2[yyn]; |
| 3003 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3004 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3005 | `$$ = $1'. |
| 3006 | |
| 3007 | Otherwise, the following line sets YYVAL to garbage. |
| 3008 | This behavior is undocumented and Bison |
| 3009 | users should not rely upon it. Assigning to YYVAL |
| 3010 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3011 | GCC warning that YYVAL may be used uninitialized. */ |
| 3012 | yyval = yyvsp[1-yylen]; |
| 3013 | |
| 3014 | |
| 3015 | YY_REDUCE_PRINT (yyn); |
| 3016 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3017 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3018 | case 3: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3019 | #line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3020 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3021 | if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3022 | GEN_ERROR("Value too large for type!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3023 | (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3024 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3025 | ;} |
| 3026 | break; |
| 3027 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3028 | case 31: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3029 | #line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3030 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3031 | break; |
| 3032 | |
| 3033 | case 32: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3034 | #line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3035 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3036 | break; |
| 3037 | |
| 3038 | case 33: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3039 | #line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3040 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3041 | break; |
| 3042 | |
| 3043 | case 34: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3044 | #line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3045 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3046 | break; |
| 3047 | |
| 3048 | case 35: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3049 | #line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3050 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3051 | break; |
| 3052 | |
| 3053 | case 36: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3054 | #line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3055 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3056 | break; |
| 3057 | |
| 3058 | case 37: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3059 | #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3060 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3061 | break; |
| 3062 | |
| 3063 | case 38: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3064 | #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3065 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3066 | break; |
| 3067 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3068 | case 39: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3069 | #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3070 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3071 | break; |
| 3072 | |
| 3073 | case 40: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3074 | #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3075 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3076 | break; |
| 3077 | |
| 3078 | case 41: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3079 | #line 1060 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3080 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3081 | break; |
| 3082 | |
| 3083 | case 42: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3084 | #line 1060 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3085 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3086 | break; |
| 3087 | |
| 3088 | case 43: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3089 | #line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3090 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3091 | break; |
| 3092 | |
| 3093 | case 44: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3094 | #line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3095 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3096 | break; |
| 3097 | |
| 3098 | case 45: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3099 | #line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3100 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3101 | break; |
| 3102 | |
| 3103 | case 46: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3104 | #line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3105 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3106 | break; |
| 3107 | |
| 3108 | case 47: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3109 | #line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3110 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3111 | break; |
| 3112 | |
| 3113 | case 48: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3114 | #line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3115 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3116 | break; |
| 3117 | |
| 3118 | case 49: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3119 | #line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3120 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3121 | break; |
| 3122 | |
| 3123 | case 50: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3124 | #line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3125 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3126 | break; |
| 3127 | |
| 3128 | case 51: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3129 | #line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3130 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3131 | break; |
| 3132 | |
| 3133 | case 52: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3134 | #line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3135 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3136 | break; |
| 3137 | |
| 3138 | case 53: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3139 | #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3140 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3141 | break; |
| 3142 | |
| 3143 | case 54: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3144 | #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3145 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3146 | break; |
| 3147 | |
| 3148 | case 55: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3149 | #line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3150 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3151 | break; |
| 3152 | |
| 3153 | case 56: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3154 | #line 1068 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3155 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3156 | break; |
| 3157 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3158 | case 63: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3159 | #line 1077 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3160 | { |
| 3161 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
| 3162 | CHECK_FOR_ERROR |
| 3163 | ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3164 | break; |
| 3165 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3166 | case 64: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3167 | #line 1081 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3168 | { |
| 3169 | (yyval.StrVal) = 0; |
| 3170 | CHECK_FOR_ERROR |
| 3171 | ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3172 | break; |
| 3173 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3174 | case 65: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3175 | #line 1087 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3176 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3177 | break; |
| 3178 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3179 | case 66: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3180 | #line 1088 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3181 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3182 | break; |
| 3183 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3184 | case 67: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3185 | #line 1089 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3186 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3187 | break; |
| 3188 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3189 | case 68: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3190 | #line 1090 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3191 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3192 | break; |
| 3193 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3194 | case 69: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3195 | #line 1091 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3196 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3197 | break; |
| 3198 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3199 | case 70: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3200 | #line 1095 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3201 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3202 | break; |
| 3203 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3204 | case 71: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3205 | #line 1096 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3206 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3207 | break; |
| 3208 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3209 | case 72: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3210 | #line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3211 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3212 | break; |
| 3213 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3214 | case 73: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3215 | #line 1101 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3216 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3217 | break; |
| 3218 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3219 | case 74: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3220 | #line 1102 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3221 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3222 | break; |
| 3223 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3224 | case 75: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3225 | #line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3226 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3227 | break; |
| 3228 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3229 | case 76: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3230 | #line 1107 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3231 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3232 | break; |
| 3233 | |
| 3234 | case 77: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3235 | #line 1108 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3236 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3237 | break; |
| 3238 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3239 | case 78: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3240 | #line 1109 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3241 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3242 | break; |
| 3243 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3244 | case 79: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3245 | #line 1110 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3246 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3247 | break; |
| 3248 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3249 | case 80: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3250 | #line 1111 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3251 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3252 | break; |
| 3253 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3254 | case 81: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3255 | #line 1114 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3256 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3257 | break; |
| 3258 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3259 | case 82: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3260 | #line 1115 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3261 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3262 | break; |
| 3263 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3264 | case 83: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3265 | #line 1116 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3266 | { (yyval.UIntVal) = CallingConv::CSRet; ;} |
| 3267 | break; |
| 3268 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3269 | case 84: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3270 | #line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3271 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3272 | break; |
| 3273 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3274 | case 85: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3275 | #line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3276 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3277 | break; |
| 3278 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3279 | case 86: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3280 | #line 1119 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3281 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3282 | break; |
| 3283 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3284 | case 87: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3285 | #line 1120 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3286 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3287 | break; |
| 3288 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3289 | case 88: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3290 | #line 1121 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3291 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3292 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3293 | GEN_ERROR("Calling conv too large!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3294 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3295 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3296 | ;} |
| 3297 | break; |
| 3298 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3299 | case 89: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3300 | #line 1128 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3301 | { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;} |
| 3302 | break; |
| 3303 | |
| 3304 | case 90: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3305 | #line 1129 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3306 | { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;} |
| 3307 | break; |
| 3308 | |
| 3309 | case 91: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3310 | #line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3311 | { (yyval.ParamAttrs) = (yyvsp[0].ParamAttrs); ;} |
| 3312 | break; |
| 3313 | |
| 3314 | case 92: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3315 | #line 1133 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3316 | { |
| 3317 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-2].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3318 | ;} |
| 3319 | break; |
| 3320 | |
| 3321 | case 93: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3322 | #line 1138 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3323 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
| 3324 | break; |
| 3325 | |
| 3326 | case 94: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3327 | #line 1139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3328 | { (yyval.ParamAttrs) = (yyvsp[0].ParamAttrs); ;} |
| 3329 | break; |
| 3330 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3331 | case 95: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3332 | #line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3333 | { (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs); ;} |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3334 | break; |
| 3335 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3336 | case 96: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3337 | #line 1145 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3338 | { (yyval.UIntVal) = 0; ;} |
| 3339 | break; |
| 3340 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3341 | case 97: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3342 | #line 1146 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3343 | { |
| 3344 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3345 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3346 | GEN_ERROR("Alignment must be a power of two!"); |
| 3347 | CHECK_FOR_ERROR |
| 3348 | ;} |
| 3349 | break; |
| 3350 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3351 | case 98: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3352 | #line 1152 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3353 | { (yyval.UIntVal) = 0; ;} |
| 3354 | break; |
| 3355 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3356 | case 99: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3357 | #line 1153 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3358 | { |
| 3359 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3360 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3361 | GEN_ERROR("Alignment must be a power of two!"); |
| 3362 | CHECK_FOR_ERROR |
| 3363 | ;} |
| 3364 | break; |
| 3365 | |
| 3366 | case 100: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3367 | #line 1161 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3368 | { |
| 3369 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3370 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
| 3371 | GEN_ERROR("Invalid character in section name!"); |
| 3372 | (yyval.StrVal) = (yyvsp[0].StrVal); |
| 3373 | CHECK_FOR_ERROR |
| 3374 | ;} |
| 3375 | break; |
| 3376 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3377 | case 101: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3378 | #line 1169 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3379 | { (yyval.StrVal) = 0; ;} |
| 3380 | break; |
| 3381 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3382 | case 102: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3383 | #line 1170 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3384 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3385 | break; |
| 3386 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3387 | case 103: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3388 | #line 1175 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3389 | {;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3390 | break; |
| 3391 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3392 | case 104: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3393 | #line 1176 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3394 | {;} |
| 3395 | break; |
| 3396 | |
| 3397 | case 105: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3398 | #line 1177 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3399 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3400 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3401 | free((yyvsp[0].StrVal)); |
| 3402 | CHECK_FOR_ERROR |
| 3403 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3404 | break; |
| 3405 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3406 | case 106: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3407 | #line 1182 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3408 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3409 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
| 3410 | GEN_ERROR("Alignment must be a power of two!"); |
| 3411 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
| 3412 | CHECK_FOR_ERROR |
| 3413 | ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3414 | break; |
| 3415 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3416 | case 115: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3417 | #line 1198 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3418 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3419 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3420 | CHECK_FOR_ERROR |
| 3421 | ;} |
| 3422 | break; |
| 3423 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3424 | case 116: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3425 | #line 1202 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3426 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3427 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3428 | CHECK_FOR_ERROR |
| 3429 | ;} |
| 3430 | break; |
| 3431 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3432 | case 117: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3433 | #line 1206 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3434 | { // Pointer type? |
| 3435 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
| 3436 | GEN_ERROR("Cannot form a pointer to a basic block"); |
| 3437 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3438 | delete (yyvsp[-1].TypeVal); |
| 3439 | CHECK_FOR_ERROR |
| 3440 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3441 | break; |
| 3442 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3443 | case 118: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3444 | #line 1213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3445 | { // Named types are also simple types... |
| 3446 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
| 3447 | CHECK_FOR_ERROR |
| 3448 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 3449 | ;} |
| 3450 | break; |
| 3451 | |
| 3452 | case 119: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3453 | #line 1218 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3454 | { // Type UpReference |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3455 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3456 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3457 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3458 | (yyval.TypeVal) = new PATypeHolder(OT); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3459 | UR_OUT("New Upreference!\n"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3460 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3461 | ;} |
| 3462 | break; |
| 3463 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3464 | case 120: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3465 | #line 1226 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3466 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3467 | std::vector<const Type*> Params; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3468 | std::vector<FunctionType::ParameterAttributes> Attrs; |
| 3469 | Attrs.push_back((yyvsp[-3].ParamAttrs)); |
| 3470 | for (TypeWithAttrsList::iterator I=(yyvsp[-1].TypeWithAttrsList)->begin(), E=(yyvsp[-1].TypeWithAttrsList)->end(); I != E; ++I) { |
| 3471 | Params.push_back(I->Ty->get()); |
| 3472 | if (I->Ty->get() != Type::VoidTy) |
| 3473 | Attrs.push_back(I->Attrs); |
| 3474 | } |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3475 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3476 | if (isVarArg) Params.pop_back(); |
| 3477 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3478 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs); |
| 3479 | delete (yyvsp[-1].TypeWithAttrsList); // Delete the argument list |
| 3480 | delete (yyvsp[-4].TypeVal); // Delete the return type handle |
| 3481 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3482 | CHECK_FOR_ERROR |
| 3483 | ;} |
| 3484 | break; |
| 3485 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3486 | case 121: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3487 | #line 1244 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3488 | { |
| 3489 | std::vector<const Type*> Params; |
| 3490 | std::vector<FunctionType::ParameterAttributes> Attrs; |
| 3491 | Attrs.push_back((yyvsp[-3].ParamAttrs)); |
| 3492 | for (TypeWithAttrsList::iterator I=(yyvsp[-1].TypeWithAttrsList)->begin(), E=(yyvsp[-1].TypeWithAttrsList)->end(); I != E; ++I) { |
| 3493 | Params.push_back(I->Ty->get()); |
| 3494 | if (I->Ty->get() != Type::VoidTy) |
| 3495 | Attrs.push_back(I->Attrs); |
| 3496 | } |
| 3497 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3498 | if (isVarArg) Params.pop_back(); |
| 3499 | |
| 3500 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs); |
| 3501 | delete (yyvsp[-1].TypeWithAttrsList); // Delete the argument list |
| 3502 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
| 3503 | CHECK_FOR_ERROR |
| 3504 | ;} |
| 3505 | break; |
| 3506 | |
| 3507 | case 122: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3508 | #line 1262 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3509 | { // Sized array type? |
| 3510 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3511 | delete (yyvsp[-1].TypeVal); |
| 3512 | CHECK_FOR_ERROR |
| 3513 | ;} |
| 3514 | break; |
| 3515 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3516 | case 123: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3517 | #line 1267 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3518 | { // Packed array type? |
| 3519 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3520 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
| 3521 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3522 | if (!ElemTy->isPrimitiveType()) |
| 3523 | GEN_ERROR("Elemental type of a PackedType must be primitive"); |
| 3524 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
| 3525 | GEN_ERROR("Vector length should be a power of 2!"); |
| 3526 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3527 | delete (yyvsp[-1].TypeVal); |
| 3528 | CHECK_FOR_ERROR |
| 3529 | ;} |
| 3530 | break; |
| 3531 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3532 | case 124: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3533 | #line 1279 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3534 | { // Structure type? |
| 3535 | std::vector<const Type*> Elements; |
| 3536 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3537 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
| 3538 | Elements.push_back(*I); |
| 3539 | |
| 3540 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3541 | delete (yyvsp[-1].TypeList); |
| 3542 | CHECK_FOR_ERROR |
| 3543 | ;} |
| 3544 | break; |
| 3545 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3546 | case 125: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3547 | #line 1289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3548 | { // Empty structure type? |
| 3549 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
| 3550 | CHECK_FOR_ERROR |
| 3551 | ;} |
| 3552 | break; |
| 3553 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3554 | case 126: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3555 | #line 1293 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3556 | { |
| 3557 | std::vector<const Type*> Elements; |
| 3558 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 3559 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) |
| 3560 | Elements.push_back(*I); |
| 3561 | |
| 3562 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3563 | delete (yyvsp[-2].TypeList); |
| 3564 | CHECK_FOR_ERROR |
| 3565 | ;} |
| 3566 | break; |
| 3567 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3568 | case 127: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3569 | #line 1303 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3570 | { // Empty structure type? |
| 3571 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
| 3572 | CHECK_FOR_ERROR |
| 3573 | ;} |
| 3574 | break; |
| 3575 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3576 | case 128: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3577 | #line 1310 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3578 | { |
| 3579 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3580 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3581 | ;} |
| 3582 | break; |
| 3583 | |
| 3584 | case 129: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3585 | #line 1317 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3586 | { |
| 3587 | if (!UpRefs.empty()) |
| 3588 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3589 | if (!(*(yyvsp[-1].TypeVal))->isFirstClassType()) |
| 3590 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
| 3591 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3592 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3593 | ;} |
| 3594 | break; |
| 3595 | |
| 3596 | case 130: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3597 | #line 1325 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3598 | { |
| 3599 | (yyval.TypeWithAttrs).Ty = new PATypeHolder(Type::VoidTy); |
| 3600 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3601 | ;} |
| 3602 | break; |
| 3603 | |
| 3604 | case 131: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3605 | #line 1331 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3606 | { |
| 3607 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3608 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); |
| 3609 | CHECK_FOR_ERROR |
| 3610 | ;} |
| 3611 | break; |
| 3612 | |
| 3613 | case 132: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3614 | #line 1336 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3615 | { |
| 3616 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); |
| 3617 | CHECK_FOR_ERROR |
| 3618 | ;} |
| 3619 | break; |
| 3620 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3621 | case 134: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3622 | #line 1344 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3623 | { |
| 3624 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); |
| 3625 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3626 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
| 3627 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3628 | CHECK_FOR_ERROR |
| 3629 | ;} |
| 3630 | break; |
| 3631 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3632 | case 135: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3633 | #line 1351 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3634 | { |
| 3635 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
| 3636 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3637 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
| 3638 | (yyval.TypeWithAttrsList)->push_back(TWA); |
| 3639 | CHECK_FOR_ERROR |
| 3640 | ;} |
| 3641 | break; |
| 3642 | |
| 3643 | case 136: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3644 | #line 1358 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3645 | { |
| 3646 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3647 | CHECK_FOR_ERROR |
| 3648 | ;} |
| 3649 | break; |
| 3650 | |
| 3651 | case 137: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3652 | #line 1366 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3653 | { |
| 3654 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 3655 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3656 | CHECK_FOR_ERROR |
| 3657 | ;} |
| 3658 | break; |
| 3659 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3660 | case 138: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3661 | #line 1371 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3662 | { |
| 3663 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3664 | CHECK_FOR_ERROR |
| 3665 | ;} |
| 3666 | break; |
| 3667 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3668 | case 139: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3669 | #line 1382 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3670 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3671 | if (!UpRefs.empty()) |
| 3672 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3673 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
| 3674 | if (ATy == 0) |
| 3675 | GEN_ERROR("Cannot make array constant with type: '" + |
| 3676 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
| 3677 | const Type *ETy = ATy->getElementType(); |
| 3678 | int NumElements = ATy->getNumElements(); |
| 3679 | |
| 3680 | // Verify that we have the correct size... |
| 3681 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
| 3682 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
| 3683 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
| 3684 | itostr(NumElements) + "!"); |
| 3685 | |
| 3686 | // Verify all elements are correct type! |
| 3687 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3688 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
| 3689 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3690 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
| 3691 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
| 3692 | } |
| 3693 | |
| 3694 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3695 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3696 | CHECK_FOR_ERROR |
| 3697 | ;} |
| 3698 | break; |
| 3699 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3700 | case 140: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3701 | #line 1410 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3702 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3703 | if (!UpRefs.empty()) |
| 3704 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3705 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3706 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3707 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3708 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3709 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3710 | int NumElements = ATy->getNumElements(); |
| 3711 | if (NumElements != -1 && NumElements != 0) |
| 3712 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
| 3713 | " arguments, but has size of " + itostr(NumElements) +"!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3714 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3715 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3716 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3717 | ;} |
| 3718 | break; |
| 3719 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3720 | case 141: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3721 | #line 1426 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3722 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3723 | if (!UpRefs.empty()) |
| 3724 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3725 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3726 | if (ATy == 0) |
| 3727 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3728 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3729 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3730 | int NumElements = ATy->getNumElements(); |
| 3731 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3732 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 3733 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3734 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3735 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3736 | " when array has size " + itostr(NumElements) + "!"); |
| 3737 | std::vector<Constant*> Vals; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3738 | if (ETy == Type::Int8Ty) { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3739 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3740 | C != (unsigned char*)EndStr; ++C) |
| 3741 | Vals.push_back(ConstantInt::get(ETy, *C)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3742 | } else { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3743 | free((yyvsp[0].StrVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3744 | GEN_ERROR("Cannot build string arrays of non byte sized elements!"); |
| 3745 | } |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3746 | free((yyvsp[0].StrVal)); |
| 3747 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3748 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3749 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3750 | ;} |
| 3751 | break; |
| 3752 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3753 | case 142: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3754 | #line 1455 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3755 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3756 | if (!UpRefs.empty()) |
| 3757 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3758 | const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3759 | if (PTy == 0) |
| 3760 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3761 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3762 | const Type *ETy = PTy->getElementType(); |
| 3763 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3764 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3765 | // Verify that we have the correct size... |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3766 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3767 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3768 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3769 | itostr(NumElements) + "!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3770 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3771 | // Verify all elements are correct type! |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3772 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3773 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3774 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3775 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3776 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3777 | } |
| 3778 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3779 | (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); |
| 3780 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3781 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3782 | ;} |
| 3783 | break; |
| 3784 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3785 | case 143: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3786 | #line 1483 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3787 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3788 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3789 | if (STy == 0) |
| 3790 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3791 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3792 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3793 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3794 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3795 | |
| 3796 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3797 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
| 3798 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3799 | GEN_ERROR("Expected type '" + |
| 3800 | STy->getElementType(i)->getDescription() + |
| 3801 | "' for element #" + utostr(i) + |
| 3802 | " of structure initializer!"); |
| 3803 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3804 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 3805 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3806 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3807 | ;} |
| 3808 | break; |
| 3809 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3810 | case 144: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3811 | #line 1504 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3812 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3813 | if (!UpRefs.empty()) |
| 3814 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3815 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3816 | if (STy == 0) |
| 3817 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3818 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3819 | |
| 3820 | if (STy->getNumContainedTypes() != 0) |
| 3821 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3822 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3823 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3824 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3825 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3826 | ;} |
| 3827 | break; |
| 3828 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3829 | case 145: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3830 | #line 1519 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3831 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3832 | if (!UpRefs.empty()) |
| 3833 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3834 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3835 | if (PTy == 0) |
| 3836 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3837 | (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3838 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3839 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 3840 | delete (yyvsp[-1].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3841 | CHECK_FOR_ERROR |
| 3842 | ;} |
| 3843 | break; |
| 3844 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3845 | case 146: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3846 | #line 1531 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3847 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3848 | if (!UpRefs.empty()) |
| 3849 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3850 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 3851 | delete (yyvsp[-1].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3852 | CHECK_FOR_ERROR |
| 3853 | ;} |
| 3854 | break; |
| 3855 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3856 | case 147: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3857 | #line 1538 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3858 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3859 | if (!UpRefs.empty()) |
| 3860 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3861 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3862 | if (Ty == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3863 | GEN_ERROR("Global const reference must be a pointer type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3864 | |
| 3865 | // ConstExprs can exist in the body of a function, thus creating |
| 3866 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3867 | // the context of a function, getValNonImprovising will search the functions |
| 3868 | // symbol table instead of the module symbol table for the global symbol, |
| 3869 | // which throws things all off. To get around this, we just tell |
| 3870 | // getValNonImprovising that we are at global scope here. |
| 3871 | // |
| 3872 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3873 | CurFun.CurrentFunction = 0; |
| 3874 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3875 | Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3876 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3877 | |
| 3878 | CurFun.CurrentFunction = SavedCurFn; |
| 3879 | |
| 3880 | // If this is an initializer for a constant pointer, which is referencing a |
| 3881 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3882 | // in the future with the right type of variable. |
| 3883 | // |
| 3884 | if (V == 0) { |
| 3885 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 3886 | const PointerType *PT = cast<PointerType>(Ty); |
| 3887 | |
| 3888 | // First check to see if the forward references value is already created! |
| 3889 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3890 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3891 | |
| 3892 | if (I != CurModule.GlobalRefs.end()) { |
| 3893 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3894 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3895 | } else { |
| 3896 | std::string Name; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3897 | if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3898 | |
| 3899 | // Create the forward referenced global. |
| 3900 | GlobalValue *GV; |
| 3901 | if (const FunctionType *FTy = |
| 3902 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3903 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3904 | CurModule.CurrentModule); |
| 3905 | } else { |
| 3906 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3907 | GlobalValue::ExternalLinkage, 0, |
| 3908 | Name, CurModule.CurrentModule); |
| 3909 | } |
| 3910 | |
| 3911 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3912 | 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] | 3913 | V = GV; |
| 3914 | } |
| 3915 | } |
| 3916 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3917 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 3918 | delete (yyvsp[-1].TypeVal); // Free the type handle |
| 3919 | CHECK_FOR_ERROR |
| 3920 | ;} |
| 3921 | break; |
| 3922 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3923 | case 148: |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3924 | #line 1601 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3925 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3926 | if (!UpRefs.empty()) |
| 3927 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3928 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3929 | GEN_ERROR("Mismatched types for constant expression: " + |
| 3930 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3931 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 3932 | delete (yyvsp[-1].TypeVal); |
| 3933 | CHECK_FOR_ERROR |
| 3934 | ;} |
| 3935 | break; |
| 3936 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3937 | case 149: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3938 | #line 1611 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3939 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3940 | if (!UpRefs.empty()) |
| 3941 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3942 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
| 3943 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 3944 | GEN_ERROR("Cannot create a null initialized value of this type!"); |
| 3945 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 3946 | delete (yyvsp[-1].TypeVal); |
| 3947 | CHECK_FOR_ERROR |
| 3948 | ;} |
| 3949 | break; |
| 3950 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3951 | case 150: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3952 | #line 1621 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3953 | { // integral constants |
| 3954 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
| 3955 | GEN_ERROR("Constant value doesn't fit in type!"); |
| 3956 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); |
| 3957 | CHECK_FOR_ERROR |
| 3958 | ;} |
| 3959 | break; |
| 3960 | |
| 3961 | case 151: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3962 | #line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3963 | { // integral constants |
| 3964 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
| 3965 | GEN_ERROR("Constant value doesn't fit in type!"); |
| 3966 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); |
| 3967 | CHECK_FOR_ERROR |
| 3968 | ;} |
| 3969 | break; |
| 3970 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3971 | case 152: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3972 | #line 1633 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3973 | { // Boolean constants |
| 3974 | (yyval.ConstVal) = ConstantBool::getTrue(); |
| 3975 | CHECK_FOR_ERROR |
| 3976 | ;} |
| 3977 | break; |
| 3978 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3979 | case 153: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3980 | #line 1637 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3981 | { // Boolean constants |
| 3982 | (yyval.ConstVal) = ConstantBool::getFalse(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3983 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3984 | ;} |
| 3985 | break; |
| 3986 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3987 | case 154: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3988 | #line 1641 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3989 | { // Float & Double constants |
| 3990 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
| 3991 | GEN_ERROR("Floating point constant invalid for type!!"); |
| 3992 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
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 | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3997 | case 155: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 3998 | #line 1649 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3999 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4000 | if (!UpRefs.empty()) |
| 4001 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4002 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4003 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4004 | if (!Val->getType()->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4005 | GEN_ERROR("cast constant expression from a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4006 | Val->getType()->getDescription() + "'!"); |
| 4007 | if (!Ty->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4008 | GEN_ERROR("cast constant expression to a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4009 | Ty->getDescription() + "'!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4010 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get()); |
| 4011 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4012 | ;} |
| 4013 | break; |
| 4014 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4015 | case 156: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4016 | #line 1663 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4017 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4018 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4019 | GEN_ERROR("GetElementPtr requires a pointer operand!"); |
| 4020 | |
| 4021 | const Type *IdxTy = |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4022 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4023 | if (!IdxTy) |
| 4024 | GEN_ERROR("Index list invalid for constant getelementptr!"); |
| 4025 | |
| 4026 | std::vector<Constant*> IdxVec; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4027 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 4028 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4029 | IdxVec.push_back(C); |
| 4030 | else |
| 4031 | GEN_ERROR("Indices to constant getelementptr must be constants!"); |
| 4032 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4033 | delete (yyvsp[-1].ValueList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4034 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4035 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); |
| 4036 | CHECK_FOR_ERROR |
| 4037 | ;} |
| 4038 | break; |
| 4039 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4040 | case 157: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4041 | #line 1684 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4042 | { |
| 4043 | if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) |
| 4044 | GEN_ERROR("Select condition must be of boolean type!"); |
| 4045 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4046 | GEN_ERROR("Select operand types must match!"); |
| 4047 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4048 | CHECK_FOR_ERROR |
| 4049 | ;} |
| 4050 | break; |
| 4051 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4052 | case 158: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4053 | #line 1692 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4054 | { |
| 4055 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4056 | GEN_ERROR("Binary operator types must match!"); |
| 4057 | CHECK_FOR_ERROR; |
| 4058 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4059 | ;} |
| 4060 | break; |
| 4061 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4062 | case 159: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4063 | #line 1698 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4064 | { |
| 4065 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4066 | GEN_ERROR("Logical operator types must match!"); |
| 4067 | if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) { |
| 4068 | if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) || |
| 4069 | !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) |
| 4070 | GEN_ERROR("Logical operator requires integral operands!"); |
| 4071 | } |
| 4072 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4073 | CHECK_FOR_ERROR |
| 4074 | ;} |
| 4075 | break; |
| 4076 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4077 | case 160: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4078 | #line 1709 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4079 | { |
| 4080 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4081 | GEN_ERROR("icmp operand types must match!"); |
| 4082 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4083 | ;} |
| 4084 | break; |
| 4085 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4086 | case 161: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4087 | #line 1714 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4088 | { |
| 4089 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4090 | GEN_ERROR("fcmp operand types must match!"); |
| 4091 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4092 | ;} |
| 4093 | break; |
| 4094 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4095 | case 162: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4096 | #line 1719 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4097 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4098 | if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty) |
| 4099 | GEN_ERROR("Shift count for shift constant must be i8 type!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4100 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) |
| 4101 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 4102 | CHECK_FOR_ERROR; |
| 4103 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4104 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4105 | ;} |
| 4106 | break; |
| 4107 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4108 | case 163: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4109 | #line 1728 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4110 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4111 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
| 4112 | GEN_ERROR("Invalid extractelement operands!"); |
| 4113 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4114 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4115 | ;} |
| 4116 | break; |
| 4117 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4118 | case 164: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4119 | #line 1734 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4120 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4121 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
| 4122 | GEN_ERROR("Invalid insertelement operands!"); |
| 4123 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4124 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4125 | ;} |
| 4126 | break; |
| 4127 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4128 | case 165: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4129 | #line 1740 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4130 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4131 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
| 4132 | GEN_ERROR("Invalid shufflevector operands!"); |
| 4133 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4134 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4135 | ;} |
| 4136 | break; |
| 4137 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4138 | case 166: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4139 | #line 1749 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4140 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4141 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4142 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4143 | ;} |
| 4144 | break; |
| 4145 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4146 | case 167: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4147 | #line 1753 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4148 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4149 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4150 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
| 4151 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4152 | ;} |
| 4153 | break; |
| 4154 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4155 | case 168: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4156 | #line 1761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4157 | { (yyval.BoolVal) = false; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4158 | break; |
| 4159 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4160 | case 169: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4161 | #line 1761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4162 | { (yyval.BoolVal) = true; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4163 | break; |
| 4164 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4165 | case 170: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4166 | #line 1772 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4167 | { |
| 4168 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 4169 | CurModule.ModuleDone(); |
| 4170 | CHECK_FOR_ERROR; |
| 4171 | ;} |
| 4172 | break; |
| 4173 | |
| 4174 | case 171: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4175 | #line 1777 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4176 | { |
| 4177 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 4178 | CurModule.ModuleDone(); |
| 4179 | CHECK_FOR_ERROR; |
| 4180 | ;} |
| 4181 | break; |
| 4182 | |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4183 | case 174: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4184 | #line 1790 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4185 | { CurFun.isDeclare = false ;} |
| 4186 | break; |
| 4187 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4188 | case 175: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4189 | #line 1790 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4190 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4191 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4192 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4193 | ;} |
| 4194 | break; |
| 4195 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4196 | case 176: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4197 | #line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4198 | { CurFun.isDeclare = true; ;} |
| 4199 | break; |
| 4200 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4201 | case 177: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4202 | #line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4203 | { |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4204 | CHECK_FOR_ERROR |
| 4205 | ;} |
| 4206 | break; |
| 4207 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4208 | case 178: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4209 | #line 1797 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4210 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4211 | CHECK_FOR_ERROR |
| 4212 | ;} |
| 4213 | break; |
| 4214 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4215 | case 179: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4216 | #line 1800 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4217 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4218 | // Emit an error if there are any unresolved types left. |
| 4219 | if (!CurModule.LateResolveTypes.empty()) { |
| 4220 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4221 | if (DID.Type == ValID::NameVal) { |
| 4222 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4223 | } else { |
| 4224 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4225 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4226 | } |
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 | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4231 | case 180: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4232 | #line 1812 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4233 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4234 | if (!UpRefs.empty()) |
| 4235 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4236 | // Eagerly resolve types. This is not an optimization, this is a |
| 4237 | // requirement that is due to the fact that we could have this: |
| 4238 | // |
| 4239 | // %list = type { %list * } |
| 4240 | // %list = type { %list * } ; repeated type decl |
| 4241 | // |
| 4242 | // If types are not resolved eagerly, then the two types will not be |
| 4243 | // determined to be the same type! |
| 4244 | // |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4245 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4246 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4247 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4248 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4249 | // If this is a named type that is not a redefinition, add it to the slot |
| 4250 | // table. |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4251 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4252 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4253 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4254 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4255 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4256 | ;} |
| 4257 | break; |
| 4258 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4259 | case 181: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4260 | #line 1836 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4261 | { |
| 4262 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); |
| 4263 | |
| 4264 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
| 4265 | CHECK_FOR_ERROR |
| 4266 | // If this is a named type that is not a redefinition, add it to the slot |
| 4267 | // table. |
| 4268 | CurModule.Types.push_back((yyvsp[0].PrimType)); |
| 4269 | } |
| 4270 | CHECK_FOR_ERROR |
| 4271 | ;} |
| 4272 | break; |
| 4273 | |
| 4274 | case 182: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4275 | #line 1847 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4276 | { /* "Externally Visible" Linkage */ |
| 4277 | if ((yyvsp[0].ConstVal) == 0) |
| 4278 | GEN_ERROR("Global value initializer is not a constant!"); |
| 4279 | CurGV = ParseGlobalVariable((yyvsp[-2].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), |
| 4280 | (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4281 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4282 | ;} |
| 4283 | break; |
| 4284 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4285 | case 183: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4286 | #line 1853 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4287 | { |
| 4288 | CurGV = 0; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4289 | ;} |
| 4290 | break; |
| 4291 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4292 | case 184: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4293 | #line 1856 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4294 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4295 | if ((yyvsp[0].ConstVal) == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4296 | GEN_ERROR("Global value initializer is not a constant!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4297 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
| 4298 | CHECK_FOR_ERROR |
| 4299 | ;} |
| 4300 | break; |
| 4301 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4302 | case 185: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4303 | #line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4304 | { |
| 4305 | CurGV = 0; |
| 4306 | ;} |
| 4307 | break; |
| 4308 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4309 | case 186: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4310 | #line 1864 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4311 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4312 | if (!UpRefs.empty()) |
| 4313 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4314 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4315 | CHECK_FOR_ERROR |
| 4316 | delete (yyvsp[0].TypeVal); |
| 4317 | ;} |
| 4318 | break; |
| 4319 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4320 | case 187: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4321 | #line 1870 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4322 | { |
| 4323 | CurGV = 0; |
| 4324 | CHECK_FOR_ERROR |
| 4325 | ;} |
| 4326 | break; |
| 4327 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4328 | case 188: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4329 | #line 1874 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4330 | { |
| 4331 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4332 | ;} |
| 4333 | break; |
| 4334 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4335 | case 189: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4336 | #line 1877 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4337 | { |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4338 | CHECK_FOR_ERROR |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4339 | ;} |
| 4340 | break; |
| 4341 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4342 | case 190: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4343 | #line 1883 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4344 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4345 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4346 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4347 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4348 | free((yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4349 | |
| 4350 | if (AsmSoFar.empty()) |
| 4351 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4352 | else |
| 4353 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
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 | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4358 | case 191: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4359 | #line 1896 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4360 | { (yyval.Endianness) = Module::BigEndian; ;} |
| 4361 | break; |
| 4362 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4363 | case 192: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4364 | #line 1897 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4365 | { (yyval.Endianness) = Module::LittleEndian; ;} |
| 4366 | break; |
| 4367 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4368 | case 193: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4369 | #line 1899 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4370 | { |
| 4371 | CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); |
| 4372 | CHECK_FOR_ERROR |
| 4373 | ;} |
| 4374 | break; |
| 4375 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4376 | case 194: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4377 | #line 1903 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4378 | { |
| 4379 | if ((yyvsp[0].UInt64Val) == 32) |
| 4380 | CurModule.CurrentModule->setPointerSize(Module::Pointer32); |
| 4381 | else if ((yyvsp[0].UInt64Val) == 64) |
| 4382 | CurModule.CurrentModule->setPointerSize(Module::Pointer64); |
| 4383 | else |
| 4384 | GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); |
| 4385 | CHECK_FOR_ERROR |
| 4386 | ;} |
| 4387 | break; |
| 4388 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4389 | case 195: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4390 | #line 1912 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4391 | { |
| 4392 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4393 | free((yyvsp[0].StrVal)); |
| 4394 | ;} |
| 4395 | break; |
| 4396 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4397 | case 196: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4398 | #line 1916 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4399 | { |
| 4400 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4401 | free((yyvsp[0].StrVal)); |
| 4402 | ;} |
| 4403 | break; |
| 4404 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4405 | case 198: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4406 | #line 1923 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4407 | { |
| 4408 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4409 | free((yyvsp[0].StrVal)); |
| 4410 | CHECK_FOR_ERROR |
| 4411 | ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4412 | break; |
| 4413 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4414 | case 199: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4415 | #line 1928 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4416 | { |
| 4417 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4418 | free((yyvsp[0].StrVal)); |
| 4419 | CHECK_FOR_ERROR |
| 4420 | ;} |
| 4421 | break; |
| 4422 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4423 | case 200: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4424 | #line 1933 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4425 | { |
| 4426 | CHECK_FOR_ERROR |
| 4427 | ;} |
| 4428 | break; |
| 4429 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4430 | case 204: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4431 | #line 1943 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 4432 | { (yyval.StrVal) = 0; ;} |
| 4433 | break; |
| 4434 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4435 | case 205: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4436 | #line 1945 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4437 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4438 | if (!UpRefs.empty()) |
| 4439 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4440 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
| 4441 | GEN_ERROR("void typed arguments are invalid!"); |
| 4442 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4443 | (yyval.ArgList) = (yyvsp[-4].ArgList); |
| 4444 | (yyvsp[-4].ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4445 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4446 | ;} |
| 4447 | break; |
| 4448 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4449 | case 206: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4450 | #line 1955 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4451 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4452 | if (!UpRefs.empty()) |
| 4453 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4454 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
| 4455 | GEN_ERROR("void typed arguments are invalid!"); |
| 4456 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4457 | (yyval.ArgList) = new ArgListType; |
| 4458 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4459 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4460 | ;} |
| 4461 | break; |
| 4462 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4463 | case 207: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4464 | #line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4465 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4466 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4467 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4468 | ;} |
| 4469 | break; |
| 4470 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4471 | case 208: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4472 | #line 1970 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4473 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4474 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4475 | struct ArgListEntry E; |
| 4476 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4477 | E.Name = 0; |
| 4478 | E.Attrs = FunctionType::NoAttributeSet; |
| 4479 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4480 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4481 | ;} |
| 4482 | break; |
| 4483 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4484 | case 209: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4485 | #line 1979 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4486 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4487 | (yyval.ArgList) = new ArgListType; |
| 4488 | struct ArgListEntry E; |
| 4489 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4490 | E.Name = 0; |
| 4491 | E.Attrs = FunctionType::NoAttributeSet; |
| 4492 | (yyval.ArgList)->push_back(E); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4493 | CHECK_FOR_ERROR |
| 4494 | ;} |
| 4495 | break; |
| 4496 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4497 | case 210: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4498 | #line 1988 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4499 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4500 | (yyval.ArgList) = 0; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4501 | CHECK_FOR_ERROR |
| 4502 | ;} |
| 4503 | break; |
| 4504 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4505 | case 211: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4506 | #line 1994 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4507 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4508 | UnEscapeLexed((yyvsp[-5].StrVal)); |
| 4509 | std::string FunctionName((yyvsp[-5].StrVal)); |
| 4510 | free((yyvsp[-5].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4511 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4512 | // Check the function result for abstractness if this is a define. We should |
| 4513 | // have no abstract types at this point |
| 4514 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-6].TypeWithAttrs).Ty)) |
| 4515 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-6].TypeWithAttrs).Ty->get()->getDescription()); |
| 4516 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4517 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4518 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; |
| 4519 | ParamAttrs.push_back((yyvsp[-6].TypeWithAttrs).Attrs); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4520 | if ((yyvsp[-3].ArgList)) { // If there are arguments... |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4521 | for (ArgListType::iterator I = (yyvsp[-3].ArgList)->begin(); I != (yyvsp[-3].ArgList)->end(); ++I) { |
| 4522 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4523 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4524 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4525 | ParamTypeList.push_back(Ty); |
| 4526 | if (Ty != Type::VoidTy) |
| 4527 | ParamAttrs.push_back(I->Attrs); |
| 4528 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4529 | } |
| 4530 | |
| 4531 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4532 | if (isVarArg) ParamTypeList.pop_back(); |
| 4533 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4534 | FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeWithAttrs).Ty, ParamTypeList, isVarArg, |
| 4535 | ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4536 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4537 | delete (yyvsp[-6].TypeWithAttrs).Ty; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4538 | |
| 4539 | ValID ID; |
| 4540 | if (!FunctionName.empty()) { |
| 4541 | ID = ValID::create((char*)FunctionName.c_str()); |
| 4542 | } else { |
| 4543 | ID = ValID::create((int)CurModule.Values[PFT].size()); |
| 4544 | } |
| 4545 | |
| 4546 | Function *Fn = 0; |
| 4547 | // See if this function was forward referenced. If so, recycle the object. |
| 4548 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4549 | // Move the function to the end of the list, from whereever it was |
| 4550 | // previously inserted. |
| 4551 | Fn = cast<Function>(FWRef); |
| 4552 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4553 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4554 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4555 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4556 | // If this is the case, either we need to be a forward decl, or it needs |
| 4557 | // to be. |
| 4558 | if (!CurFun.isDeclare && !Fn->isExternal()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4559 | GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4560 | |
| 4561 | // Make sure to strip off any argument names so we can't get conflicts. |
| 4562 | if (Fn->isExternal()) |
| 4563 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4564 | AI != AE; ++AI) |
| 4565 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4566 | } else { // Not already defined? |
| 4567 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4568 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4569 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4570 | InsertValue(Fn, CurModule.Values); |
| 4571 | } |
| 4572 | |
| 4573 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4574 | |
| 4575 | if (CurFun.isDeclare) { |
| 4576 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4577 | // correctly handle cases, when pointer to function is passed as argument to |
| 4578 | // another function. |
| 4579 | Fn->setLinkage(CurFun.Linkage); |
| 4580 | } |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4581 | Fn->setCallingConv((yyvsp[-7].UIntVal)); |
| 4582 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4583 | if ((yyvsp[-1].StrVal)) { |
| 4584 | Fn->setSection((yyvsp[-1].StrVal)); |
| 4585 | free((yyvsp[-1].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4586 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4587 | |
| 4588 | // Add all of the arguments we parsed to the function... |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4589 | if ((yyvsp[-3].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4590 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4591 | assert((yyvsp[-3].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().Name == 0&& |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4592 | "Not a varargs marker!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4593 | delete (yyvsp[-3].ArgList)->back().Ty; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4594 | (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4595 | } |
| 4596 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4597 | unsigned Idx = 1; |
| 4598 | for (ArgListType::iterator I = (yyvsp[-3].ArgList)->begin(); I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) { |
| 4599 | delete I->Ty; // Delete the typeholder... |
| 4600 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4601 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4602 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4603 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4604 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4605 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4606 | delete (yyvsp[-3].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4607 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4608 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4609 | ;} |
| 4610 | break; |
| 4611 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4612 | case 214: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4613 | #line 2100 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4614 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4615 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4616 | |
| 4617 | // Make sure that we keep track of the linkage type even if there was a |
| 4618 | // previous "declare". |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4619 | (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4620 | ;} |
| 4621 | break; |
| 4622 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4623 | case 217: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4624 | #line 2110 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4625 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4626 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4627 | CHECK_FOR_ERROR |
| 4628 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4629 | break; |
| 4630 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4631 | case 218: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4632 | #line 2115 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4633 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4634 | CurFun.CurrentFunction->setLinkage((yyvsp[-1].Linkage)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4635 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4636 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4637 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4638 | ;} |
| 4639 | break; |
| 4640 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4641 | case 219: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4642 | #line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4643 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4644 | (yyval.BoolVal) = false; |
| 4645 | CHECK_FOR_ERROR |
| 4646 | ;} |
| 4647 | break; |
| 4648 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4649 | case 220: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4650 | #line 2130 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4651 | { |
| 4652 | (yyval.BoolVal) = true; |
| 4653 | CHECK_FOR_ERROR |
| 4654 | ;} |
| 4655 | break; |
| 4656 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4657 | case 221: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4658 | #line 2135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4659 | { // A reference to a direct constant |
| 4660 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
| 4661 | CHECK_FOR_ERROR |
| 4662 | ;} |
| 4663 | break; |
| 4664 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4665 | case 222: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4666 | #line 2139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4667 | { |
| 4668 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
| 4669 | CHECK_FOR_ERROR |
| 4670 | ;} |
| 4671 | break; |
| 4672 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4673 | case 223: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4674 | #line 2143 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4675 | { // Perhaps it's an FP constant? |
| 4676 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
| 4677 | CHECK_FOR_ERROR |
| 4678 | ;} |
| 4679 | break; |
| 4680 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4681 | case 224: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4682 | #line 2147 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4683 | { |
| 4684 | (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); |
| 4685 | CHECK_FOR_ERROR |
| 4686 | ;} |
| 4687 | break; |
| 4688 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4689 | case 225: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4690 | #line 2151 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4691 | { |
| 4692 | (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); |
| 4693 | CHECK_FOR_ERROR |
| 4694 | ;} |
| 4695 | break; |
| 4696 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4697 | case 226: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4698 | #line 2155 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4699 | { |
| 4700 | (yyval.ValIDVal) = ValID::createNull(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4701 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4702 | ;} |
| 4703 | break; |
| 4704 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4705 | case 227: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4706 | #line 2159 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4707 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4708 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4709 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4710 | ;} |
| 4711 | break; |
| 4712 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4713 | case 228: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4714 | #line 2163 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4715 | { // A vector zero constant. |
| 4716 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4717 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4718 | ;} |
| 4719 | break; |
| 4720 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4721 | case 229: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4722 | #line 2167 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4723 | { // Nonempty unsized packed vector |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4724 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
| 4725 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4726 | |
| 4727 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 4728 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4729 | HandleUpRefs( |
| 4730 | PackedType::get( |
| 4731 | ETy, |
| 4732 | NumElements) |
| 4733 | ) |
| 4734 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4735 | |
| 4736 | // Verify all elements are correct type! |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4737 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4738 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4739 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4740 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4741 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4742 | } |
| 4743 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4744 | (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); |
| 4745 | delete PTy; delete (yyvsp[-1].ConstVector); |
| 4746 | CHECK_FOR_ERROR |
| 4747 | ;} |
| 4748 | break; |
| 4749 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4750 | case 230: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4751 | #line 2192 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4752 | { |
| 4753 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
| 4754 | CHECK_FOR_ERROR |
| 4755 | ;} |
| 4756 | break; |
| 4757 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4758 | case 231: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4759 | #line 2196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4760 | { |
| 4761 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 4762 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 4763 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4764 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 4765 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 4766 | free((yyvsp[-2].StrVal)); |
| 4767 | free((yyvsp[0].StrVal)); |
| 4768 | CHECK_FOR_ERROR |
| 4769 | ;} |
| 4770 | break; |
| 4771 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4772 | case 232: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4773 | #line 2210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4774 | { // Is it an integer reference...? |
| 4775 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); |
| 4776 | CHECK_FOR_ERROR |
| 4777 | ;} |
| 4778 | break; |
| 4779 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4780 | case 233: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4781 | #line 2214 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4782 | { // Is it a named reference...? |
| 4783 | (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); |
| 4784 | CHECK_FOR_ERROR |
| 4785 | ;} |
| 4786 | break; |
| 4787 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4788 | case 236: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4789 | #line 2226 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4790 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4791 | if (!UpRefs.empty()) |
| 4792 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4793 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
| 4794 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4795 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4796 | ;} |
| 4797 | break; |
| 4798 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4799 | case 237: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4800 | #line 2235 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4801 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4802 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4803 | CHECK_FOR_ERROR |
| 4804 | ;} |
| 4805 | break; |
| 4806 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4807 | case 238: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4808 | #line 2239 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4809 | { // Do not allow functions with 0 basic blocks |
| 4810 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4811 | CHECK_FOR_ERROR |
| 4812 | ;} |
| 4813 | break; |
| 4814 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4815 | case 239: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4816 | #line 2248 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4817 | { |
| 4818 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
| 4819 | CHECK_FOR_ERROR |
| 4820 | InsertValue((yyvsp[0].TermInstVal)); |
| 4821 | |
| 4822 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 4823 | InsertValue((yyvsp[-2].BasicBlockVal)); |
| 4824 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4825 | CHECK_FOR_ERROR |
| 4826 | ;} |
| 4827 | break; |
| 4828 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4829 | case 240: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4830 | #line 2259 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4831 | { |
| 4832 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
| 4833 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4834 | if (CI2->getParent() == 0) |
| 4835 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
| 4836 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 4837 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
| 4838 | CHECK_FOR_ERROR |
| 4839 | ;} |
| 4840 | break; |
| 4841 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4842 | case 241: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4843 | #line 2268 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4844 | { |
| 4845 | (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); |
| 4846 | CHECK_FOR_ERROR |
| 4847 | |
| 4848 | // Make sure to move the basic block to the correct location in the |
| 4849 | // function, instead of leaving it inserted wherever it was first |
| 4850 | // referenced. |
| 4851 | Function::BasicBlockListType &BBL = |
| 4852 | CurFun.CurrentFunction->getBasicBlockList(); |
| 4853 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
| 4854 | CHECK_FOR_ERROR |
| 4855 | ;} |
| 4856 | break; |
| 4857 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4858 | case 242: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4859 | #line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4860 | { |
| 4861 | (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true); |
| 4862 | CHECK_FOR_ERROR |
| 4863 | |
| 4864 | // Make sure to move the basic block to the correct location in the |
| 4865 | // function, instead of leaving it inserted wherever it was first |
| 4866 | // referenced. |
| 4867 | Function::BasicBlockListType &BBL = |
| 4868 | CurFun.CurrentFunction->getBasicBlockList(); |
| 4869 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4870 | CHECK_FOR_ERROR |
| 4871 | ;} |
| 4872 | break; |
| 4873 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4874 | case 243: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4875 | #line 2293 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4876 | { // Return with a result... |
| 4877 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4878 | CHECK_FOR_ERROR |
| 4879 | ;} |
| 4880 | break; |
| 4881 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4882 | case 244: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4883 | #line 2297 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4884 | { // Return with no result... |
| 4885 | (yyval.TermInstVal) = new ReturnInst(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4886 | CHECK_FOR_ERROR |
| 4887 | ;} |
| 4888 | break; |
| 4889 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4890 | case 245: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4891 | #line 2301 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4892 | { // Unconditional Branch... |
| 4893 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4894 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4895 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4896 | ;} |
| 4897 | break; |
| 4898 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4899 | case 246: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4900 | #line 2306 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4901 | { |
| 4902 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4903 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4904 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4905 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4906 | Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); |
| 4907 | CHECK_FOR_ERROR |
| 4908 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4909 | ;} |
| 4910 | break; |
| 4911 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4912 | case 247: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4913 | #line 2315 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4914 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4915 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4916 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4917 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 4918 | CHECK_FOR_ERROR |
| 4919 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 4920 | (yyval.TermInstVal) = S; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4921 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4922 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 4923 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4924 | for (; I != E; ++I) { |
| 4925 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4926 | S->addCase(CI, I->second); |
| 4927 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4928 | GEN_ERROR("Switch case is constant, but not a simple integer!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4929 | } |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4930 | delete (yyvsp[-1].JumpTable); |
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 | ;} |
| 4933 | break; |
| 4934 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4935 | case 248: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4936 | #line 2334 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4937 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4938 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4939 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4940 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4941 | CHECK_FOR_ERROR |
| 4942 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4943 | (yyval.TermInstVal) = S; |
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 | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4948 | case 249: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 4949 | #line 2344 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4950 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4951 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4952 | // Handle the short syntax |
| 4953 | const PointerType *PFTy = 0; |
| 4954 | const FunctionType *Ty = 0; |
| 4955 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeWithAttrs).Ty->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4956 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 4957 | // Pull out the types of all of the arguments... |
| 4958 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4959 | FunctionType::ParamAttrsList ParamAttrs; |
| 4960 | ParamAttrs.push_back((yyvsp[-10].TypeWithAttrs).Attrs); |
| 4961 | for (ValueRefList::iterator I = (yyvsp[-7].ValueRefList)->begin(), E = (yyvsp[-7].ValueRefList)->end(); I != E; ++I) { |
| 4962 | const Type *Ty = I->Val->getType(); |
| 4963 | if (Ty == Type::VoidTy) |
| 4964 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 4965 | ParamTypes.push_back(Ty); |
| 4966 | ParamAttrs.push_back(I->Attrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4967 | } |
| 4968 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4969 | Ty = FunctionType::get((yyvsp[-10].TypeWithAttrs).Ty->get(), ParamTypes, false, ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4970 | PFTy = PointerType::get(Ty); |
| 4971 | } |
| 4972 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4973 | Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4974 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4975 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4976 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4977 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4978 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4979 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4980 | // Check the arguments |
| 4981 | ValueList Args; |
| 4982 | if ((yyvsp[-7].ValueRefList)->empty()) { // Has no arguments? |
| 4983 | // Make sure no arguments is a good thing! |
| 4984 | if (Ty->getNumParams() != 0) |
| 4985 | GEN_ERROR("No arguments passed to a function that " |
| 4986 | "expects arguments!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4987 | } else { // Has arguments? |
| 4988 | // Loop through FunctionType's arguments and ensure they are specified |
| 4989 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4990 | FunctionType::param_iterator I = Ty->param_begin(); |
| 4991 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4992 | ValueRefList::iterator ArgI = (yyvsp[-7].ValueRefList)->begin(), ArgE = (yyvsp[-7].ValueRefList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4993 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4994 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 4995 | if (ArgI->Val->getType() != *I) |
| 4996 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4997 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4998 | Args.push_back(ArgI->Val); |
| 4999 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5000 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5001 | if (Ty->isVarArg()) { |
| 5002 | if (I == E) |
| 5003 | for (; ArgI != ArgE; ++ArgI) |
| 5004 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5005 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5006 | GEN_ERROR("Invalid number of parameters detected!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5007 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5008 | |
| 5009 | // Create the InvokeInst |
| 5010 | InvokeInst *II = new InvokeInst(V, Normal, Except, Args); |
| 5011 | II->setCallingConv((yyvsp[-11].UIntVal)); |
| 5012 | (yyval.TermInstVal) = II; |
| 5013 | delete (yyvsp[-7].ValueRefList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5014 | CHECK_FOR_ERROR |
| 5015 | ;} |
| 5016 | break; |
| 5017 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5018 | case 250: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5019 | #line 2410 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5020 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5021 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5022 | CHECK_FOR_ERROR |
| 5023 | ;} |
| 5024 | break; |
| 5025 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5026 | case 251: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5027 | #line 2414 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5028 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5029 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5030 | CHECK_FOR_ERROR |
| 5031 | ;} |
| 5032 | break; |
| 5033 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5034 | case 252: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5035 | #line 2421 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5036 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5037 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
| 5038 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5039 | CHECK_FOR_ERROR |
| 5040 | if (V == 0) |
| 5041 | GEN_ERROR("May only switch on a constant pool value!"); |
| 5042 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5043 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5044 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5045 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5046 | ;} |
| 5047 | break; |
| 5048 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5049 | case 253: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5050 | #line 2432 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5051 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5052 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5053 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5054 | CHECK_FOR_ERROR |
| 5055 | |
| 5056 | if (V == 0) |
| 5057 | GEN_ERROR("May only switch on a constant pool value!"); |
| 5058 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5059 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5060 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5061 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5062 | ;} |
| 5063 | break; |
| 5064 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5065 | case 254: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5066 | #line 2445 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5067 | { |
| 5068 | // Is this definition named?? if so, assign the name... |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5069 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5070 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5071 | InsertValue((yyvsp[0].InstVal)); |
| 5072 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5073 | CHECK_FOR_ERROR |
| 5074 | ;} |
| 5075 | break; |
| 5076 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5077 | case 255: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5078 | #line 2454 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5079 | { // Used for PHI nodes |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5080 | if (!UpRefs.empty()) |
| 5081 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5082 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5083 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5084 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5085 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5086 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5087 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5088 | delete (yyvsp[-5].TypeVal); |
| 5089 | ;} |
| 5090 | break; |
| 5091 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5092 | case 256: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5093 | #line 2465 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5094 | { |
| 5095 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5096 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
| 5097 | CHECK_FOR_ERROR |
| 5098 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
| 5099 | CHECK_FOR_ERROR |
| 5100 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5101 | ;} |
| 5102 | break; |
| 5103 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5104 | case 257: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5105 | #line 2475 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5106 | { |
| 5107 | if (!UpRefs.empty()) |
| 5108 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5109 | // Used for call and invoke instructions |
| 5110 | (yyval.ValueRefList) = new ValueRefList(); |
| 5111 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5112 | (yyval.ValueRefList)->push_back(E); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5113 | ;} |
| 5114 | break; |
| 5115 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5116 | case 258: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5117 | #line 2483 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5118 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5119 | if (!UpRefs.empty()) |
| 5120 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5121 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); |
| 5122 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5123 | (yyval.ValueRefList)->push_back(E); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5124 | CHECK_FOR_ERROR |
| 5125 | ;} |
| 5126 | break; |
| 5127 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5128 | case 259: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5129 | #line 2491 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5130 | { (yyval.ValueRefList) = new ValueRefList(); ;} |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5131 | break; |
| 5132 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5133 | case 260: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5134 | #line 2494 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5135 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5136 | break; |
| 5137 | |
| 5138 | case 261: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5139 | #line 2495 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5140 | { |
| 5141 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5142 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
| 5143 | CHECK_FOR_ERROR |
| 5144 | ;} |
| 5145 | break; |
| 5146 | |
| 5147 | case 262: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5148 | #line 2502 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5149 | { |
| 5150 | (yyval.BoolVal) = true; |
| 5151 | CHECK_FOR_ERROR |
| 5152 | ;} |
| 5153 | break; |
| 5154 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5155 | case 263: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5156 | #line 2506 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5157 | { |
| 5158 | (yyval.BoolVal) = false; |
| 5159 | CHECK_FOR_ERROR |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5160 | ;} |
| 5161 | break; |
| 5162 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5163 | case 264: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5164 | #line 2511 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5165 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5166 | if (!UpRefs.empty()) |
| 5167 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5168 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5169 | !isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
| 5170 | GEN_ERROR( |
| 5171 | "Arithmetic operator requires integer, FP, or packed operands!"); |
| 5172 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5173 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5174 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5175 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
| 5176 | GEN_ERROR("U/S/FRem not supported on packed types!"); |
| 5177 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5178 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5179 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5180 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5181 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
| 5182 | if ((yyval.InstVal) == 0) |
| 5183 | GEN_ERROR("binary operator returned null!"); |
| 5184 | delete (yyvsp[-3].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5185 | ;} |
| 5186 | break; |
| 5187 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5188 | case 265: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5189 | #line 2532 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5190 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5191 | if (!UpRefs.empty()) |
| 5192 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5193 | if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { |
| 5194 | if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) || |
| 5195 | !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral()) |
| 5196 | GEN_ERROR("Logical operator requires integral operands!"); |
| 5197 | } |
| 5198 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
| 5199 | CHECK_FOR_ERROR |
| 5200 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
| 5201 | CHECK_FOR_ERROR |
| 5202 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
| 5203 | if ((yyval.InstVal) == 0) |
| 5204 | GEN_ERROR("binary operator returned null!"); |
| 5205 | delete (yyvsp[-3].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5206 | ;} |
| 5207 | break; |
| 5208 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5209 | case 266: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5210 | #line 2549 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5211 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5212 | if (!UpRefs.empty()) |
| 5213 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5214 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5215 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5216 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5217 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5218 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5219 | if ((yyval.InstVal) == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5220 | GEN_ERROR("icmp operator returned null!"); |
| 5221 | ;} |
| 5222 | break; |
| 5223 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5224 | case 267: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5225 | #line 2560 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5226 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5227 | if (!UpRefs.empty()) |
| 5228 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5229 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5230 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5231 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5232 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5233 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5234 | if ((yyval.InstVal) == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5235 | GEN_ERROR("fcmp operator returned null!"); |
| 5236 | ;} |
| 5237 | break; |
| 5238 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5239 | case 268: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5240 | #line 2571 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5241 | { |
| 5242 | cerr << "WARNING: Use of eliminated 'not' instruction:" |
| 5243 | << " Replacing with 'xor'.\n"; |
| 5244 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5245 | Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5246 | if (Ones == 0) |
| 5247 | GEN_ERROR("Expected integral type for not instruction!"); |
| 5248 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5249 | (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones); |
| 5250 | if ((yyval.InstVal) == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5251 | GEN_ERROR("Could not create a xor instruction!"); |
| 5252 | CHECK_FOR_ERROR |
| 5253 | ;} |
| 5254 | break; |
| 5255 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5256 | case 269: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5257 | #line 2584 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5258 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5259 | if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty) |
| 5260 | GEN_ERROR("Shift amount must be i8 type!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5261 | if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5262 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 5263 | CHECK_FOR_ERROR; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5264 | (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5265 | CHECK_FOR_ERROR |
| 5266 | ;} |
| 5267 | break; |
| 5268 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5269 | case 270: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5270 | #line 2593 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5271 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5272 | if (!UpRefs.empty()) |
| 5273 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5274 | Value* Val = (yyvsp[-2].ValueVal); |
| 5275 | const Type* Ty = (yyvsp[0].TypeVal)->get(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5276 | if (!Val->getType()->isFirstClassType()) |
| 5277 | GEN_ERROR("cast from a non-primitive type: '" + |
| 5278 | Val->getType()->getDescription() + "'!"); |
| 5279 | if (!Ty->isFirstClassType()) |
| 5280 | GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5281 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, (yyvsp[0].TypeVal)->get()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5282 | delete (yyvsp[0].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5283 | ;} |
| 5284 | break; |
| 5285 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5286 | case 271: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5287 | #line 2606 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5288 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5289 | if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5290 | GEN_ERROR("select condition must be boolean!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5291 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5292 | GEN_ERROR("select value types should match!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5293 | (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5294 | CHECK_FOR_ERROR |
| 5295 | ;} |
| 5296 | break; |
| 5297 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5298 | case 272: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5299 | #line 2614 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5300 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5301 | if (!UpRefs.empty()) |
| 5302 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5303 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5304 | delete (yyvsp[0].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5305 | CHECK_FOR_ERROR |
| 5306 | ;} |
| 5307 | break; |
| 5308 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5309 | case 273: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5310 | #line 2621 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5311 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5312 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5313 | GEN_ERROR("Invalid extractelement operands!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5314 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5315 | CHECK_FOR_ERROR |
| 5316 | ;} |
| 5317 | break; |
| 5318 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5319 | case 274: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5320 | #line 2627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5321 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5322 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5323 | GEN_ERROR("Invalid insertelement operands!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5324 | (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5325 | CHECK_FOR_ERROR |
| 5326 | ;} |
| 5327 | break; |
| 5328 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5329 | case 275: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5330 | #line 2633 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5331 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5332 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5333 | GEN_ERROR("Invalid shufflevector operands!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5334 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5335 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5336 | ;} |
| 5337 | break; |
| 5338 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5339 | case 276: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5340 | #line 2639 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5341 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5342 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5343 | if (!Ty->isFirstClassType()) |
| 5344 | GEN_ERROR("PHI node operands must be of first class type!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5345 | (yyval.InstVal) = new PHINode(Ty); |
| 5346 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5347 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5348 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5349 | GEN_ERROR("All elements of a PHI node must be of the same type!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5350 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5351 | (yyvsp[0].PHIList)->pop_front(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5352 | } |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5353 | delete (yyvsp[0].PHIList); // Free the list... |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5354 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5355 | ;} |
| 5356 | break; |
| 5357 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5358 | case 277: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5359 | #line 2654 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5360 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5361 | |
| 5362 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5363 | const PointerType *PFTy = 0; |
| 5364 | const FunctionType *Ty = 0; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5365 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeWithAttrs).Ty->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5366 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5367 | // Pull out the types of all of the arguments... |
| 5368 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5369 | FunctionType::ParamAttrsList ParamAttrs; |
| 5370 | ParamAttrs.push_back((yyvsp[-4].TypeWithAttrs).Attrs); |
| 5371 | for (ValueRefList::iterator I = (yyvsp[-1].ValueRefList)->begin(), E = (yyvsp[-1].ValueRefList)->end(); I != E; ++I) { |
| 5372 | const Type *Ty = I->Val->getType(); |
| 5373 | if (Ty == Type::VoidTy) |
| 5374 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5375 | ParamTypes.push_back(Ty); |
| 5376 | ParamAttrs.push_back(I->Attrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5377 | } |
| 5378 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5379 | Ty = FunctionType::get((yyvsp[-4].TypeWithAttrs).Ty->get(), ParamTypes, false, ParamAttrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5380 | PFTy = PointerType::get(Ty); |
| 5381 | } |
| 5382 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5383 | Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5384 | CHECK_FOR_ERROR |
| 5385 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5386 | // Check the arguments |
| 5387 | ValueList Args; |
| 5388 | if ((yyvsp[-1].ValueRefList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5389 | // Make sure no arguments is a good thing! |
| 5390 | if (Ty->getNumParams() != 0) |
| 5391 | GEN_ERROR("No arguments passed to a function that " |
| 5392 | "expects arguments!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5393 | } else { // Has arguments? |
| 5394 | // Loop through FunctionType's arguments and ensure they are specified |
| 5395 | // correctly! |
| 5396 | // |
| 5397 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5398 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5399 | ValueRefList::iterator ArgI = (yyvsp[-1].ValueRefList)->begin(), ArgE = (yyvsp[-1].ValueRefList)->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5400 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5401 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5402 | if (ArgI->Val->getType() != *I) |
| 5403 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5404 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5405 | Args.push_back(ArgI->Val); |
| 5406 | } |
| 5407 | if (Ty->isVarArg()) { |
| 5408 | if (I == E) |
| 5409 | for (; ArgI != ArgE; ++ArgI) |
| 5410 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5411 | } else if (I != E || ArgI != ArgE) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5412 | GEN_ERROR("Invalid number of parameters detected!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5413 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5414 | // Create the call node |
| 5415 | CallInst *CI = new CallInst(V, Args); |
| 5416 | CI->setTailCall((yyvsp[-6].BoolVal)); |
| 5417 | CI->setCallingConv((yyvsp[-5].UIntVal)); |
| 5418 | (yyval.InstVal) = CI; |
| 5419 | delete (yyvsp[-1].ValueRefList); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5420 | CHECK_FOR_ERROR |
| 5421 | ;} |
| 5422 | break; |
| 5423 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5424 | case 278: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5425 | #line 2716 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5426 | { |
| 5427 | (yyval.InstVal) = (yyvsp[0].InstVal); |
| 5428 | CHECK_FOR_ERROR |
| 5429 | ;} |
| 5430 | break; |
| 5431 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5432 | case 279: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5433 | #line 2721 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5434 | { |
| 5435 | (yyval.BoolVal) = true; |
| 5436 | CHECK_FOR_ERROR |
| 5437 | ;} |
| 5438 | break; |
| 5439 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5440 | case 280: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5441 | #line 2725 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5442 | { |
| 5443 | (yyval.BoolVal) = false; |
| 5444 | CHECK_FOR_ERROR |
| 5445 | ;} |
| 5446 | break; |
| 5447 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5448 | case 281: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5449 | #line 2732 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5450 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5451 | if (!UpRefs.empty()) |
| 5452 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5453 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5454 | delete (yyvsp[-1].TypeVal); |
| 5455 | CHECK_FOR_ERROR |
| 5456 | ;} |
| 5457 | break; |
| 5458 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5459 | case 282: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5460 | #line 2739 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5461 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5462 | if (!UpRefs.empty()) |
| 5463 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5464 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
| 5465 | CHECK_FOR_ERROR |
| 5466 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5467 | delete (yyvsp[-4].TypeVal); |
| 5468 | ;} |
| 5469 | break; |
| 5470 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5471 | case 283: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5472 | #line 2747 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5473 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5474 | if (!UpRefs.empty()) |
| 5475 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5476 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5477 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5478 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5479 | ;} |
| 5480 | break; |
| 5481 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5482 | case 284: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5483 | #line 2754 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5484 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5485 | if (!UpRefs.empty()) |
| 5486 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5487 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5488 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5489 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5490 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5491 | ;} |
| 5492 | break; |
| 5493 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5494 | case 285: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5495 | #line 2762 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5496 | { |
| 5497 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
| 5498 | GEN_ERROR("Trying to free nonpointer type " + |
| 5499 | (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); |
| 5500 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5501 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5502 | ;} |
| 5503 | break; |
| 5504 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5505 | case 286: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5506 | #line 2770 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5507 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5508 | if (!UpRefs.empty()) |
| 5509 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5510 | if (!isa<PointerType>((yyvsp[-1].TypeVal)->get())) |
| 5511 | GEN_ERROR("Can't load from nonpointer type: " + |
| 5512 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5513 | if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) |
| 5514 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
| 5515 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5516 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5517 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5518 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
| 5519 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5520 | ;} |
| 5521 | break; |
| 5522 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5523 | case 287: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5524 | #line 2784 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5525 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5526 | if (!UpRefs.empty()) |
| 5527 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5528 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
| 5529 | if (!PT) |
| 5530 | GEN_ERROR("Can't store to a nonpointer type: " + |
| 5531 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5532 | const Type *ElTy = PT->getElementType(); |
| 5533 | if (ElTy != (yyvsp[-3].ValueVal)->getType()) |
| 5534 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + |
| 5535 | "' into space of type '" + ElTy->getDescription() + "'!"); |
| 5536 | |
| 5537 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5538 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5539 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); |
| 5540 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5541 | ;} |
| 5542 | break; |
| 5543 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5544 | case 288: |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5545 | #line 2801 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5546 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5547 | if (!UpRefs.empty()) |
| 5548 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5549 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5550 | GEN_ERROR("getelementptr insn requires pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5551 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5552 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5553 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5554 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); |
| 5555 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5556 | CHECK_FOR_ERROR |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5557 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); |
| 5558 | delete (yyvsp[-2].TypeVal); |
| 5559 | delete (yyvsp[0].ValueList); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5560 | ;} |
| 5561 | break; |
| 5562 | |
| 5563 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5564 | default: break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5565 | } |
| 5566 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5567 | /* Line 1126 of yacc.c. */ |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5568 | #line 5569 "llvmAsmParser.tab.c" |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5569 | |
| 5570 | yyvsp -= yylen; |
| 5571 | yyssp -= yylen; |
| 5572 | |
| 5573 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5574 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5575 | |
| 5576 | *++yyvsp = yyval; |
| 5577 | |
| 5578 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5579 | /* Now `shift' the result of the reduction. Determine what state |
| 5580 | that goes to, based on the state we popped back to and the rule |
| 5581 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5582 | |
| 5583 | yyn = yyr1[yyn]; |
| 5584 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5585 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5586 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5587 | yystate = yytable[yystate]; |
| 5588 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5589 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5590 | |
| 5591 | goto yynewstate; |
| 5592 | |
| 5593 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5594 | /*------------------------------------. |
| 5595 | | yyerrlab -- here on detecting error | |
| 5596 | `------------------------------------*/ |
| 5597 | yyerrlab: |
| 5598 | /* If not already recovering from an error, report this error. */ |
| 5599 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5600 | { |
| 5601 | ++yynerrs; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5602 | #if YYERROR_VERBOSE |
| 5603 | yyn = yypact[yystate]; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 5604 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5605 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
| 5606 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5607 | int yytype = YYTRANSLATE (yychar); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5608 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5609 | YYSIZE_T yysize = yysize0; |
| 5610 | YYSIZE_T yysize1; |
| 5611 | int yysize_overflow = 0; |
| 5612 | char *yymsg = 0; |
| 5613 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5614 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5615 | int yyx; |
| 5616 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5617 | #if 0 |
| 5618 | /* This is so xgettext sees the translatable formats that are |
| 5619 | constructed on the fly. */ |
| 5620 | YY_("syntax error, unexpected %s"); |
| 5621 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5622 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5623 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5624 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5625 | #endif |
| 5626 | char *yyfmt; |
| 5627 | char const *yyf; |
| 5628 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5629 | static char const yyexpecting[] = ", expecting %s"; |
| 5630 | static char const yyor[] = " or %s"; |
| 5631 | char yyformat[sizeof yyunexpected |
| 5632 | + sizeof yyexpecting - 1 |
| 5633 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5634 | * (sizeof yyor - 1))]; |
| 5635 | char const *yyprefix = yyexpecting; |
| 5636 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5637 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5638 | YYCHECK. */ |
| 5639 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5640 | |
| 5641 | /* Stay within bounds of both yycheck and yytname. */ |
| 5642 | int yychecklim = YYLAST - yyn; |
| 5643 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5644 | int yycount = 1; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5645 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5646 | yyarg[0] = yytname[yytype]; |
| 5647 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5648 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5649 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5650 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5651 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5652 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5653 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5654 | yycount = 1; |
| 5655 | yysize = yysize0; |
| 5656 | yyformat[sizeof yyunexpected - 1] = '\0'; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5657 | break; |
| 5658 | } |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5659 | yyarg[yycount++] = yytname[yyx]; |
| 5660 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5661 | yysize_overflow |= yysize1 < yysize; |
| 5662 | yysize = yysize1; |
| 5663 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5664 | yyprefix = yyor; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5665 | } |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5666 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5667 | yyf = YY_(yyformat); |
| 5668 | yysize1 = yysize + yystrlen (yyf); |
| 5669 | yysize_overflow |= yysize1 < yysize; |
| 5670 | yysize = yysize1; |
| 5671 | |
| 5672 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5673 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5674 | if (yymsg) |
| 5675 | { |
| 5676 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5677 | Don't have undefined behavior even if the translation |
| 5678 | produced a string with the wrong number of "%s"s. */ |
| 5679 | char *yyp = yymsg; |
| 5680 | int yyi = 0; |
| 5681 | while ((*yyp = *yyf)) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5682 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5683 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5684 | { |
| 5685 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5686 | yyf += 2; |
| 5687 | } |
| 5688 | else |
| 5689 | { |
| 5690 | yyp++; |
| 5691 | yyf++; |
| 5692 | } |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5693 | } |
| 5694 | yyerror (yymsg); |
| 5695 | YYSTACK_FREE (yymsg); |
| 5696 | } |
| 5697 | else |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5698 | { |
| 5699 | yyerror (YY_("syntax error")); |
| 5700 | goto yyexhaustedlab; |
| 5701 | } |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5702 | } |
| 5703 | else |
| 5704 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5705 | yyerror (YY_("syntax error")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5706 | } |
| 5707 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5708 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5709 | |
| 5710 | if (yyerrstatus == 3) |
| 5711 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5712 | /* If just tried and failed to reuse look-ahead token after an |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5713 | error, discard it. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5714 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5715 | if (yychar <= YYEOF) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5716 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5717 | /* Return failure if at end of input. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5718 | if (yychar == YYEOF) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5719 | YYABORT; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5720 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5721 | else |
| 5722 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5723 | yydestruct ("Error: discarding", yytoken, &yylval); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5724 | yychar = YYEMPTY; |
| 5725 | } |
| 5726 | } |
| 5727 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5728 | /* Else will try to reuse look-ahead token after shifting the error |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5729 | token. */ |
| 5730 | goto yyerrlab1; |
| 5731 | |
| 5732 | |
| 5733 | /*---------------------------------------------------. |
| 5734 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5735 | `---------------------------------------------------*/ |
| 5736 | yyerrorlab: |
| 5737 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5738 | /* Pacify compilers like GCC when the user code never invokes |
| 5739 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5740 | code. */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5741 | if (0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5742 | goto yyerrorlab; |
| 5743 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5744 | yyvsp -= yylen; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5745 | yyssp -= yylen; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5746 | yystate = *yyssp; |
| 5747 | goto yyerrlab1; |
| 5748 | |
| 5749 | |
| 5750 | /*-------------------------------------------------------------. |
| 5751 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5752 | `-------------------------------------------------------------*/ |
| 5753 | yyerrlab1: |
| 5754 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5755 | |
| 5756 | for (;;) |
| 5757 | { |
| 5758 | yyn = yypact[yystate]; |
| 5759 | if (yyn != YYPACT_NINF) |
| 5760 | { |
| 5761 | yyn += YYTERROR; |
| 5762 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5763 | { |
| 5764 | yyn = yytable[yyn]; |
| 5765 | if (0 < yyn) |
| 5766 | break; |
| 5767 | } |
| 5768 | } |
| 5769 | |
| 5770 | /* Pop the current state because it cannot handle the error token. */ |
| 5771 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5772 | YYABORT; |
| 5773 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5774 | |
| 5775 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5776 | YYPOPSTACK; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5777 | yystate = *yyssp; |
| 5778 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5779 | } |
| 5780 | |
| 5781 | if (yyn == YYFINAL) |
| 5782 | YYACCEPT; |
| 5783 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5784 | *++yyvsp = yylval; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5785 | |
| 5786 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5787 | /* Shift the error token. */ |
| 5788 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
| 5789 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5790 | yystate = yyn; |
| 5791 | goto yynewstate; |
| 5792 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5793 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5794 | /*-------------------------------------. |
| 5795 | | yyacceptlab -- YYACCEPT comes here. | |
| 5796 | `-------------------------------------*/ |
| 5797 | yyacceptlab: |
| 5798 | yyresult = 0; |
| 5799 | goto yyreturn; |
| 5800 | |
| 5801 | /*-----------------------------------. |
| 5802 | | yyabortlab -- YYABORT comes here. | |
| 5803 | `-----------------------------------*/ |
| 5804 | yyabortlab: |
| 5805 | yyresult = 1; |
| 5806 | goto yyreturn; |
| 5807 | |
| 5808 | #ifndef yyoverflow |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5809 | /*-------------------------------------------------. |
| 5810 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5811 | `-------------------------------------------------*/ |
| 5812 | yyexhaustedlab: |
| 5813 | yyerror (YY_("memory exhausted")); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5814 | yyresult = 2; |
| 5815 | /* Fall through. */ |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5816 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5817 | |
| 5818 | yyreturn: |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5819 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5820 | yydestruct ("Cleanup: discarding lookahead", |
| 5821 | yytoken, &yylval); |
| 5822 | while (yyssp != yyss) |
| 5823 | { |
| 5824 | yydestruct ("Cleanup: popping", |
| 5825 | yystos[*yyssp], yyvsp); |
| 5826 | YYPOPSTACK; |
| 5827 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5828 | #ifndef yyoverflow |
| 5829 | if (yyss != yyssa) |
| 5830 | YYSTACK_FREE (yyss); |
| 5831 | #endif |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5832 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5833 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5834 | |
| 5835 | |
Reid Spencer | e68853b | 2007-01-04 00:06:14 +0000 | [diff] [blame^] | 5836 | #line 2818 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5837 | |
| 5838 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5839 | // common code from the two 'RunVMAsmParser' functions |
| 5840 | static Module* RunParser(Module * M) { |
| 5841 | |
| 5842 | llvmAsmlineno = 1; // Reset the current line number... |
| 5843 | CurModule.CurrentModule = M; |
| 5844 | #if YYDEBUG |
| 5845 | yydebug = Debug; |
| 5846 | #endif |
| 5847 | |
| 5848 | // Check to make sure the parser succeeded |
| 5849 | if (yyparse()) { |
| 5850 | if (ParserResult) |
| 5851 | delete ParserResult; |
| 5852 | return 0; |
| 5853 | } |
| 5854 | |
| 5855 | // Check to make sure that parsing produced a result |
| 5856 | if (!ParserResult) |
| 5857 | return 0; |
| 5858 | |
| 5859 | // Reset ParserResult variable while saving its value for the result. |
| 5860 | Module *Result = ParserResult; |
| 5861 | ParserResult = 0; |
| 5862 | |
| 5863 | return Result; |
| 5864 | } |
| 5865 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5866 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5867 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5868 | // TODO: column number in exception |
| 5869 | if (TheParseError) |
| 5870 | TheParseError->setError(CurFilename, message, LineNo); |
| 5871 | TriggerError = 1; |
| 5872 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5873 | |
| 5874 | int yyerror(const char *ErrorMsg) { |
| 5875 | std::string where |
| 5876 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5877 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5878 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5879 | if (yychar == YYEMPTY || yychar == 0) |
| 5880 | errMsg += "end-of-file."; |
| 5881 | else |
| 5882 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5883 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5884 | return 0; |
| 5885 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5886 | |