Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 2.1. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 5 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 10 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ |
| 20 | |
| 21 | /* As a special exception, when this file is copied by Bison into a |
| 22 | Bison output file, you may use that output file without restriction. |
| 23 | This special exception was added by the Free Software Foundation |
| 24 | in version 1.24 of Bison. */ |
| 25 | |
| 26 | /* Written by Richard Stallman by simplifying the original so called |
| 27 | ``semantic'' parser. */ |
| 28 | |
| 29 | /* All symbols defined below should begin with yy or YY, to avoid |
| 30 | infringing on user name space. This should be done even for local |
| 31 | variables, as they might otherwise be expanded by user macros. |
| 32 | There are some unavoidable exceptions within include files to |
| 33 | define necessary library symbols; they are noted "INFRINGES ON |
| 34 | USER NAME SPACE" below. */ |
| 35 | |
| 36 | /* Identify Bison output. */ |
| 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Bison version. */ |
| 40 | #define YYBISON_VERSION "2.1" |
| 41 | |
| 42 | /* Skeleton name. */ |
| 43 | #define YYSKELETON_NAME "yacc.c" |
| 44 | |
| 45 | /* Pure parsers. */ |
| 46 | #define YYPURE 0 |
| 47 | |
| 48 | /* Using locations. */ |
| 49 | #define YYLSP_NEEDED 0 |
| 50 | |
| 51 | /* Substitute the variable and function names. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 52 | #define yyparse llvmAsmparse |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +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 | 38c91a9 | 2007-02-28 02:24:54 +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 | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 60 | |
| 61 | /* Tokens. */ |
| 62 | #ifndef YYTOKENTYPE |
| 63 | # define YYTOKENTYPE |
| 64 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 65 | know about them. */ |
| 66 | enum yytokentype { |
| 67 | ESINT64VAL = 258, |
| 68 | EUINT64VAL = 259, |
| 69 | ESAPINTVAL = 260, |
| 70 | EUAPINTVAL = 261, |
| 71 | LOCALVAL_ID = 262, |
| 72 | GLOBALVAL_ID = 263, |
| 73 | FPVAL = 264, |
| 74 | VOID = 265, |
| 75 | INTTYPE = 266, |
| 76 | FLOAT = 267, |
| 77 | DOUBLE = 268, |
| 78 | LABEL = 269, |
| 79 | TYPE = 270, |
| 80 | LOCALVAR = 271, |
| 81 | GLOBALVAR = 272, |
| 82 | LABELSTR = 273, |
| 83 | STRINGCONSTANT = 274, |
| 84 | ATSTRINGCONSTANT = 275, |
| 85 | 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 | EXTERNAL = 300, |
| 110 | TARGET = 301, |
| 111 | TRIPLE = 302, |
| 112 | ALIGN = 303, |
| 113 | DEPLIBS = 304, |
| 114 | CALL = 305, |
| 115 | TAIL = 306, |
| 116 | ASM_TOK = 307, |
| 117 | MODULE = 308, |
| 118 | SIDEEFFECT = 309, |
| 119 | CC_TOK = 310, |
| 120 | CCC_TOK = 311, |
| 121 | FASTCC_TOK = 312, |
| 122 | COLDCC_TOK = 313, |
| 123 | X86_STDCALLCC_TOK = 314, |
| 124 | X86_FASTCALLCC_TOK = 315, |
| 125 | DATALAYOUT = 316, |
| 126 | RET = 317, |
| 127 | BR = 318, |
| 128 | SWITCH = 319, |
| 129 | INVOKE = 320, |
| 130 | UNWIND = 321, |
| 131 | UNREACHABLE = 322, |
| 132 | ADD = 323, |
| 133 | SUB = 324, |
| 134 | MUL = 325, |
| 135 | UDIV = 326, |
| 136 | SDIV = 327, |
| 137 | FDIV = 328, |
| 138 | UREM = 329, |
| 139 | SREM = 330, |
| 140 | FREM = 331, |
| 141 | AND = 332, |
| 142 | OR = 333, |
| 143 | XOR = 334, |
| 144 | SHL = 335, |
| 145 | LSHR = 336, |
| 146 | ASHR = 337, |
| 147 | ICMP = 338, |
| 148 | FCMP = 339, |
| 149 | EQ = 340, |
| 150 | NE = 341, |
| 151 | SLT = 342, |
| 152 | SGT = 343, |
| 153 | SLE = 344, |
| 154 | SGE = 345, |
| 155 | ULT = 346, |
| 156 | UGT = 347, |
| 157 | ULE = 348, |
| 158 | UGE = 349, |
| 159 | OEQ = 350, |
| 160 | ONE = 351, |
| 161 | OLT = 352, |
| 162 | OGT = 353, |
| 163 | OLE = 354, |
| 164 | OGE = 355, |
| 165 | ORD = 356, |
| 166 | UNO = 357, |
| 167 | UEQ = 358, |
| 168 | UNE = 359, |
| 169 | MALLOC = 360, |
| 170 | ALLOCA = 361, |
| 171 | FREE = 362, |
| 172 | LOAD = 363, |
| 173 | STORE = 364, |
| 174 | GETELEMENTPTR = 365, |
| 175 | TRUNC = 366, |
| 176 | ZEXT = 367, |
| 177 | SEXT = 368, |
| 178 | FPTRUNC = 369, |
| 179 | FPEXT = 370, |
| 180 | BITCAST = 371, |
| 181 | UITOFP = 372, |
| 182 | SITOFP = 373, |
| 183 | FPTOUI = 374, |
| 184 | FPTOSI = 375, |
| 185 | INTTOPTR = 376, |
| 186 | PTRTOINT = 377, |
| 187 | PHI_TOK = 378, |
| 188 | SELECT = 379, |
| 189 | VAARG = 380, |
| 190 | EXTRACTELEMENT = 381, |
| 191 | INSERTELEMENT = 382, |
| 192 | SHUFFLEVECTOR = 383, |
| 193 | NORETURN = 384, |
| 194 | INREG = 385, |
| 195 | SRET = 386, |
| 196 | DEFAULT = 387, |
| 197 | HIDDEN = 388 |
| 198 | }; |
| 199 | #endif |
| 200 | /* Tokens. */ |
| 201 | #define ESINT64VAL 258 |
| 202 | #define EUINT64VAL 259 |
| 203 | #define ESAPINTVAL 260 |
| 204 | #define EUAPINTVAL 261 |
| 205 | #define LOCALVAL_ID 262 |
| 206 | #define GLOBALVAL_ID 263 |
| 207 | #define FPVAL 264 |
| 208 | #define VOID 265 |
| 209 | #define INTTYPE 266 |
| 210 | #define FLOAT 267 |
| 211 | #define DOUBLE 268 |
| 212 | #define LABEL 269 |
| 213 | #define TYPE 270 |
| 214 | #define LOCALVAR 271 |
| 215 | #define GLOBALVAR 272 |
| 216 | #define LABELSTR 273 |
| 217 | #define STRINGCONSTANT 274 |
| 218 | #define ATSTRINGCONSTANT 275 |
| 219 | #define IMPLEMENTATION 276 |
| 220 | #define ZEROINITIALIZER 277 |
| 221 | #define TRUETOK 278 |
| 222 | #define FALSETOK 279 |
| 223 | #define BEGINTOK 280 |
| 224 | #define ENDTOK 281 |
| 225 | #define DECLARE 282 |
| 226 | #define DEFINE 283 |
| 227 | #define GLOBAL 284 |
| 228 | #define CONSTANT 285 |
| 229 | #define SECTION 286 |
| 230 | #define VOLATILE 287 |
| 231 | #define TO 288 |
| 232 | #define DOTDOTDOT 289 |
| 233 | #define NULL_TOK 290 |
| 234 | #define UNDEF 291 |
| 235 | #define INTERNAL 292 |
| 236 | #define LINKONCE 293 |
| 237 | #define WEAK 294 |
| 238 | #define APPENDING 295 |
| 239 | #define DLLIMPORT 296 |
| 240 | #define DLLEXPORT 297 |
| 241 | #define EXTERN_WEAK 298 |
| 242 | #define OPAQUE 299 |
| 243 | #define EXTERNAL 300 |
| 244 | #define TARGET 301 |
| 245 | #define TRIPLE 302 |
| 246 | #define ALIGN 303 |
| 247 | #define DEPLIBS 304 |
| 248 | #define CALL 305 |
| 249 | #define TAIL 306 |
| 250 | #define ASM_TOK 307 |
| 251 | #define MODULE 308 |
| 252 | #define SIDEEFFECT 309 |
| 253 | #define CC_TOK 310 |
| 254 | #define CCC_TOK 311 |
| 255 | #define FASTCC_TOK 312 |
| 256 | #define COLDCC_TOK 313 |
| 257 | #define X86_STDCALLCC_TOK 314 |
| 258 | #define X86_FASTCALLCC_TOK 315 |
| 259 | #define DATALAYOUT 316 |
| 260 | #define RET 317 |
| 261 | #define BR 318 |
| 262 | #define SWITCH 319 |
| 263 | #define INVOKE 320 |
| 264 | #define UNWIND 321 |
| 265 | #define UNREACHABLE 322 |
| 266 | #define ADD 323 |
| 267 | #define SUB 324 |
| 268 | #define MUL 325 |
| 269 | #define UDIV 326 |
| 270 | #define SDIV 327 |
| 271 | #define FDIV 328 |
| 272 | #define UREM 329 |
| 273 | #define SREM 330 |
| 274 | #define FREM 331 |
| 275 | #define AND 332 |
| 276 | #define OR 333 |
| 277 | #define XOR 334 |
| 278 | #define SHL 335 |
| 279 | #define LSHR 336 |
| 280 | #define ASHR 337 |
| 281 | #define ICMP 338 |
| 282 | #define FCMP 339 |
| 283 | #define EQ 340 |
| 284 | #define NE 341 |
| 285 | #define SLT 342 |
| 286 | #define SGT 343 |
| 287 | #define SLE 344 |
| 288 | #define SGE 345 |
| 289 | #define ULT 346 |
| 290 | #define UGT 347 |
| 291 | #define ULE 348 |
| 292 | #define UGE 349 |
| 293 | #define OEQ 350 |
| 294 | #define ONE 351 |
| 295 | #define OLT 352 |
| 296 | #define OGT 353 |
| 297 | #define OLE 354 |
| 298 | #define OGE 355 |
| 299 | #define ORD 356 |
| 300 | #define UNO 357 |
| 301 | #define UEQ 358 |
| 302 | #define UNE 359 |
| 303 | #define MALLOC 360 |
| 304 | #define ALLOCA 361 |
| 305 | #define FREE 362 |
| 306 | #define LOAD 363 |
| 307 | #define STORE 364 |
| 308 | #define GETELEMENTPTR 365 |
| 309 | #define TRUNC 366 |
| 310 | #define ZEXT 367 |
| 311 | #define SEXT 368 |
| 312 | #define FPTRUNC 369 |
| 313 | #define FPEXT 370 |
| 314 | #define BITCAST 371 |
| 315 | #define UITOFP 372 |
| 316 | #define SITOFP 373 |
| 317 | #define FPTOUI 374 |
| 318 | #define FPTOSI 375 |
| 319 | #define INTTOPTR 376 |
| 320 | #define PTRTOINT 377 |
| 321 | #define PHI_TOK 378 |
| 322 | #define SELECT 379 |
| 323 | #define VAARG 380 |
| 324 | #define EXTRACTELEMENT 381 |
| 325 | #define INSERTELEMENT 382 |
| 326 | #define SHUFFLEVECTOR 383 |
| 327 | #define NORETURN 384 |
| 328 | #define INREG 385 |
| 329 | #define SRET 386 |
| 330 | #define DEFAULT 387 |
| 331 | #define HIDDEN 388 |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | /* Copy the first part of user declarations. */ |
| 337 | #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 338 | |
| 339 | #include "ParserInternals.h" |
| 340 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 341 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 342 | #include "llvm/Instructions.h" |
| 343 | #include "llvm/Module.h" |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 344 | #include "llvm/ValueSymbolTable.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 345 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 346 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 347 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 348 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 349 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 350 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 351 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 352 | #include <list> |
Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 353 | #include <map> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 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 |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 411 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 412 | |
| 413 | static struct PerModuleInfo { |
| 414 | Module *CurrentModule; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 415 | ValueList Values; // Module level numbered definitions |
| 416 | ValueList LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 417 | std::vector<PATypeHolder> Types; |
| 418 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 419 | |
| 420 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 421 | /// 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] | 422 | /// that we can resolve them later and print error messages as appropriate. |
| 423 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 424 | |
| 425 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 426 | // references to global values. Global values may be referenced before they |
| 427 | // are defined, and if so, the temporary object that they represent is held |
| 428 | // here. This is used for forward references of GlobalValues. |
| 429 | // |
| 430 | typedef std::map<std::pair<const PointerType *, |
| 431 | ValID>, GlobalValue*> GlobalRefsType; |
| 432 | GlobalRefsType GlobalRefs; |
| 433 | |
| 434 | void ModuleDone() { |
| 435 | // If we could not resolve some functions at function compilation time |
| 436 | // (calls to functions before they are defined), resolve them now... Types |
| 437 | // are resolved when the constant pool has been completely parsed. |
| 438 | // |
| 439 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 440 | if (TriggerError) |
| 441 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 442 | |
| 443 | // Check to make sure that all global value forward references have been |
| 444 | // resolved! |
| 445 | // |
| 446 | if (!GlobalRefs.empty()) { |
| 447 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 448 | |
| 449 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 450 | I != E; ++I) { |
| 451 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 452 | I->first.second.getName() + "\n"; |
| 453 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 454 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 455 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 456 | } |
| 457 | |
| 458 | Values.clear(); // Clear out function local definitions |
| 459 | Types.clear(); |
| 460 | CurrentModule = 0; |
| 461 | } |
| 462 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 463 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 464 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 465 | // If not, just return null. |
| 466 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 467 | // Check to see if there is a forward reference to this global variable... |
| 468 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 469 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 470 | GlobalValue *Ret = 0; |
| 471 | if (I != GlobalRefs.end()) { |
| 472 | Ret = I->second; |
| 473 | GlobalRefs.erase(I); |
| 474 | } |
| 475 | return Ret; |
| 476 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 477 | |
| 478 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 479 | // If it isn't abstract, its resolved |
| 480 | const Type* Ty = PATy->get(); |
| 481 | if (!Ty->isAbstract()) |
| 482 | return false; |
| 483 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 484 | // we don't need to traverse that leg of the type. |
| 485 | std::vector<const Type*> WorkList, SeenList; |
| 486 | WorkList.push_back(Ty); |
| 487 | while (!WorkList.empty()) { |
| 488 | const Type* Ty = WorkList.back(); |
| 489 | SeenList.push_back(Ty); |
| 490 | WorkList.pop_back(); |
| 491 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 492 | // Check to see if this is an unresolved type |
| 493 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 494 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 495 | for ( ; I != E; ++I) { |
| 496 | if (I->second.get() == OpTy) |
| 497 | return true; |
| 498 | } |
| 499 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 500 | const Type* TheTy = SeqTy->getElementType(); |
| 501 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 502 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 503 | E = SeenList.end(); |
| 504 | for ( ; I != E; ++I) |
| 505 | if (*I == TheTy) |
| 506 | break; |
| 507 | if (I == E) |
| 508 | WorkList.push_back(TheTy); |
| 509 | } |
| 510 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 511 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 512 | const Type* TheTy = StrTy->getElementType(i); |
| 513 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 514 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 515 | E = SeenList.end(); |
| 516 | for ( ; I != E; ++I) |
| 517 | if (*I == TheTy) |
| 518 | break; |
| 519 | if (I == E) |
| 520 | WorkList.push_back(TheTy); |
| 521 | } |
| 522 | } |
| 523 | } |
| 524 | } |
| 525 | return false; |
| 526 | } |
| 527 | |
| 528 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 529 | } CurModule; |
| 530 | |
| 531 | static struct PerFunctionInfo { |
| 532 | Function *CurrentFunction; // Pointer to current function being created |
| 533 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 534 | ValueList Values; // Keep track of #'d definitions |
| 535 | unsigned NextValNum; |
| 536 | ValueList LateResolveValues; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 537 | bool isDeclare; // Is this function a forward declararation? |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 538 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 539 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 540 | |
| 541 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 542 | /// track of them here. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 543 | std::map<ValID, BasicBlock*> BBForwardRefs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 544 | |
| 545 | inline PerFunctionInfo() { |
| 546 | CurrentFunction = 0; |
| 547 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 548 | Linkage = GlobalValue::ExternalLinkage; |
| 549 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | inline void FunctionStart(Function *M) { |
| 553 | CurrentFunction = M; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 554 | NextValNum = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 555 | } |
| 556 | |
| 557 | void FunctionDone() { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 558 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 559 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 560 | GenerateError("Undefined reference to label " + |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 561 | BBForwardRefs.begin()->second->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 562 | return; |
| 563 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 564 | |
| 565 | // Resolve all forward references now. |
| 566 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 567 | |
| 568 | Values.clear(); // Clear out function local definitions |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 569 | BBForwardRefs.clear(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 570 | CurrentFunction = 0; |
| 571 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 572 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 573 | Visibility = GlobalValue::DefaultVisibility; |
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 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 584 | static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
| 585 | // Things that have names or are void typed don't get slot numbers |
| 586 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
| 587 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 588 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 589 | // In the case of function values, we have to allow for the forward reference |
| 590 | // of basic blocks, which are included in the numbering. Consequently, we keep |
| 591 | // track of the next insertion location with NextValNum. When a BB gets |
| 592 | // inserted, it could change the size of the CurFun.Values vector. |
| 593 | if (&ValueTab == &CurFun.Values) { |
| 594 | if (ValueTab.size() <= CurFun.NextValNum) |
| 595 | ValueTab.resize(CurFun.NextValNum+1); |
| 596 | ValueTab[CurFun.NextValNum++] = V; |
| 597 | return; |
| 598 | } |
| 599 | // For all other lists, its okay to just tack it on the back of the vector. |
| 600 | ValueTab.push_back(V); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 601 | } |
| 602 | |
| 603 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 604 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 605 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 606 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 607 | if (D.Num < CurModule.Types.size()) |
| 608 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 609 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 610 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 611 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 612 | D.destroy(); // Free old strdup'd memory... |
| 613 | return N; |
| 614 | } |
| 615 | break; |
| 616 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 617 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 618 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 619 | } |
| 620 | |
| 621 | // If we reached here, we referenced either a symbol that we don't know about |
| 622 | // or an id number that hasn't been read yet. We may be referencing something |
| 623 | // forward, so just create an entry to be resolved later and get to it... |
| 624 | // |
| 625 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 626 | |
| 627 | |
| 628 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 629 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 630 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 631 | return 0; |
| 632 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 633 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 634 | return 0; |
| 635 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 636 | } |
| 637 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 638 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 639 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 640 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 641 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 642 | Type *Typ = OpaqueType::get(); |
| 643 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 644 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 645 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 646 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 647 | // getExistingVal - Look up the value specified by the provided type and |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 648 | // the provided ValID. If the value exists and has already been defined, return |
| 649 | // it. Otherwise return null. |
| 650 | // |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 651 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 652 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 653 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 654 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 655 | return 0; |
| 656 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 657 | |
| 658 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 659 | case ValID::LocalID: { // Is it a numbered definition? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 660 | // Check that the number is within bounds. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 661 | if (D.Num >= CurFun.Values.size()) |
| 662 | return 0; |
| 663 | Value *Result = CurFun.Values[D.Num]; |
| 664 | if (Ty != Result->getType()) { |
| 665 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
| 666 | Result->getType()->getDescription() + "' does not match " |
| 667 | "expected type, '" + Ty->getDescription() + "'"); |
| 668 | return 0; |
| 669 | } |
| 670 | return Result; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 671 | } |
| 672 | case ValID::GlobalID: { // Is it a numbered definition? |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 673 | if (D.Num >= CurModule.Values.size()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 674 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 675 | Value *Result = CurModule.Values[D.Num]; |
| 676 | if (Ty != Result->getType()) { |
| 677 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
| 678 | Result->getType()->getDescription() + "' does not match " |
| 679 | "expected type, '" + Ty->getDescription() + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 680 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 681 | } |
| 682 | return Result; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 683 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 684 | |
| 685 | case ValID::LocalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 686 | if (!inFunctionScope()) |
| 687 | return 0; |
| 688 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
| 689 | Value *N = SymTab.lookup(D.Name); |
| 690 | if (N == 0) |
| 691 | return 0; |
| 692 | if (N->getType() != Ty) |
| 693 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 694 | |
| 695 | D.destroy(); // Free old strdup'd memory... |
| 696 | return N; |
| 697 | } |
| 698 | case ValID::GlobalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 699 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
| 700 | Value *N = SymTab.lookup(D.Name); |
| 701 | if (N == 0) |
| 702 | return 0; |
| 703 | if (N->getType() != Ty) |
| 704 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 705 | |
| 706 | D.destroy(); // Free old strdup'd memory... |
| 707 | return N; |
| 708 | } |
| 709 | |
| 710 | // Check to make sure that "Ty" is an integral type, and that our |
| 711 | // value will fit into the specified type... |
| 712 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 713 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 714 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 715 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 716 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 717 | return 0; |
| 718 | } |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 719 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 720 | |
| 721 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 722 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 723 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 724 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 725 | "' is invalid or out of range"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 726 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 727 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 728 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 729 | } |
| 730 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 731 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 735 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 736 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 737 | return 0; |
| 738 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 739 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 740 | |
| 741 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 742 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 743 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 744 | return 0; |
| 745 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 746 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 747 | |
| 748 | case ValID::ConstUndefVal: // Is it an undef value? |
| 749 | return UndefValue::get(Ty); |
| 750 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 751 | case ValID::ConstZeroVal: // Is it a zero value? |
| 752 | return Constant::getNullValue(Ty); |
| 753 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 754 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 755 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 756 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 757 | return 0; |
| 758 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 759 | return D.ConstantValue; |
| 760 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 761 | case ValID::InlineAsmVal: { // Inline asm expression |
| 762 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 763 | const FunctionType *FTy = |
| 764 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 765 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 766 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 767 | return 0; |
| 768 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 769 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 770 | D.IAD->HasSideEffects); |
| 771 | D.destroy(); // Free InlineAsmDescriptor. |
| 772 | return IA; |
| 773 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 774 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 775 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 776 | return 0; |
| 777 | } // End of switch |
| 778 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 779 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 780 | return 0; |
| 781 | } |
| 782 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 783 | // getVal - This function is identical to getExistingVal, except that if a |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 784 | // value is not already defined, it "improvises" by creating a placeholder var |
| 785 | // that looks and acts just like the requested variable. When the value is |
| 786 | // defined later, all uses of the placeholder variable are replaced with the |
| 787 | // real thing. |
| 788 | // |
| 789 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 790 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 791 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 792 | return 0; |
| 793 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 794 | |
| 795 | // See if the value has already been defined. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 796 | Value *V = getExistingVal(Ty, ID); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 797 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 798 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 799 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 800 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 801 | GenerateError("Invalid use of a composite type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 802 | return 0; |
| 803 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 804 | |
| 805 | // If we reached here, we referenced either a symbol that we don't know about |
| 806 | // or an id number that hasn't been read yet. We may be referencing something |
| 807 | // forward, so just create an entry to be resolved later and get to it... |
| 808 | // |
| 809 | V = new Argument(Ty); |
| 810 | |
| 811 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 812 | // to recycle these things?? |
| 813 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 814 | llvmAsmlineno))); |
| 815 | |
| 816 | if (inFunctionScope()) |
| 817 | InsertValue(V, CurFun.LateResolveValues); |
| 818 | else |
| 819 | InsertValue(V, CurModule.LateResolveValues); |
| 820 | return V; |
| 821 | } |
| 822 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 823 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 824 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
| 825 | static BasicBlock *defineBBVal(const ValID &ID) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 826 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 827 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 828 | BasicBlock *BB = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 829 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 830 | // First, see if this was forward referenced |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 831 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 832 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 833 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 834 | BB = BBI->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 835 | // The forward declaration could have been inserted anywhere in the |
| 836 | // function: insert it into the correct place now. |
| 837 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 838 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 839 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 840 | // We're about to erase the entry, save the key so we can clean it up. |
| 841 | ValID Tmp = BBI->first; |
| 842 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 843 | // Erase the forward ref from the map as its no longer "forward" |
| 844 | CurFun.BBForwardRefs.erase(ID); |
| 845 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 846 | // The key has been removed from the map but so we don't want to leave |
| 847 | // strdup'd memory around so destroy it too. |
| 848 | Tmp.destroy(); |
| 849 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 850 | // If its a numbered definition, bump the number and set the BB value. |
| 851 | if (ID.Type == ValID::LocalID) { |
| 852 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 853 | InsertValue(BB); |
| 854 | } |
| 855 | |
| 856 | ID.destroy(); |
| 857 | return BB; |
| 858 | } |
| 859 | |
| 860 | // We haven't seen this BB before and its first mention is a definition. |
| 861 | // Just create it and return it. |
| 862 | std::string Name (ID.Type == ValID::LocalName ? ID.Name : ""); |
| 863 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 864 | if (ID.Type == ValID::LocalID) { |
| 865 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 866 | InsertValue(BB); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 867 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 868 | |
| 869 | ID.destroy(); // Free strdup'd memory |
| 870 | return BB; |
| 871 | } |
| 872 | |
| 873 | /// getBBVal - get an existing BB value or create a forward reference for it. |
| 874 | /// |
| 875 | static BasicBlock *getBBVal(const ValID &ID) { |
| 876 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 877 | |
| 878 | BasicBlock *BB = 0; |
| 879 | |
| 880 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 881 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 882 | BB = BBI->second; |
| 883 | } if (ID.Type == ValID::LocalName) { |
| 884 | std::string Name = ID.Name; |
| 885 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
| 886 | if (N) |
| 887 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 888 | BB = cast<BasicBlock>(N); |
| 889 | else |
| 890 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 891 | N->getType()->getDescription() + "'"); |
| 892 | } else if (ID.Type == ValID::LocalID) { |
| 893 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 894 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 895 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 896 | else |
| 897 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 898 | "' is actually of type '"+ |
| 899 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 900 | } |
| 901 | } else { |
| 902 | GenerateError("Illegal label reference " + ID.getName()); |
| 903 | return 0; |
| 904 | } |
| 905 | |
| 906 | // If its already been defined, return it now. |
| 907 | if (BB) { |
| 908 | ID.destroy(); // Free strdup'd memory. |
| 909 | return BB; |
| 910 | } |
| 911 | |
| 912 | // Otherwise, this block has not been seen before, create it. |
| 913 | std::string Name; |
| 914 | if (ID.Type == ValID::LocalName) |
| 915 | Name = ID.Name; |
| 916 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 917 | |
| 918 | // Insert it in the forward refs map. |
| 919 | CurFun.BBForwardRefs[ID] = BB; |
| 920 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 921 | return BB; |
| 922 | } |
| 923 | |
| 924 | |
| 925 | //===----------------------------------------------------------------------===// |
| 926 | // Code to handle forward references in instructions |
| 927 | //===----------------------------------------------------------------------===// |
| 928 | // |
| 929 | // This code handles the late binding needed with statements that reference |
| 930 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 931 | // a loop body. |
| 932 | // |
| 933 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 934 | // and back patchs after we are done. |
| 935 | // |
| 936 | |
| 937 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 938 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 939 | // defs now... |
| 940 | // |
| 941 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 942 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 943 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 944 | while (!LateResolvers.empty()) { |
| 945 | Value *V = LateResolvers.back(); |
| 946 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 947 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 948 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 949 | CurModule.PlaceHolderInfo.find(V); |
| 950 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 951 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 952 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 953 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 954 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 955 | if (TriggerError) |
| 956 | return; |
| 957 | if (TheRealValue) { |
| 958 | V->replaceAllUsesWith(TheRealValue); |
| 959 | delete V; |
| 960 | CurModule.PlaceHolderInfo.erase(PHI); |
| 961 | } else if (FutureLateResolvers) { |
| 962 | // Functions have their unresolved items forwarded to the module late |
| 963 | // resolver table |
| 964 | InsertValue(V, *FutureLateResolvers); |
| 965 | } else { |
| 966 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 967 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 968 | "' of type '" + V->getType()->getDescription() + "'", |
| 969 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 970 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 971 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 972 | GenerateError("Reference to an invalid definition: #" + |
| 973 | itostr(DID.Num) + " of type '" + |
| 974 | V->getType()->getDescription() + "'", |
| 975 | PHI->second.second); |
| 976 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 977 | } |
| 978 | } |
| 979 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 980 | LateResolvers.clear(); |
| 981 | } |
| 982 | |
| 983 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 984 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 985 | // refering to the number can be resolved. Do this now. |
| 986 | // |
| 987 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 988 | ValID D; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 989 | if (Name) D = ValID::createLocalName(Name); |
| 990 | else D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 991 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 992 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 993 | CurModule.LateResolveTypes.find(D); |
| 994 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 995 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 996 | CurModule.LateResolveTypes.erase(I); |
| 997 | } |
| 998 | } |
| 999 | |
| 1000 | // setValueName - Set the specified value to the name given. The name may be |
| 1001 | // null potentially, in which case this is a noop. The string passed in is |
| 1002 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1003 | // |
| 1004 | static void setValueName(Value *V, char *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1005 | if (!NameStr) return; |
| 1006 | std::string Name(NameStr); // Copy string |
| 1007 | free(NameStr); // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1008 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1009 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1010 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1011 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1012 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1013 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1014 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1015 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1016 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1017 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1018 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1019 | return; |
| 1020 | } |
| 1021 | |
| 1022 | // Set the name. |
| 1023 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1024 | } |
| 1025 | |
| 1026 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1027 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1028 | static GlobalVariable * |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1029 | ParseGlobalVariable(char *NameStr, |
| 1030 | GlobalValue::LinkageTypes Linkage, |
| 1031 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1032 | bool isConstantGlobal, const Type *Ty, |
| 1033 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1034 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1035 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1036 | return 0; |
| 1037 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1038 | |
| 1039 | const PointerType *PTy = PointerType::get(Ty); |
| 1040 | |
| 1041 | std::string Name; |
| 1042 | if (NameStr) { |
| 1043 | Name = NameStr; // Copy string |
| 1044 | free(NameStr); // Free old string |
| 1045 | } |
| 1046 | |
| 1047 | // See if this global value was forward referenced. If so, recycle the |
| 1048 | // object. |
| 1049 | ValID ID; |
| 1050 | if (!Name.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1051 | ID = ValID::createGlobalName((char*)Name.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1052 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1053 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1054 | } |
| 1055 | |
| 1056 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1057 | // Move the global to the end of the list, from whereever it was |
| 1058 | // previously inserted. |
| 1059 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1060 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1061 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1062 | GV->setInitializer(Initializer); |
| 1063 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1064 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1065 | GV->setConstant(isConstantGlobal); |
| 1066 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1067 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1068 | } |
| 1069 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1070 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1071 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1072 | // if the global we're parsing has an initializer (is a definition) and |
| 1073 | // has external linkage. |
| 1074 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1075 | // If there is already a global with external linkage with this name |
| 1076 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1077 | // If we allow this GVar to get created, it will be renamed in the |
| 1078 | // symbol table because it conflicts with an existing GVar. We can't |
| 1079 | // allow redefinition of GVars whose linking indicates that their name |
| 1080 | // must stay the same. Issue the error. |
| 1081 | GenerateError("Redefinition of global variable named '" + Name + |
| 1082 | "' of type '" + Ty->getDescription() + "'"); |
| 1083 | return 0; |
| 1084 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1085 | } |
| 1086 | |
| 1087 | // Otherwise there is no existing GV to use, create one now. |
| 1088 | GlobalVariable *GV = |
| 1089 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1090 | CurModule.CurrentModule); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1091 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1092 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1093 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1094 | } |
| 1095 | |
| 1096 | // setTypeName - Set the specified type to the name given. The name may be |
| 1097 | // null potentially, in which case this is a noop. The string passed in is |
| 1098 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1099 | // |
| 1100 | // This function returns true if the type has already been defined, but is |
| 1101 | // allowed to be redefined in the specified context. If the name is a new name |
| 1102 | // for the type plane, it is inserted and false is returned. |
| 1103 | static bool setTypeName(const Type *T, char *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1104 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1105 | if (NameStr == 0) return false; |
| 1106 | |
| 1107 | std::string Name(NameStr); // Copy string |
| 1108 | free(NameStr); // Free old string |
| 1109 | |
| 1110 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1111 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1112 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1113 | return false; |
| 1114 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1115 | |
| 1116 | // Set the type name, checking for conflicts as we do so. |
| 1117 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1118 | |
| 1119 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1120 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1121 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1122 | |
| 1123 | // There is only one case where this is allowed: when we are refining an |
| 1124 | // opaque type. In this case, Existing will be an opaque type. |
| 1125 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1126 | // We ARE replacing an opaque type! |
| 1127 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1128 | return true; |
| 1129 | } |
| 1130 | |
| 1131 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1132 | // the redefinition is identical to the original. This will be so if |
| 1133 | // Existing and T point to the same Type object. In this one case we |
| 1134 | // allow the equivalent redefinition. |
| 1135 | if (Existing == T) return true; // Yes, it's equal. |
| 1136 | |
| 1137 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1138 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1139 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1140 | } |
| 1141 | |
| 1142 | return false; |
| 1143 | } |
| 1144 | |
| 1145 | //===----------------------------------------------------------------------===// |
| 1146 | // Code for handling upreferences in type names... |
| 1147 | // |
| 1148 | |
| 1149 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1150 | // |
| 1151 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1152 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1153 | E) != Ty->subtype_end(); |
| 1154 | } |
| 1155 | |
| 1156 | namespace { |
| 1157 | struct UpRefRecord { |
| 1158 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1159 | // this type is resolved. |
| 1160 | unsigned NestingLevel; |
| 1161 | |
| 1162 | // LastContainedTy - This is the type at the current binding level for the |
| 1163 | // type. Every time we reduce the nesting level, this gets updated. |
| 1164 | const Type *LastContainedTy; |
| 1165 | |
| 1166 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1167 | // represented with. |
| 1168 | OpaqueType *UpRefTy; |
| 1169 | |
| 1170 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1171 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1172 | }; |
| 1173 | } |
| 1174 | |
| 1175 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1176 | static std::vector<UpRefRecord> UpRefs; |
| 1177 | |
| 1178 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1179 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1180 | /// currently active types. For each type, if the up reference is contained in |
| 1181 | /// the newly completed type, we decrement the level count. When the level |
| 1182 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1183 | /// thus we can complete the cycle. |
| 1184 | /// |
| 1185 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1186 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1187 | // nothing to resolve here. |
| 1188 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1189 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1190 | PATypeHolder Ty(ty); |
| 1191 | UR_OUT("Type '" << Ty->getDescription() << |
| 1192 | "' newly formed. Resolving upreferences.\n" << |
| 1193 | UpRefs.size() << " upreferences active!\n"); |
| 1194 | |
| 1195 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1196 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1197 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1198 | // this variable. |
| 1199 | OpaqueType *TypeToResolve = 0; |
| 1200 | |
| 1201 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1202 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1203 | << UpRefs[i].second->getDescription() << ") = " |
| 1204 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1205 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1206 | // Decrement level of upreference |
| 1207 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1208 | UpRefs[i].LastContainedTy = Ty; |
| 1209 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1210 | if (Level == 0) { // Upreference should be resolved! |
| 1211 | if (!TypeToResolve) { |
| 1212 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1213 | } else { |
| 1214 | UR_OUT(" * Resolving upreference for " |
| 1215 | << UpRefs[i].second->getDescription() << "\n"; |
| 1216 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1217 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1218 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1219 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1220 | } |
| 1221 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1222 | --i; // Do not skip the next element... |
| 1223 | } |
| 1224 | } |
| 1225 | } |
| 1226 | |
| 1227 | if (TypeToResolve) { |
| 1228 | UR_OUT(" * Resolving upreference for " |
| 1229 | << UpRefs[i].second->getDescription() << "\n"; |
| 1230 | std::string OldName = TypeToResolve->getDescription()); |
| 1231 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1232 | } |
| 1233 | |
| 1234 | return Ty; |
| 1235 | } |
| 1236 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1237 | //===----------------------------------------------------------------------===// |
| 1238 | // RunVMAsmParser - Define an interface to this parser |
| 1239 | //===----------------------------------------------------------------------===// |
| 1240 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1241 | static Module* RunParser(Module * M); |
| 1242 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1243 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1244 | set_scan_file(F); |
| 1245 | |
| 1246 | CurFilename = Filename; |
| 1247 | return RunParser(new Module(CurFilename)); |
| 1248 | } |
| 1249 | |
| 1250 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1251 | set_scan_string(AsmString); |
| 1252 | |
| 1253 | CurFilename = "from_memory"; |
| 1254 | if (M == NULL) { |
| 1255 | return RunParser(new Module (CurFilename)); |
| 1256 | } else { |
| 1257 | return RunParser(M); |
| 1258 | } |
| 1259 | } |
| 1260 | |
| 1261 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1262 | |
| 1263 | /* Enabling traces. */ |
| 1264 | #ifndef YYDEBUG |
| 1265 | # define YYDEBUG 0 |
| 1266 | #endif |
| 1267 | |
| 1268 | /* Enabling verbose error messages. */ |
| 1269 | #ifdef YYERROR_VERBOSE |
| 1270 | # undef YYERROR_VERBOSE |
| 1271 | # define YYERROR_VERBOSE 1 |
| 1272 | #else |
| 1273 | # define YYERROR_VERBOSE 0 |
| 1274 | #endif |
| 1275 | |
| 1276 | /* Enabling the token table. */ |
| 1277 | #ifndef YYTOKEN_TABLE |
| 1278 | # define YYTOKEN_TABLE 0 |
| 1279 | #endif |
| 1280 | |
| 1281 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 1282 | #line 939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1283 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1284 | llvm::Module *ModuleVal; |
| 1285 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1286 | llvm::BasicBlock *BasicBlockVal; |
| 1287 | llvm::TerminatorInst *TermInstVal; |
| 1288 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1289 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1290 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1291 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1292 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1293 | llvm::PATypeHolder *TypeVal; |
| 1294 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1295 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1296 | llvm::ArgListType *ArgList; |
| 1297 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1298 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1299 | llvm::ValueRefList *ValueRefList; |
| 1300 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1301 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1302 | std::list<std::pair<llvm::Value*, |
| 1303 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1304 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1305 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1306 | |
| 1307 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1308 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1309 | llvm::FunctionType::ParameterAttributes ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1310 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1311 | int64_t SInt64Val; |
| 1312 | uint64_t UInt64Val; |
| 1313 | int SIntVal; |
| 1314 | unsigned UIntVal; |
| 1315 | double FPVal; |
| 1316 | bool BoolVal; |
| 1317 | |
| 1318 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1319 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1320 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1321 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1322 | llvm::Instruction::TermOps TermOpVal; |
| 1323 | llvm::Instruction::MemoryOps MemOpVal; |
| 1324 | llvm::Instruction::CastOps CastOpVal; |
| 1325 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1326 | llvm::ICmpInst::Predicate IPredicate; |
| 1327 | llvm::FCmpInst::Predicate FPredicate; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1328 | } YYSTYPE; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1329 | /* Line 196 of yacc.c. */ |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 1330 | #line 1331 "llvmAsmParser.tab.c" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1331 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1332 | # define YYSTYPE_IS_DECLARED 1 |
| 1333 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1334 | #endif |
| 1335 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1336 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1337 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1338 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1339 | |
| 1340 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1341 | /* Line 219 of yacc.c. */ |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 1342 | #line 1343 "llvmAsmParser.tab.c" |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1343 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1344 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1345 | # define YYSIZE_T __SIZE_TYPE__ |
| 1346 | #endif |
| 1347 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1348 | # define YYSIZE_T size_t |
| 1349 | #endif |
| 1350 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1351 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1352 | # define YYSIZE_T size_t |
| 1353 | #endif |
| 1354 | #if ! defined (YYSIZE_T) |
| 1355 | # define YYSIZE_T unsigned int |
| 1356 | #endif |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1357 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1358 | #ifndef YY_ |
| 1359 | # if YYENABLE_NLS |
| 1360 | # if ENABLE_NLS |
| 1361 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1362 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1363 | # endif |
| 1364 | # endif |
| 1365 | # ifndef YY_ |
| 1366 | # define YY_(msgid) msgid |
| 1367 | # endif |
| 1368 | #endif |
| 1369 | |
| 1370 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1371 | |
| 1372 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1373 | |
| 1374 | # ifdef YYSTACK_USE_ALLOCA |
| 1375 | # if YYSTACK_USE_ALLOCA |
| 1376 | # ifdef __GNUC__ |
| 1377 | # define YYSTACK_ALLOC __builtin_alloca |
| 1378 | # else |
| 1379 | # define YYSTACK_ALLOC alloca |
| 1380 | # if defined (__STDC__) || defined (__cplusplus) |
| 1381 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1382 | # define YYINCLUDED_STDLIB_H |
| 1383 | # endif |
| 1384 | # endif |
| 1385 | # endif |
| 1386 | # endif |
| 1387 | |
| 1388 | # ifdef YYSTACK_ALLOC |
| 1389 | /* Pacify GCC's `empty if-body' warning. */ |
| 1390 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1391 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1392 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1393 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1394 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1395 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1396 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1397 | # endif |
| 1398 | # else |
| 1399 | # define YYSTACK_ALLOC YYMALLOC |
| 1400 | # define YYSTACK_FREE YYFREE |
| 1401 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1402 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1403 | # endif |
| 1404 | # ifdef __cplusplus |
| 1405 | extern "C" { |
| 1406 | # endif |
| 1407 | # ifndef YYMALLOC |
| 1408 | # define YYMALLOC malloc |
| 1409 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1410 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1411 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1412 | # endif |
| 1413 | # endif |
| 1414 | # ifndef YYFREE |
| 1415 | # define YYFREE free |
| 1416 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1417 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1418 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1419 | # endif |
| 1420 | # endif |
| 1421 | # ifdef __cplusplus |
| 1422 | } |
| 1423 | # endif |
| 1424 | # endif |
| 1425 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1426 | |
| 1427 | |
| 1428 | #if (! defined (yyoverflow) \ |
| 1429 | && (! defined (__cplusplus) \ |
| 1430 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1431 | |
| 1432 | /* A type that is properly aligned for any stack member. */ |
| 1433 | union yyalloc |
| 1434 | { |
| 1435 | short int yyss; |
| 1436 | YYSTYPE yyvs; |
| 1437 | }; |
| 1438 | |
| 1439 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1440 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1441 | |
| 1442 | /* The size of an array large to enough to hold all stacks, each with |
| 1443 | N elements. */ |
| 1444 | # define YYSTACK_BYTES(N) \ |
| 1445 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1446 | + YYSTACK_GAP_MAXIMUM) |
| 1447 | |
| 1448 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1449 | not overlap. */ |
| 1450 | # ifndef YYCOPY |
| 1451 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1452 | # define YYCOPY(To, From, Count) \ |
| 1453 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1454 | # else |
| 1455 | # define YYCOPY(To, From, Count) \ |
| 1456 | do \ |
| 1457 | { \ |
| 1458 | YYSIZE_T yyi; \ |
| 1459 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1460 | (To)[yyi] = (From)[yyi]; \ |
| 1461 | } \ |
| 1462 | while (0) |
| 1463 | # endif |
| 1464 | # endif |
| 1465 | |
| 1466 | /* Relocate STACK from its old location to the new one. The |
| 1467 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1468 | elements in the stack, and YYPTR gives the new location of the |
| 1469 | stack. Advance YYPTR to a properly aligned location for the next |
| 1470 | stack. */ |
| 1471 | # define YYSTACK_RELOCATE(Stack) \ |
| 1472 | do \ |
| 1473 | { \ |
| 1474 | YYSIZE_T yynewbytes; \ |
| 1475 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1476 | Stack = &yyptr->Stack; \ |
| 1477 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1478 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1479 | } \ |
| 1480 | while (0) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1481 | |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1482 | #endif |
| 1483 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1484 | #if defined (__STDC__) || defined (__cplusplus) |
| 1485 | typedef signed char yysigned_char; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1486 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1487 | typedef short int yysigned_char; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1488 | #endif |
| 1489 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1490 | /* YYFINAL -- State number of the termination state. */ |
| 1491 | #define YYFINAL 40 |
| 1492 | /* YYLAST -- Last index in YYTABLE. */ |
| 1493 | #define YYLAST 1429 |
| 1494 | |
| 1495 | /* YYNTOKENS -- Number of terminals. */ |
| 1496 | #define YYNTOKENS 148 |
| 1497 | /* YYNNTS -- Number of nonterminals. */ |
| 1498 | #define YYNNTS 78 |
| 1499 | /* YYNRULES -- Number of rules. */ |
| 1500 | #define YYNRULES 286 |
| 1501 | /* YYNRULES -- Number of states. */ |
| 1502 | #define YYNSTATES 559 |
| 1503 | |
| 1504 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1505 | #define YYUNDEFTOK 2 |
| 1506 | #define YYMAXUTOK 388 |
| 1507 | |
| 1508 | #define YYTRANSLATE(YYX) \ |
| 1509 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1510 | |
| 1511 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1512 | static const unsigned char yytranslate[] = |
| 1513 | { |
| 1514 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1515 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1516 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1517 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1518 | 138, 139, 136, 2, 135, 2, 2, 2, 2, 2, |
| 1519 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1520 | 143, 134, 144, 2, 2, 2, 2, 2, 2, 2, |
| 1521 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1522 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1523 | 2, 140, 137, 142, 2, 2, 2, 2, 2, 147, |
| 1524 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1525 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1526 | 141, 2, 2, 145, 2, 146, 2, 2, 2, 2, |
| 1527 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1528 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1529 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1530 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1531 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1532 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1533 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1534 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1535 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1536 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1537 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1538 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1539 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1540 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1541 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1542 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1543 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1544 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1545 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1546 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1547 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1548 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1549 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1550 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1551 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1552 | 125, 126, 127, 128, 129, 130, 131, 132, 133 |
| 1553 | }; |
| 1554 | |
| 1555 | #if YYDEBUG |
| 1556 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1557 | YYRHS. */ |
| 1558 | static const unsigned short int yyprhs[] = |
| 1559 | { |
| 1560 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1561 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1562 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1563 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1564 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1565 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1566 | 119, 121, 122, 125, 126, 128, 130, 133, 134, 136, |
| 1567 | 138, 140, 142, 144, 146, 148, 150, 151, 153, 154, |
| 1568 | 156, 158, 159, 161, 163, 165, 167, 168, 170, 172, |
| 1569 | 174, 176, 178, 181, 183, 185, 187, 189, 190, 193, |
| 1570 | 195, 197, 198, 201, 202, 205, 206, 210, 213, 214, |
| 1571 | 216, 217, 221, 223, 226, 228, 230, 232, 234, 236, |
| 1572 | 238, 241, 243, 246, 252, 258, 264, 270, 274, 277, |
| 1573 | 283, 288, 291, 293, 295, 297, 301, 303, 307, 309, |
| 1574 | 310, 312, 316, 321, 325, 329, 334, 339, 343, 350, |
| 1575 | 356, 359, 362, 365, 368, 371, 374, 377, 380, 383, |
| 1576 | 386, 389, 392, 399, 405, 414, 421, 428, 436, 444, |
| 1577 | 451, 460, 469, 473, 475, 477, 479, 481, 482, 484, |
| 1578 | 487, 488, 492, 493, 497, 501, 503, 507, 511, 512, |
| 1579 | 519, 520, 528, 529, 537, 540, 544, 546, 550, 554, |
| 1580 | 558, 562, 564, 565, 571, 575, 577, 581, 583, 584, |
| 1581 | 594, 596, 598, 603, 605, 607, 610, 614, 615, 617, |
| 1582 | 619, 621, 623, 625, 627, 629, 631, 633, 637, 639, |
| 1583 | 645, 647, 649, 651, 653, 655, 657, 660, 663, 666, |
| 1584 | 670, 673, 674, 676, 679, 682, 686, 696, 706, 715, |
| 1585 | 730, 732, 734, 741, 747, 750, 757, 765, 769, 775, |
| 1586 | 776, 777, 781, 784, 786, 792, 798, 805, 812, 817, |
| 1587 | 824, 829, 834, 841, 848, 851, 860, 862, 864, 865, |
| 1588 | 869, 876, 880, 887, 890, 895, 902 |
| 1589 | }; |
| 1590 | |
| 1591 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1592 | static const short int yyrhs[] = |
| 1593 | { |
| 1594 | 188, 0, -1, 68, -1, 69, -1, 70, -1, 71, |
| 1595 | -1, 72, -1, 73, -1, 74, -1, 75, -1, 76, |
| 1596 | -1, 80, -1, 81, -1, 82, -1, 77, -1, 78, |
| 1597 | -1, 79, -1, 111, -1, 112, -1, 113, -1, 114, |
| 1598 | -1, 115, -1, 116, -1, 117, -1, 118, -1, 119, |
| 1599 | -1, 120, -1, 121, -1, 122, -1, 85, -1, 86, |
| 1600 | -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, |
| 1601 | -1, 92, -1, 93, -1, 94, -1, 95, -1, 96, |
| 1602 | -1, 97, -1, 98, -1, 99, -1, 100, -1, 101, |
| 1603 | -1, 102, -1, 103, -1, 104, -1, 91, -1, 92, |
| 1604 | -1, 93, -1, 94, -1, 23, -1, 24, -1, 11, |
| 1605 | -1, 12, -1, 13, -1, 16, -1, 19, -1, 156, |
| 1606 | -1, -1, 156, 134, -1, -1, 17, -1, 20, -1, |
| 1607 | 159, 134, -1, -1, 37, -1, 39, -1, 38, -1, |
| 1608 | 40, -1, 42, -1, 41, -1, 43, -1, 45, -1, |
| 1609 | -1, 133, -1, -1, 41, -1, 43, -1, -1, 37, |
| 1610 | -1, 38, -1, 39, -1, 42, -1, -1, 56, -1, |
| 1611 | 57, -1, 58, -1, 59, -1, 60, -1, 55, 4, |
| 1612 | -1, 112, -1, 113, -1, 130, -1, 131, -1, -1, |
| 1613 | 168, 167, -1, 129, -1, 167, -1, -1, 170, 169, |
| 1614 | -1, -1, 48, 4, -1, -1, 135, 48, 4, -1, |
| 1615 | 31, 19, -1, -1, 173, -1, -1, 135, 176, 175, |
| 1616 | -1, 173, -1, 48, 4, -1, 11, -1, 12, -1, |
| 1617 | 13, -1, 14, -1, 44, -1, 177, -1, 178, 136, |
| 1618 | -1, 210, -1, 137, 4, -1, 178, 138, 182, 139, |
| 1619 | 170, -1, 10, 138, 182, 139, 170, -1, 140, 4, |
| 1620 | 141, 178, 142, -1, 143, 4, 141, 178, 144, -1, |
| 1621 | 145, 183, 146, -1, 145, 146, -1, 143, 145, 183, |
| 1622 | 146, 144, -1, 143, 145, 146, 144, -1, 178, 168, |
| 1623 | -1, 178, -1, 10, -1, 179, -1, 181, 135, 179, |
| 1624 | -1, 181, -1, 181, 135, 34, -1, 34, -1, -1, |
| 1625 | 178, -1, 183, 135, 178, -1, 178, 140, 186, 142, |
| 1626 | -1, 178, 140, 142, -1, 178, 147, 19, -1, 178, |
| 1627 | 143, 186, 144, -1, 178, 145, 186, 146, -1, 178, |
| 1628 | 145, 146, -1, 178, 143, 145, 186, 146, 144, -1, |
| 1629 | 178, 143, 145, 146, 144, -1, 178, 35, -1, 178, |
| 1630 | 36, -1, 178, 210, -1, 178, 185, -1, 178, 22, |
| 1631 | -1, 154, 3, -1, 154, 5, -1, 154, 4, -1, |
| 1632 | 154, 6, -1, 11, 23, -1, 11, 24, -1, 155, |
| 1633 | 9, -1, 151, 138, 184, 33, 178, 139, -1, 110, |
| 1634 | 138, 184, 221, 139, -1, 124, 138, 184, 135, 184, |
| 1635 | 135, 184, 139, -1, 149, 138, 184, 135, 184, 139, |
| 1636 | -1, 150, 138, 184, 135, 184, 139, -1, 83, 152, |
| 1637 | 138, 184, 135, 184, 139, -1, 84, 153, 138, 184, |
| 1638 | 135, 184, 139, -1, 126, 138, 184, 135, 184, 139, |
| 1639 | -1, 127, 138, 184, 135, 184, 135, 184, 139, -1, |
| 1640 | 128, 138, 184, 135, 184, 135, 184, 139, -1, 186, |
| 1641 | 135, 184, -1, 184, -1, 29, -1, 30, -1, 189, |
| 1642 | -1, -1, 190, -1, 189, 190, -1, -1, 28, 191, |
| 1643 | 206, -1, -1, 27, 192, 207, -1, 53, 52, 196, |
| 1644 | -1, 21, -1, 158, 15, 178, -1, 158, 15, 10, |
| 1645 | -1, -1, 160, 163, 187, 184, 193, 175, -1, -1, |
| 1646 | 160, 161, 163, 187, 184, 194, 175, -1, -1, 160, |
| 1647 | 162, 163, 187, 178, 195, 175, -1, 46, 197, -1, |
| 1648 | 49, 134, 198, -1, 19, -1, 47, 134, 19, -1, |
| 1649 | 61, 134, 19, -1, 140, 199, 142, -1, 199, 135, |
| 1650 | 19, -1, 19, -1, -1, 200, 135, 178, 168, 157, |
| 1651 | -1, 178, 168, 157, -1, 200, -1, 200, 135, 34, |
| 1652 | -1, 34, -1, -1, 166, 180, 159, 138, 201, 139, |
| 1653 | 170, 174, 171, -1, 25, -1, 145, -1, 165, 163, |
| 1654 | 202, 203, -1, 26, -1, 146, -1, 213, 205, -1, |
| 1655 | 164, 163, 202, -1, -1, 54, -1, 3, -1, 4, |
| 1656 | -1, 9, -1, 23, -1, 24, -1, 35, -1, 36, |
| 1657 | -1, 22, -1, 143, 186, 144, -1, 185, -1, 52, |
| 1658 | 208, 19, 135, 19, -1, 7, -1, 8, -1, 156, |
| 1659 | -1, 159, -1, 210, -1, 209, -1, 178, 211, -1, |
| 1660 | 213, 214, -1, 204, 214, -1, 215, 158, 216, -1, |
| 1661 | 215, 218, -1, -1, 18, -1, 62, 212, -1, 62, |
| 1662 | 10, -1, 63, 14, 211, -1, 63, 11, 211, 135, |
| 1663 | 14, 211, 135, 14, 211, -1, 64, 154, 211, 135, |
| 1664 | 14, 211, 140, 217, 142, -1, 64, 154, 211, 135, |
| 1665 | 14, 211, 140, 142, -1, 65, 166, 180, 211, 138, |
| 1666 | 220, 139, 170, 33, 14, 211, 66, 14, 211, -1, |
| 1667 | 66, -1, 67, -1, 217, 154, 209, 135, 14, 211, |
| 1668 | -1, 154, 209, 135, 14, 211, -1, 158, 223, -1, |
| 1669 | 178, 140, 211, 135, 211, 142, -1, 219, 135, 140, |
| 1670 | 211, 135, 211, 142, -1, 178, 211, 168, -1, 220, |
| 1671 | 135, 178, 211, 168, -1, -1, -1, 221, 135, 212, |
| 1672 | -1, 51, 50, -1, 50, -1, 149, 178, 211, 135, |
| 1673 | 211, -1, 150, 178, 211, 135, 211, -1, 83, 152, |
| 1674 | 178, 211, 135, 211, -1, 84, 153, 178, 211, 135, |
| 1675 | 211, -1, 151, 212, 33, 178, -1, 124, 212, 135, |
| 1676 | 212, 135, 212, -1, 125, 212, 135, 178, -1, 126, |
| 1677 | 212, 135, 212, -1, 127, 212, 135, 212, 135, 212, |
| 1678 | -1, 128, 212, 135, 212, 135, 212, -1, 123, 219, |
| 1679 | -1, 222, 166, 180, 211, 138, 220, 139, 170, -1, |
| 1680 | 225, -1, 32, -1, -1, 105, 178, 172, -1, 105, |
| 1681 | 178, 135, 11, 211, 172, -1, 106, 178, 172, -1, |
| 1682 | 106, 178, 135, 11, 211, 172, -1, 107, 212, -1, |
| 1683 | 224, 108, 178, 211, -1, 224, 109, 212, 135, 178, |
| 1684 | 211, -1, 110, 178, 211, 221, -1 |
| 1685 | }; |
| 1686 | |
| 1687 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1688 | static const unsigned short int yyrline[] = |
| 1689 | { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 1690 | 0, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, |
| 1691 | 1093, 1094, 1094, 1094, 1094, 1094, 1094, 1095, 1095, 1095, |
| 1692 | 1095, 1095, 1095, 1096, 1096, 1096, 1096, 1096, 1096, 1099, |
| 1693 | 1099, 1100, 1100, 1101, 1101, 1102, 1102, 1103, 1103, 1107, |
| 1694 | 1107, 1108, 1108, 1109, 1109, 1110, 1110, 1111, 1111, 1112, |
| 1695 | 1112, 1113, 1113, 1114, 1115, 1120, 1121, 1121, 1123, 1123, |
| 1696 | 1124, 1124, 1128, 1132, 1137, 1137, 1139, 1143, 1149, 1150, |
| 1697 | 1151, 1152, 1153, 1157, 1158, 1159, 1163, 1164, 1168, 1169, |
| 1698 | 1170, 1174, 1175, 1176, 1177, 1178, 1181, 1182, 1183, 1184, |
| 1699 | 1185, 1186, 1187, 1194, 1195, 1196, 1197, 1200, 1201, 1206, |
| 1700 | 1207, 1210, 1211, 1218, 1219, 1225, 1226, 1234, 1242, 1243, |
| 1701 | 1248, 1249, 1250, 1255, 1268, 1268, 1268, 1268, 1271, 1275, |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 1702 | 1279, 1286, 1291, 1299, 1318, 1337, 1342, 1354, 1364, 1368, |
| 1703 | 1378, 1385, 1392, 1399, 1404, 1409, 1416, 1417, 1424, 1431, |
| 1704 | 1439, 1445, 1457, 1485, 1501, 1530, 1558, 1583, 1602, 1628, |
| 1705 | 1648, 1660, 1667, 1733, 1743, 1753, 1759, 1769, 1775, 1785, |
| 1706 | 1790, 1795, 1803, 1815, 1837, 1845, 1851, 1862, 1867, 1872, |
| 1707 | 1878, 1884, 1893, 1897, 1905, 1905, 1916, 1921, 1929, 1930, |
| 1708 | 1934, 1934, 1938, 1938, 1941, 1944, 1956, 1980, 1991, 1991, |
| 1709 | 2001, 2001, 2009, 2009, 2019, 2022, 2028, 2041, 2045, 2050, |
| 1710 | 2052, 2057, 2062, 2071, 2081, 2092, 2096, 2105, 2114, 2119, |
| 1711 | 2231, 2231, 2233, 2242, 2242, 2244, 2249, 2261, 2265, 2270, |
| 1712 | 2274, 2278, 2282, 2286, 2290, 2294, 2298, 2302, 2327, 2331, |
| 1713 | 2345, 2349, 2353, 2357, 2363, 2363, 2369, 2378, 2382, 2391, |
| 1714 | 2400, 2409, 2413, 2418, 2422, 2426, 2431, 2441, 2460, 2469, |
| 1715 | 2538, 2542, 2549, 2560, 2573, 2583, 2594, 2604, 2613, 2622, |
| 1716 | 2625, 2626, 2633, 2637, 2642, 2663, 2680, 2694, 2708, 2720, |
| 1717 | 2728, 2735, 2741, 2747, 2753, 2768, 2832, 2837, 2841, 2848, |
| 1718 | 2855, 2863, 2870, 2878, 2886, 2900, 2917 |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1719 | }; |
| 1720 | #endif |
| 1721 | |
| 1722 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1723 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1724 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1725 | static const char *const yytname[] = |
| 1726 | { |
| 1727 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1728 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1729 | "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR", |
| 1730 | "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION", |
| 1731 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1732 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1733 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
| 1734 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1735 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL", |
| 1736 | "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK", |
| 1737 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1738 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", |
| 1739 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", |
| 1740 | "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", |
| 1741 | "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", |
| 1742 | "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", |
| 1743 | "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", |
| 1744 | "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", |
| 1745 | "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", |
| 1746 | "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT", |
| 1747 | "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", |
| 1748 | "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", |
| 1749 | "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType", |
| 1750 | "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName", |
| 1751 | "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage", |
| 1752 | "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", |
| 1753 | "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr", |
| 1754 | "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection", |
| 1755 | "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", |
| 1756 | "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI", |
| 1757 | "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module", |
| 1758 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1759 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1760 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1761 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1762 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", |
| 1763 | "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", |
| 1764 | "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal", |
| 1765 | "OptVolatile", "MemoryInst", 0 |
| 1766 | }; |
| 1767 | #endif |
| 1768 | |
| 1769 | # ifdef YYPRINT |
| 1770 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1771 | token YYLEX-NUM. */ |
| 1772 | static const unsigned short int yytoknum[] = |
| 1773 | { |
| 1774 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1775 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1776 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1777 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1778 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1779 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1780 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1781 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1782 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1783 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1784 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1785 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1786 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1787 | 385, 386, 387, 388, 61, 44, 42, 92, 40, 41, |
| 1788 | 91, 120, 93, 60, 62, 123, 125, 99 |
| 1789 | }; |
| 1790 | # endif |
| 1791 | |
| 1792 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1793 | static const unsigned char yyr1[] = |
| 1794 | { |
| 1795 | 0, 148, 149, 149, 149, 149, 149, 149, 149, 149, |
| 1796 | 149, 150, 150, 150, 150, 150, 150, 151, 151, 151, |
| 1797 | 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, |
| 1798 | 152, 152, 152, 152, 152, 152, 152, 152, 152, 153, |
| 1799 | 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, |
| 1800 | 153, 153, 153, 153, 153, 154, 155, 155, 156, 156, |
| 1801 | 157, 157, 158, 158, 159, 159, 160, 160, 161, 161, |
| 1802 | 161, 161, 161, 162, 162, 162, 163, 163, 164, 164, |
| 1803 | 164, 165, 165, 165, 165, 165, 166, 166, 166, 166, |
| 1804 | 166, 166, 166, 167, 167, 167, 167, 168, 168, 169, |
| 1805 | 169, 170, 170, 171, 171, 172, 172, 173, 174, 174, |
| 1806 | 175, 175, 176, 176, 177, 177, 177, 177, 178, 178, |
| 1807 | 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, |
| 1808 | 178, 179, 180, 180, 181, 181, 182, 182, 182, 182, |
| 1809 | 183, 183, 184, 184, 184, 184, 184, 184, 184, 184, |
| 1810 | 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, |
| 1811 | 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, |
| 1812 | 185, 185, 186, 186, 187, 187, 188, 188, 189, 189, |
| 1813 | 191, 190, 192, 190, 190, 190, 190, 190, 193, 190, |
| 1814 | 194, 190, 195, 190, 190, 190, 196, 197, 197, 198, |
| 1815 | 199, 199, 199, 200, 200, 201, 201, 201, 201, 202, |
| 1816 | 203, 203, 204, 205, 205, 206, 207, 208, 208, 209, |
| 1817 | 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, |
| 1818 | 210, 210, 210, 210, 211, 211, 212, 213, 213, 214, |
| 1819 | 215, 215, 215, 216, 216, 216, 216, 216, 216, 216, |
| 1820 | 216, 216, 217, 217, 218, 219, 219, 220, 220, 220, |
| 1821 | 221, 221, 222, 222, 223, 223, 223, 223, 223, 223, |
| 1822 | 223, 223, 223, 223, 223, 223, 223, 224, 224, 225, |
| 1823 | 225, 225, 225, 225, 225, 225, 225 |
| 1824 | }; |
| 1825 | |
| 1826 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1827 | static const unsigned char yyr2[] = |
| 1828 | { |
| 1829 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1830 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1831 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1832 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1833 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1834 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1835 | 1, 0, 2, 0, 1, 1, 2, 0, 1, 1, |
| 1836 | 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, |
| 1837 | 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, |
| 1838 | 1, 1, 2, 1, 1, 1, 1, 0, 2, 1, |
| 1839 | 1, 0, 2, 0, 2, 0, 3, 2, 0, 1, |
| 1840 | 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, |
| 1841 | 2, 1, 2, 5, 5, 5, 5, 3, 2, 5, |
| 1842 | 4, 2, 1, 1, 1, 3, 1, 3, 1, 0, |
| 1843 | 1, 3, 4, 3, 3, 4, 4, 3, 6, 5, |
| 1844 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1845 | 2, 2, 6, 5, 8, 6, 6, 7, 7, 6, |
| 1846 | 8, 8, 3, 1, 1, 1, 1, 0, 1, 2, |
| 1847 | 0, 3, 0, 3, 3, 1, 3, 3, 0, 6, |
| 1848 | 0, 7, 0, 7, 2, 3, 1, 3, 3, 3, |
| 1849 | 3, 1, 0, 5, 3, 1, 3, 1, 0, 9, |
| 1850 | 1, 1, 4, 1, 1, 2, 3, 0, 1, 1, |
| 1851 | 1, 1, 1, 1, 1, 1, 1, 3, 1, 5, |
| 1852 | 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, |
| 1853 | 2, 0, 1, 2, 2, 3, 9, 9, 8, 14, |
| 1854 | 1, 1, 6, 5, 2, 6, 7, 3, 5, 0, |
| 1855 | 0, 3, 2, 1, 5, 5, 6, 6, 4, 6, |
| 1856 | 4, 4, 6, 6, 2, 8, 1, 1, 0, 3, |
| 1857 | 6, 3, 6, 2, 4, 6, 4 |
| 1858 | }; |
| 1859 | |
| 1860 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1861 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1862 | means the default is an error. */ |
| 1863 | static const unsigned short int yydefact[] = |
| 1864 | { |
| 1865 | 67, 58, 64, 59, 65, 185, 182, 180, 0, 0, |
| 1866 | 0, 0, 0, 0, 76, 0, 67, 178, 78, 81, |
| 1867 | 0, 0, 194, 0, 0, 62, 0, 66, 68, 70, |
| 1868 | 69, 71, 73, 72, 74, 75, 77, 76, 76, 0, |
| 1869 | 1, 179, 79, 80, 76, 183, 82, 83, 84, 85, |
| 1870 | 76, 241, 181, 241, 0, 0, 202, 195, 196, 184, |
| 1871 | 230, 231, 187, 114, 115, 116, 117, 118, 0, 0, |
| 1872 | 0, 0, 232, 233, 119, 186, 121, 0, 0, 174, |
| 1873 | 175, 0, 86, 86, 242, 238, 63, 213, 214, 215, |
| 1874 | 237, 197, 198, 201, 0, 139, 122, 0, 0, 0, |
| 1875 | 0, 128, 140, 0, 120, 139, 0, 0, 114, 115, |
| 1876 | 116, 0, 0, 0, 188, 0, 87, 88, 89, 90, |
| 1877 | 91, 0, 216, 0, 278, 240, 0, 199, 138, 97, |
| 1878 | 134, 136, 0, 0, 0, 0, 0, 0, 127, 0, |
| 1879 | 190, 192, 159, 160, 155, 157, 156, 158, 161, 154, |
| 1880 | 150, 151, 2, 3, 4, 5, 6, 7, 8, 9, |
| 1881 | 10, 14, 15, 16, 11, 12, 13, 0, 0, 0, |
| 1882 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 1883 | 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1884 | 0, 0, 0, 153, 152, 110, 92, 133, 132, 0, |
| 1885 | 210, 211, 212, 277, 263, 0, 0, 0, 0, 86, |
| 1886 | 250, 251, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1887 | 0, 0, 0, 0, 0, 0, 0, 239, 86, 254, |
| 1888 | 0, 276, 200, 131, 0, 101, 0, 0, 130, 0, |
| 1889 | 141, 101, 110, 110, 29, 30, 31, 32, 33, 34, |
| 1890 | 35, 36, 37, 38, 0, 53, 54, 49, 50, 51, |
| 1891 | 52, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
| 1892 | 48, 0, 0, 0, 0, 0, 0, 143, 173, 0, |
| 1893 | 0, 0, 147, 0, 144, 0, 0, 0, 0, 189, |
| 1894 | 0, 262, 244, 0, 243, 0, 0, 55, 0, 0, |
| 1895 | 0, 0, 105, 105, 283, 0, 0, 274, 0, 0, |
| 1896 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, |
| 1897 | 94, 95, 96, 98, 137, 135, 124, 125, 126, 129, |
| 1898 | 123, 191, 193, 0, 0, 260, 0, 0, 0, 0, |
| 1899 | 0, 142, 128, 140, 0, 145, 146, 0, 0, 0, |
| 1900 | 0, 0, 112, 110, 208, 219, 220, 221, 226, 222, |
| 1901 | 223, 224, 225, 217, 0, 228, 235, 234, 236, 0, |
| 1902 | 245, 0, 0, 0, 0, 0, 279, 0, 281, 260, |
| 1903 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1904 | 0, 0, 0, 99, 100, 102, 0, 0, 0, 0, |
| 1905 | 0, 0, 0, 172, 149, 0, 0, 0, 0, 107, |
| 1906 | 113, 111, 207, 97, 205, 0, 218, 0, 0, 0, |
| 1907 | 0, 0, 0, 0, 0, 0, 0, 286, 0, 0, |
| 1908 | 0, 270, 271, 0, 0, 0, 0, 268, 0, 284, |
| 1909 | 0, 0, 0, 0, 163, 0, 0, 0, 0, 148, |
| 1910 | 0, 0, 0, 61, 0, 101, 0, 227, 0, 0, |
| 1911 | 259, 0, 0, 105, 106, 105, 0, 0, 0, 0, |
| 1912 | 0, 264, 265, 259, 0, 0, 0, 261, 0, 169, |
| 1913 | 0, 0, 165, 166, 162, 60, 204, 206, 97, 108, |
| 1914 | 0, 0, 0, 0, 0, 266, 267, 0, 280, 282, |
| 1915 | 0, 0, 269, 272, 273, 0, 285, 167, 168, 0, |
| 1916 | 0, 0, 61, 109, 103, 229, 0, 0, 97, 0, |
| 1917 | 101, 255, 0, 101, 164, 170, 171, 203, 0, 209, |
| 1918 | 0, 248, 0, 0, 257, 0, 0, 256, 275, 104, |
| 1919 | 246, 0, 247, 0, 97, 0, 0, 0, 258, 0, |
| 1920 | 0, 0, 0, 253, 0, 0, 252, 0, 249 |
| 1921 | }; |
| 1922 | |
| 1923 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1924 | static const short int yydefgoto[] = |
| 1925 | { |
| 1926 | -1, 190, 191, 192, 254, 271, 111, 112, 72, 486, |
| 1927 | 12, 73, 14, 37, 38, 39, 44, 50, 121, 323, |
| 1928 | 233, 395, 326, 529, 376, 352, 514, 289, 353, 74, |
| 1929 | 113, 130, 199, 131, 132, 103, 278, 365, 279, 81, |
| 1930 | 15, 16, 17, 19, 18, 195, 242, 243, 59, 22, |
| 1931 | 57, 94, 414, 415, 122, 202, 51, 89, 52, 45, |
| 1932 | 417, 366, 76, 368, 294, 53, 85, 86, 227, 533, |
| 1933 | 125, 307, 494, 398, 228, 229, 230, 231 |
| 1934 | }; |
| 1935 | |
| 1936 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1937 | STATE-NUM. */ |
| 1938 | #define YYPACT_NINF -440 |
| 1939 | static const short int yypact[] = |
| 1940 | { |
| 1941 | 406, -440, -440, -440, -440, -440, -440, -440, -2, -101, |
| 1942 | 21, -55, 80, -20, 15, 132, 556, -440, 253, 197, |
| 1943 | -7, 87, -440, 20, 207, -440, 893, -440, -440, -440, |
| 1944 | -440, -440, -440, -440, -440, -440, -440, 97, 97, 125, |
| 1945 | -440, -440, -440, -440, 97, -440, -440, -440, -440, -440, |
| 1946 | 97, 235, -440, 6, 240, 248, 258, -440, -440, -440, |
| 1947 | -440, -440, 134, -440, -440, -440, -440, -440, 269, 277, |
| 1948 | 11, 123, -440, -440, -440, 33, -440, 125, 125, -440, |
| 1949 | -440, 1055, 128, 128, -440, -440, 47, -440, -440, -440, |
| 1950 | -440, -440, -440, -440, -57, 939, -440, 154, 156, 488, |
| 1951 | 134, -440, 33, -112, -440, 939, 1055, 1149, 38, 281, |
| 1952 | 289, 239, 293, 850, -440, 299, -440, -440, -440, -440, |
| 1953 | -440, 1168, -440, 2, 1301, -440, 285, -440, -440, 33, |
| 1954 | -440, 170, 167, 1149, 1149, 164, -97, 1149, -440, 171, |
| 1955 | -440, 33, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1956 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1957 | -440, -440, -440, -440, -440, -440, -440, 254, 446, 174, |
| 1958 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1959 | -440, -440, 175, 176, 177, 178, 109, 1203, 676, 290, |
| 1960 | 181, 182, 183, -440, -440, 187, -440, 134, 33, 93, |
| 1961 | -440, -440, -440, -440, -440, 273, 1217, 127, 313, 128, |
| 1962 | -440, -440, 254, 446, 1149, 1149, 1149, 1149, 1149, 1149, |
| 1963 | 1149, 1149, 1149, 1149, 1149, 1149, 1149, -440, 128, -440, |
| 1964 | 70, -440, -440, -29, 1098, -440, 72, -39, -440, 184, |
| 1965 | 33, -440, 187, 187, -440, -440, -440, -440, -440, -440, |
| 1966 | -440, -440, -440, -440, 188, -440, -440, -440, -440, -440, |
| 1967 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1968 | -440, 196, 1055, 1055, 1055, 1055, 1055, -440, -440, 22, |
| 1969 | 771, -44, -440, -59, -440, 1055, 1055, 1055, -9, -440, |
| 1970 | 198, -440, 134, 591, -440, 728, 728, -440, 728, 1168, |
| 1971 | 1149, 1149, 112, 147, -440, 591, 75, 190, 200, 214, |
| 1972 | 215, 217, 219, 591, 591, 322, 1168, 1149, 1149, -440, |
| 1973 | -440, -440, -440, -440, -440, -440, -41, -440, -440, -440, |
| 1974 | -41, -440, -440, 1055, 1055, -440, 230, 231, 232, 233, |
| 1975 | 1055, -440, 225, 850, -43, -440, -440, 236, 241, 337, |
| 1976 | 355, 371, -440, 187, 1114, -440, -440, -440, -440, -440, |
| 1977 | -440, -440, -440, 323, 1055, -440, -440, -440, -440, 243, |
| 1978 | -440, 244, 728, 591, 591, 17, -440, 19, -440, -440, |
| 1979 | 728, 242, 1149, 1149, 1149, 1149, 1149, 245, 246, 1149, |
| 1980 | 728, 591, 249, -440, -440, -440, 252, 255, -24, 1055, |
| 1981 | 1055, 1055, 1055, -440, -440, 247, 1055, 1055, 1149, -440, |
| 1982 | -440, -440, -440, 33, 257, 260, -440, 375, -37, 383, |
| 1983 | 386, 264, 268, 272, 728, 400, 728, 275, 282, 728, |
| 1984 | 284, 33, -440, 295, 296, 728, 728, 33, 270, -440, |
| 1985 | 1149, 1055, 1055, 1149, -440, 297, 298, 301, 303, -440, |
| 1986 | 300, 302, 150, 32, 1133, -440, 305, -440, 728, 728, |
| 1987 | 1149, 728, 728, 307, -440, 307, 728, 311, 1149, 1149, |
| 1988 | 1149, -440, -440, 1149, 591, 308, 310, -440, 1055, -440, |
| 1989 | 1055, 1055, -440, -440, -440, -440, -440, -440, 33, 46, |
| 1990 | 397, 315, 314, 591, 26, -440, -440, 376, -440, -440, |
| 1991 | 309, 728, -440, -440, -440, 89, -440, -440, -440, 317, |
| 1992 | 319, 321, 32, -440, 413, -440, 449, 7, -440, 1149, |
| 1993 | -440, -440, 324, -440, -440, -440, -440, -440, 460, -440, |
| 1994 | 728, -440, 976, 9, -29, 591, 149, -440, -41, -440, |
| 1995 | -440, 330, -440, 976, -440, 453, 454, 336, -29, 728, |
| 1996 | 728, 461, 412, -440, 728, 465, -440, 728, -440 |
| 1997 | }; |
| 1998 | |
| 1999 | /* YYPGOTO[NTERM-NUM]. */ |
| 2000 | static const short int yypgoto[] = |
| 2001 | { |
| 2002 | -440, 358, 359, 361, 274, 276, -206, -440, 0, -19, |
| 2003 | 401, 13, -440, -440, -440, 31, -440, -440, -178, -309, |
| 2004 | -394, -440, -236, -440, -297, -1, -440, -207, -440, -440, |
| 2005 | -25, 263, -252, -440, 387, 404, -69, -110, -162, 160, |
| 2006 | -440, -440, 490, -440, -440, -440, -440, -440, -440, -440, |
| 2007 | -440, -440, -440, -440, 426, -440, -440, -440, -440, -440, |
| 2008 | -440, -439, -73, 100, -212, -440, 457, -440, -440, -440, |
| 2009 | -440, -440, 40, 135, -440, -440, -440, -440 |
| 2010 | }; |
| 2011 | |
| 2012 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2013 | positive, shift that token. If negative, reduce the rule which |
| 2014 | number is the opposite. If zero, do what YYDEFACT says. |
| 2015 | If YYTABLE_NINF, syntax error. */ |
| 2016 | #define YYTABLE_NINF -178 |
| 2017 | static const short int yytable[] = |
| 2018 | { |
| 2019 | 11, 75, 298, 193, 304, 330, 378, 308, 309, 310, |
| 2020 | 311, 312, 114, 13, 315, 98, 11, 394, 297, 453, |
| 2021 | 297, 394, 350, 137, 84, 281, 283, 200, 424, 13, |
| 2022 | 426, 299, 87, 23, 138, 331, 332, 140, 137, 351, |
| 2023 | 194, -55, -55, -55, -55, 20, 102, 372, 1, 239, |
| 2024 | 316, 3, 28, 29, 30, 31, 32, 33, 34, 21, |
| 2025 | 35, 142, 143, 1, 390, 425, 3, 425, 77, 78, |
| 2026 | 129, 319, 320, 24, 102, 82, 340, 350, 126, 25, |
| 2027 | 129, 83, 141, 319, 320, 127, 11, 346, 393, 321, |
| 2028 | 322, 340, 340, 541, 512, 26, 198, 104, 340, 105, |
| 2029 | 345, 321, 322, 405, 547, 328, 392, 457, 236, 237, |
| 2030 | 2, 443, 240, 4, 27, 444, 60, 61, 344, 100, |
| 2031 | 108, 109, 110, 66, 534, 1, 2, 54, 3, 4, |
| 2032 | 60, 61, 40, 100, 63, 64, 65, 66, 295, 1, |
| 2033 | 2, 296, 3, 4, 319, 320, 411, 201, 36, 531, |
| 2034 | 548, 542, 88, 67, 79, 80, 99, 340, 319, 320, |
| 2035 | 56, 519, 321, 322, 341, 520, 498, 67, 499, 104, |
| 2036 | 430, 105, 432, 433, 434, 393, 321, 322, 317, 318, |
| 2037 | 394, 293, 545, 115, 116, 117, 118, 119, 120, 302, |
| 2038 | 303, 293, 305, 306, 293, 293, 293, 293, 293, 313, |
| 2039 | 314, 293, 418, 335, 336, 337, 338, 339, 104, 129, |
| 2040 | 105, 104, 290, 105, 327, 380, 347, 348, 349, 489, |
| 2041 | 367, 55, 367, 367, 519, 367, 58, 394, 523, 394, |
| 2042 | 36, 477, 367, 193, 46, 47, 48, 106, 107, 49, |
| 2043 | 367, 367, 144, 145, 146, 147, 68, 375, 104, 69, |
| 2044 | 105, 277, 70, 84, 71, 343, 502, 503, 504, 91, |
| 2045 | 68, 319, 320, 69, 396, 397, 70, 92, 71, 101, |
| 2046 | 194, 403, 95, 96, 198, 373, 374, 93, 393, 321, |
| 2047 | 322, 97, 377, 104, 536, 105, 104, 538, 105, 484, |
| 2048 | -56, 198, 391, 293, 42, 133, 43, 134, -57, 367, |
| 2049 | 367, 367, 148, 196, 232, 234, 235, 367, 238, 284, |
| 2050 | 241, 532, 272, 273, 274, 275, 276, 367, 367, 285, |
| 2051 | 286, 287, 288, 291, 297, 381, 333, 543, 329, 413, |
| 2052 | 445, 446, 447, 448, 334, 382, 354, 450, 451, 244, |
| 2053 | 245, 246, 247, 248, 249, 250, 251, 252, 253, 383, |
| 2054 | 384, 367, 385, 367, 386, 389, 367, 293, 431, 293, |
| 2055 | 293, 293, 367, 367, 437, 399, 400, 401, 402, 404, |
| 2056 | 408, 406, 475, 476, 409, 410, 407, 416, 419, 420, |
| 2057 | 435, 436, 429, 452, 440, 367, 367, 441, 367, 367, |
| 2058 | 442, 449, 454, 367, 456, 369, 370, 458, 371, 455, |
| 2059 | 459, 367, 460, 461, 464, 379, -177, 462, 473, 509, |
| 2060 | 443, 510, 511, 387, 388, 474, 515, 466, 293, 468, |
| 2061 | 367, -63, 1, 2, 425, 3, 4, 5, 367, 488, |
| 2062 | 469, 470, 478, 6, 7, 493, 480, 479, 481, 482, |
| 2063 | 490, 483, 497, 293, 293, 293, 501, 507, 493, 508, |
| 2064 | 516, 521, 8, 485, 517, 9, 524, 367, 525, 10, |
| 2065 | 526, 528, 367, 530, 539, 546, 537, 549, 550, 255, |
| 2066 | 256, 551, 421, 422, 423, 554, 367, 367, 555, 557, |
| 2067 | 428, 367, 224, 225, 367, 226, 300, 124, 513, 301, |
| 2068 | 438, 439, 139, 527, 535, 60, 61, 325, 100, 63, |
| 2069 | 64, 65, 66, 136, 1, 2, 41, 3, 4, 123, |
| 2070 | 90, 0, 485, 505, 427, 0, 0, 0, 0, 0, |
| 2071 | 0, 0, 0, 0, 463, 0, 465, 0, 0, 467, |
| 2072 | 0, 0, 67, 0, 0, 471, 472, 257, 258, 259, |
| 2073 | 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, |
| 2074 | 270, 0, 0, 0, 0, 0, -176, 0, 491, 492, |
| 2075 | 0, 495, 496, 0, 0, 0, 500, 0, 0, 0, |
| 2076 | 0, -63, 1, 2, 506, 3, 4, 5, 0, 0, |
| 2077 | 0, 0, 0, 6, 7, 0, 0, 0, 0, 0, |
| 2078 | 0, 0, 0, 518, 355, 356, 0, 0, 60, 61, |
| 2079 | 357, 522, 8, 0, 0, 9, 0, 1, 2, 10, |
| 2080 | 3, 4, 0, 358, 359, 360, 0, 0, 0, 0, |
| 2081 | 0, 0, 0, 0, 0, 68, 361, 362, 69, 0, |
| 2082 | 540, 70, 0, 71, 135, 544, 0, 0, 0, 0, |
| 2083 | 0, 0, 0, 363, 0, 0, 0, 0, 0, 552, |
| 2084 | 553, 0, 0, 0, 556, 0, 0, 558, 0, 152, |
| 2085 | 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, |
| 2086 | 163, 164, 165, 166, 167, 168, 0, 0, 0, 0, |
| 2087 | 0, 0, 0, 60, 61, 0, 100, 108, 109, 110, |
| 2088 | 66, 0, 1, 2, 0, 3, 4, 0, 0, 0, |
| 2089 | 0, 169, 170, 171, 172, 173, 174, 175, 176, 177, |
| 2090 | 178, 179, 180, 181, 0, 182, 0, 183, 184, 185, |
| 2091 | 67, 0, 0, 0, 0, 0, 0, 104, 0, 105, |
| 2092 | 0, 355, 356, 0, 364, 60, 61, 357, 0, 0, |
| 2093 | 0, 0, 0, 0, 1, 2, 0, 3, 4, 0, |
| 2094 | 358, 359, 360, 0, 0, 0, 0, 0, 0, 0, |
| 2095 | 0, 0, 0, 361, 362, 0, 0, 0, 0, 0, |
| 2096 | 0, 0, 0, 0, 0, 0, 0, 0, 60, 61, |
| 2097 | 363, 100, 108, 109, 110, 66, 0, 1, 2, 0, |
| 2098 | 3, 4, 0, 0, 0, 0, 152, 153, 154, 155, |
| 2099 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2100 | 166, 167, 168, 68, 0, 67, 69, 0, 0, 70, |
| 2101 | 0, 71, 282, 0, 0, 0, 0, 0, 0, 0, |
| 2102 | 0, 0, 0, 0, 0, 0, 0, 0, 169, 170, |
| 2103 | 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, |
| 2104 | 181, 0, 182, 0, 183, 184, 185, 60, 61, 0, |
| 2105 | 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, |
| 2106 | 4, 364, 149, 0, 0, 0, 0, 0, 0, 0, |
| 2107 | 0, 0, 0, 0, 0, 150, 151, 0, 0, 0, |
| 2108 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2109 | 60, 61, 0, 62, 63, 64, 65, 66, 68, 1, |
| 2110 | 2, 69, 3, 4, 70, 0, 71, 342, 152, 153, |
| 2111 | 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, |
| 2112 | 164, 165, 166, 167, 168, 0, 0, 67, 0, 0, |
| 2113 | 0, 0, 0, 0, 0, 0, 60, 61, 0, 100, |
| 2114 | 63, 64, 65, 66, 0, 1, 2, 0, 3, 4, |
| 2115 | 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, |
| 2116 | 179, 180, 181, 128, 182, 0, 183, 184, 185, 355, |
| 2117 | 356, 0, 0, 67, 0, 357, 104, 0, 105, 0, |
| 2118 | 186, 0, 0, 187, 0, 188, 0, 189, 358, 359, |
| 2119 | 360, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2120 | 0, 361, 362, 0, 0, 0, 0, 0, 0, 0, |
| 2121 | 0, 0, 0, 0, 0, 0, 0, 0, 363, 0, |
| 2122 | 68, 0, 0, 69, 0, 0, 70, 0, 71, 0, |
| 2123 | 0, 0, 0, 0, 152, 153, 154, 155, 156, 157, |
| 2124 | 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, |
| 2125 | 168, 0, 60, 61, 0, 100, 108, 109, 110, 66, |
| 2126 | 0, 1, 2, 0, 3, 4, 68, 0, 0, 69, |
| 2127 | 0, 0, 70, 0, 71, 0, 169, 170, 171, 172, |
| 2128 | 173, 174, 175, 176, 177, 178, 179, 180, 181, 67, |
| 2129 | 182, 0, 183, 184, 185, 60, 61, 0, 100, 63, |
| 2130 | 64, 65, 66, 0, 1, 2, 0, 3, 4, 364, |
| 2131 | 0, 60, 61, 0, 100, 63, 64, 65, 66, 0, |
| 2132 | 1, 2, 324, 3, 4, 0, 0, 0, 0, 0, |
| 2133 | 60, 61, 67, 100, 63, 64, 65, 66, 412, 1, |
| 2134 | 2, 0, 3, 4, 0, 0, 60, 61, 67, 100, |
| 2135 | 63, 64, 65, 66, 0, 1, 2, 487, 3, 4, |
| 2136 | 0, 0, 0, 0, 0, 60, 61, 67, 197, 63, |
| 2137 | 64, 65, 66, 0, 1, 2, 0, 3, 4, 0, |
| 2138 | 0, 0, 68, 67, 0, 69, 0, 0, 70, 0, |
| 2139 | 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2140 | 60, 61, 67, 100, 108, 109, 110, 66, 0, 1, |
| 2141 | 2, 0, 3, 4, 60, 61, 0, 292, 63, 64, |
| 2142 | 65, 66, 0, 1, 2, 68, 3, 4, 69, 0, |
| 2143 | 0, 70, 0, 71, 0, 0, 0, 67, 0, 0, |
| 2144 | 0, 68, 0, 0, 69, 0, 0, 70, 0, 71, |
| 2145 | 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2146 | 68, 0, 0, 69, 0, 0, 70, 0, 71, 0, |
| 2147 | 0, 0, 0, 0, 0, 0, 68, 0, 0, 69, |
| 2148 | 0, 0, 70, 0, 71, 0, 0, 0, 0, 0, |
| 2149 | 0, 0, 0, 0, 0, 68, 0, 0, 69, 0, |
| 2150 | 0, 70, 0, 71, 0, 0, 0, 0, 0, 0, |
| 2151 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2152 | 0, 0, 0, 203, 0, 0, 0, 0, 0, 0, |
| 2153 | 68, 0, 0, 69, 0, 0, 70, 0, 280, 0, |
| 2154 | 0, 204, 205, 0, 68, 0, 0, 69, 0, 0, |
| 2155 | 70, 0, 71, 206, 207, 208, 209, 210, 211, 152, |
| 2156 | 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, |
| 2157 | 163, 164, 165, 166, 212, 213, 0, 0, 0, 0, |
| 2158 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2159 | 0, 0, 0, 0, 0, 0, 214, 215, 216, 0, |
| 2160 | 0, 217, 170, 171, 172, 173, 174, 175, 176, 177, |
| 2161 | 178, 179, 180, 181, 218, 219, 220, 221, 222, 223 |
| 2162 | }; |
| 2163 | |
| 2164 | static const short int yycheck[] = |
| 2165 | { |
| 2166 | 0, 26, 208, 113, 216, 241, 303, 219, 220, 221, |
| 2167 | 222, 223, 81, 0, 226, 4, 16, 326, 11, 413, |
| 2168 | 11, 330, 31, 135, 18, 187, 188, 25, 11, 16, |
| 2169 | 11, 209, 26, 134, 146, 242, 243, 106, 135, 48, |
| 2170 | 113, 3, 4, 5, 6, 47, 71, 299, 16, 146, |
| 2171 | 228, 19, 37, 38, 39, 40, 41, 42, 43, 61, |
| 2172 | 45, 23, 24, 16, 316, 48, 19, 48, 37, 38, |
| 2173 | 95, 112, 113, 52, 99, 44, 135, 31, 135, 134, |
| 2174 | 105, 50, 107, 112, 113, 142, 86, 146, 129, 130, |
| 2175 | 131, 135, 135, 532, 488, 15, 121, 136, 135, 138, |
| 2176 | 144, 130, 131, 146, 543, 144, 318, 144, 133, 134, |
| 2177 | 17, 135, 137, 20, 134, 139, 7, 8, 280, 10, |
| 2178 | 11, 12, 13, 14, 518, 16, 17, 134, 19, 20, |
| 2179 | 7, 8, 0, 10, 11, 12, 13, 14, 11, 16, |
| 2180 | 17, 14, 19, 20, 112, 113, 353, 145, 133, 142, |
| 2181 | 544, 142, 146, 44, 29, 30, 145, 135, 112, 113, |
| 2182 | 140, 135, 130, 131, 142, 139, 463, 44, 465, 136, |
| 2183 | 382, 138, 384, 385, 386, 129, 130, 131, 108, 109, |
| 2184 | 489, 206, 33, 55, 56, 57, 58, 59, 60, 214, |
| 2185 | 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
| 2186 | 225, 226, 364, 272, 273, 274, 275, 276, 136, 234, |
| 2187 | 138, 136, 199, 138, 142, 140, 285, 286, 287, 455, |
| 2188 | 293, 134, 295, 296, 135, 298, 19, 536, 139, 538, |
| 2189 | 133, 443, 305, 343, 37, 38, 39, 77, 78, 42, |
| 2190 | 313, 314, 3, 4, 5, 6, 137, 135, 136, 140, |
| 2191 | 138, 142, 143, 18, 145, 280, 468, 469, 470, 19, |
| 2192 | 137, 112, 113, 140, 333, 334, 143, 19, 145, 146, |
| 2193 | 343, 340, 138, 4, 299, 300, 301, 19, 129, 130, |
| 2194 | 131, 4, 135, 136, 520, 138, 136, 523, 138, 139, |
| 2195 | 9, 316, 317, 318, 41, 141, 43, 141, 9, 372, |
| 2196 | 373, 374, 9, 4, 19, 135, 139, 380, 144, 19, |
| 2197 | 139, 517, 138, 138, 138, 138, 138, 390, 391, 138, |
| 2198 | 138, 138, 135, 50, 11, 135, 138, 533, 144, 354, |
| 2199 | 399, 400, 401, 402, 138, 135, 138, 406, 407, 85, |
| 2200 | 86, 87, 88, 89, 90, 91, 92, 93, 94, 135, |
| 2201 | 135, 424, 135, 426, 135, 33, 429, 382, 383, 384, |
| 2202 | 385, 386, 435, 436, 389, 135, 135, 135, 135, 144, |
| 2203 | 33, 135, 441, 442, 19, 4, 135, 54, 135, 135, |
| 2204 | 135, 135, 140, 408, 135, 458, 459, 135, 461, 462, |
| 2205 | 135, 144, 135, 466, 19, 295, 296, 14, 298, 139, |
| 2206 | 14, 474, 138, 135, 4, 305, 0, 135, 138, 478, |
| 2207 | 135, 480, 481, 313, 314, 440, 19, 135, 443, 135, |
| 2208 | 493, 15, 16, 17, 48, 19, 20, 21, 501, 454, |
| 2209 | 135, 135, 135, 27, 28, 460, 135, 139, 135, 139, |
| 2210 | 135, 139, 135, 468, 469, 470, 135, 139, 473, 139, |
| 2211 | 135, 142, 46, 453, 140, 49, 139, 530, 139, 53, |
| 2212 | 139, 48, 535, 14, 4, 135, 142, 14, 14, 23, |
| 2213 | 24, 135, 372, 373, 374, 14, 549, 550, 66, 14, |
| 2214 | 380, 554, 124, 124, 557, 124, 212, 86, 489, 213, |
| 2215 | 390, 391, 105, 512, 519, 7, 8, 234, 10, 11, |
| 2216 | 12, 13, 14, 99, 16, 17, 16, 19, 20, 83, |
| 2217 | 53, -1, 512, 473, 379, -1, -1, -1, -1, -1, |
| 2218 | -1, -1, -1, -1, 424, -1, 426, -1, -1, 429, |
| 2219 | -1, -1, 44, -1, -1, 435, 436, 91, 92, 93, |
| 2220 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
| 2221 | 104, -1, -1, -1, -1, -1, 0, -1, 458, 459, |
| 2222 | -1, 461, 462, -1, -1, -1, 466, -1, -1, -1, |
| 2223 | -1, 15, 16, 17, 474, 19, 20, 21, -1, -1, |
| 2224 | -1, -1, -1, 27, 28, -1, -1, -1, -1, -1, |
| 2225 | -1, -1, -1, 493, 3, 4, -1, -1, 7, 8, |
| 2226 | 9, 501, 46, -1, -1, 49, -1, 16, 17, 53, |
| 2227 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
| 2228 | -1, -1, -1, -1, -1, 137, 35, 36, 140, -1, |
| 2229 | 530, 143, -1, 145, 146, 535, -1, -1, -1, -1, |
| 2230 | -1, -1, -1, 52, -1, -1, -1, -1, -1, 549, |
| 2231 | 550, -1, -1, -1, 554, -1, -1, 557, -1, 68, |
| 2232 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2233 | 79, 80, 81, 82, 83, 84, -1, -1, -1, -1, |
| 2234 | -1, -1, -1, 7, 8, -1, 10, 11, 12, 13, |
| 2235 | 14, -1, 16, 17, -1, 19, 20, -1, -1, -1, |
| 2236 | -1, 110, 111, 112, 113, 114, 115, 116, 117, 118, |
| 2237 | 119, 120, 121, 122, -1, 124, -1, 126, 127, 128, |
| 2238 | 44, -1, -1, -1, -1, -1, -1, 136, -1, 138, |
| 2239 | -1, 3, 4, -1, 143, 7, 8, 9, -1, -1, |
| 2240 | -1, -1, -1, -1, 16, 17, -1, 19, 20, -1, |
| 2241 | 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2242 | -1, -1, -1, 35, 36, -1, -1, -1, -1, -1, |
| 2243 | -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, |
| 2244 | 52, 10, 11, 12, 13, 14, -1, 16, 17, -1, |
| 2245 | 19, 20, -1, -1, -1, -1, 68, 69, 70, 71, |
| 2246 | 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, |
| 2247 | 82, 83, 84, 137, -1, 44, 140, -1, -1, 143, |
| 2248 | -1, 145, 146, -1, -1, -1, -1, -1, -1, -1, |
| 2249 | -1, -1, -1, -1, -1, -1, -1, -1, 110, 111, |
| 2250 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
| 2251 | 122, -1, 124, -1, 126, 127, 128, 7, 8, -1, |
| 2252 | -1, -1, -1, -1, -1, -1, 16, 17, -1, 19, |
| 2253 | 20, 143, 22, -1, -1, -1, -1, -1, -1, -1, |
| 2254 | -1, -1, -1, -1, -1, 35, 36, -1, -1, -1, |
| 2255 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2256 | 7, 8, -1, 10, 11, 12, 13, 14, 137, 16, |
| 2257 | 17, 140, 19, 20, 143, -1, 145, 146, 68, 69, |
| 2258 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2259 | 80, 81, 82, 83, 84, -1, -1, 44, -1, -1, |
| 2260 | -1, -1, -1, -1, -1, -1, 7, 8, -1, 10, |
| 2261 | 11, 12, 13, 14, -1, 16, 17, -1, 19, 20, |
| 2262 | 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
| 2263 | 120, 121, 122, 34, 124, -1, 126, 127, 128, 3, |
| 2264 | 4, -1, -1, 44, -1, 9, 136, -1, 138, -1, |
| 2265 | 140, -1, -1, 143, -1, 145, -1, 147, 22, 23, |
| 2266 | 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2267 | -1, 35, 36, -1, -1, -1, -1, -1, -1, -1, |
| 2268 | -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, |
| 2269 | 137, -1, -1, 140, -1, -1, 143, -1, 145, -1, |
| 2270 | -1, -1, -1, -1, 68, 69, 70, 71, 72, 73, |
| 2271 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2272 | 84, -1, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2273 | -1, 16, 17, -1, 19, 20, 137, -1, -1, 140, |
| 2274 | -1, -1, 143, -1, 145, -1, 110, 111, 112, 113, |
| 2275 | 114, 115, 116, 117, 118, 119, 120, 121, 122, 44, |
| 2276 | 124, -1, 126, 127, 128, 7, 8, -1, 10, 11, |
| 2277 | 12, 13, 14, -1, 16, 17, -1, 19, 20, 143, |
| 2278 | -1, 7, 8, -1, 10, 11, 12, 13, 14, -1, |
| 2279 | 16, 17, 34, 19, 20, -1, -1, -1, -1, -1, |
| 2280 | 7, 8, 44, 10, 11, 12, 13, 14, 34, 16, |
| 2281 | 17, -1, 19, 20, -1, -1, 7, 8, 44, 10, |
| 2282 | 11, 12, 13, 14, -1, 16, 17, 34, 19, 20, |
| 2283 | -1, -1, -1, -1, -1, 7, 8, 44, 10, 11, |
| 2284 | 12, 13, 14, -1, 16, 17, -1, 19, 20, -1, |
| 2285 | -1, -1, 137, 44, -1, 140, -1, -1, 143, -1, |
| 2286 | 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2287 | 7, 8, 44, 10, 11, 12, 13, 14, -1, 16, |
| 2288 | 17, -1, 19, 20, 7, 8, -1, 10, 11, 12, |
| 2289 | 13, 14, -1, 16, 17, 137, 19, 20, 140, -1, |
| 2290 | -1, 143, -1, 145, -1, -1, -1, 44, -1, -1, |
| 2291 | -1, 137, -1, -1, 140, -1, -1, 143, -1, 145, |
| 2292 | -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2293 | 137, -1, -1, 140, -1, -1, 143, -1, 145, -1, |
| 2294 | -1, -1, -1, -1, -1, -1, 137, -1, -1, 140, |
| 2295 | -1, -1, 143, -1, 145, -1, -1, -1, -1, -1, |
| 2296 | -1, -1, -1, -1, -1, 137, -1, -1, 140, -1, |
| 2297 | -1, 143, -1, 145, -1, -1, -1, -1, -1, -1, |
| 2298 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2299 | -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, |
| 2300 | 137, -1, -1, 140, -1, -1, 143, -1, 145, -1, |
| 2301 | -1, 50, 51, -1, 137, -1, -1, 140, -1, -1, |
| 2302 | 143, -1, 145, 62, 63, 64, 65, 66, 67, 68, |
| 2303 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2304 | 79, 80, 81, 82, 83, 84, -1, -1, -1, -1, |
| 2305 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2306 | -1, -1, -1, -1, -1, -1, 105, 106, 107, -1, |
| 2307 | -1, 110, 111, 112, 113, 114, 115, 116, 117, 118, |
| 2308 | 119, 120, 121, 122, 123, 124, 125, 126, 127, 128 |
| 2309 | }; |
| 2310 | |
| 2311 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2312 | symbol of state STATE-NUM. */ |
| 2313 | static const unsigned char yystos[] = |
| 2314 | { |
| 2315 | 0, 16, 17, 19, 20, 21, 27, 28, 46, 49, |
| 2316 | 53, 156, 158, 159, 160, 188, 189, 190, 192, 191, |
| 2317 | 47, 61, 197, 134, 52, 134, 15, 134, 37, 38, |
| 2318 | 39, 40, 41, 42, 43, 45, 133, 161, 162, 163, |
| 2319 | 0, 190, 41, 43, 164, 207, 37, 38, 39, 42, |
| 2320 | 165, 204, 206, 213, 134, 134, 140, 198, 19, 196, |
| 2321 | 7, 8, 10, 11, 12, 13, 14, 44, 137, 140, |
| 2322 | 143, 145, 156, 159, 177, 178, 210, 163, 163, 29, |
| 2323 | 30, 187, 163, 163, 18, 214, 215, 26, 146, 205, |
| 2324 | 214, 19, 19, 19, 199, 138, 4, 4, 4, 145, |
| 2325 | 10, 146, 178, 183, 136, 138, 187, 187, 11, 12, |
| 2326 | 13, 154, 155, 178, 184, 55, 56, 57, 58, 59, |
| 2327 | 60, 166, 202, 202, 158, 218, 135, 142, 34, 178, |
| 2328 | 179, 181, 182, 141, 141, 146, 183, 135, 146, 182, |
| 2329 | 184, 178, 23, 24, 3, 4, 5, 6, 9, 22, |
| 2330 | 35, 36, 68, 69, 70, 71, 72, 73, 74, 75, |
| 2331 | 76, 77, 78, 79, 80, 81, 82, 83, 84, 110, |
| 2332 | 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 2333 | 121, 122, 124, 126, 127, 128, 140, 143, 145, 147, |
| 2334 | 149, 150, 151, 185, 210, 193, 4, 10, 178, 180, |
| 2335 | 25, 145, 203, 32, 50, 51, 62, 63, 64, 65, |
| 2336 | 66, 67, 83, 84, 105, 106, 107, 110, 123, 124, |
| 2337 | 125, 126, 127, 128, 149, 150, 151, 216, 222, 223, |
| 2338 | 224, 225, 19, 168, 135, 139, 178, 178, 144, 146, |
| 2339 | 178, 139, 194, 195, 85, 86, 87, 88, 89, 90, |
| 2340 | 91, 92, 93, 94, 152, 23, 24, 91, 92, 93, |
| 2341 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
| 2342 | 104, 153, 138, 138, 138, 138, 138, 142, 184, 186, |
| 2343 | 145, 186, 146, 186, 19, 138, 138, 138, 135, 175, |
| 2344 | 159, 50, 10, 178, 212, 11, 14, 11, 154, 166, |
| 2345 | 152, 153, 178, 178, 212, 178, 178, 219, 212, 212, |
| 2346 | 212, 212, 212, 178, 178, 212, 166, 108, 109, 112, |
| 2347 | 113, 130, 131, 167, 34, 179, 170, 142, 144, 144, |
| 2348 | 170, 175, 175, 138, 138, 184, 184, 184, 184, 184, |
| 2349 | 135, 142, 146, 178, 186, 144, 146, 184, 184, 184, |
| 2350 | 31, 48, 173, 176, 138, 3, 4, 9, 22, 23, |
| 2351 | 24, 35, 36, 52, 143, 185, 209, 210, 211, 211, |
| 2352 | 211, 211, 180, 178, 178, 135, 172, 135, 172, 211, |
| 2353 | 140, 135, 135, 135, 135, 135, 135, 211, 211, 33, |
| 2354 | 180, 178, 212, 129, 167, 169, 184, 184, 221, 135, |
| 2355 | 135, 135, 135, 184, 144, 146, 135, 135, 33, 19, |
| 2356 | 4, 175, 34, 178, 200, 201, 54, 208, 186, 135, |
| 2357 | 135, 211, 211, 211, 11, 48, 11, 221, 211, 140, |
| 2358 | 212, 178, 212, 212, 212, 135, 135, 178, 211, 211, |
| 2359 | 135, 135, 135, 135, 139, 184, 184, 184, 184, 144, |
| 2360 | 184, 184, 178, 168, 135, 139, 19, 144, 14, 14, |
| 2361 | 138, 135, 135, 211, 4, 211, 135, 211, 135, 135, |
| 2362 | 135, 211, 211, 138, 178, 184, 184, 212, 135, 139, |
| 2363 | 135, 135, 139, 139, 139, 156, 157, 34, 178, 170, |
| 2364 | 135, 211, 211, 178, 220, 211, 211, 135, 172, 172, |
| 2365 | 211, 135, 212, 212, 212, 220, 211, 139, 139, 184, |
| 2366 | 184, 184, 168, 173, 174, 19, 135, 140, 211, 135, |
| 2367 | 139, 142, 211, 139, 139, 139, 139, 157, 48, 171, |
| 2368 | 14, 142, 154, 217, 168, 178, 170, 142, 170, 4, |
| 2369 | 211, 209, 142, 154, 211, 33, 135, 209, 168, 14, |
| 2370 | 14, 135, 211, 211, 14, 66, 211, 14, 211 |
| 2371 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2372 | |
| 2373 | #define yyerrok (yyerrstatus = 0) |
| 2374 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2375 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2376 | #define YYEOF 0 |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2377 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2378 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2379 | #define YYABORT goto yyabortlab |
| 2380 | #define YYERROR goto yyerrorlab |
| 2381 | |
| 2382 | |
| 2383 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2384 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2385 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2386 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2387 | #define YYFAIL goto yyerrlab |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2388 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2389 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2390 | |
| 2391 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2392 | do \ |
| 2393 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2394 | { \ |
| 2395 | yychar = (Token); \ |
| 2396 | yylval = (Value); \ |
| 2397 | yytoken = YYTRANSLATE (yychar); \ |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2398 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2399 | goto yybackup; \ |
| 2400 | } \ |
| 2401 | else \ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2402 | { \ |
| 2403 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2404 | YYERROR; \ |
| 2405 | } \ |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2406 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2407 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2408 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2409 | #define YYTERROR 1 |
| 2410 | #define YYERRCODE 256 |
| 2411 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2412 | |
| 2413 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2414 | If N is 0, then set CURRENT to the empty location which ends |
| 2415 | the previous symbol: RHS[0] (always defined). */ |
| 2416 | |
| 2417 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2418 | #ifndef YYLLOC_DEFAULT |
| 2419 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2420 | do \ |
| 2421 | if (N) \ |
| 2422 | { \ |
| 2423 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2424 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2425 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2426 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2427 | } \ |
| 2428 | else \ |
| 2429 | { \ |
| 2430 | (Current).first_line = (Current).last_line = \ |
| 2431 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2432 | (Current).first_column = (Current).last_column = \ |
| 2433 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2434 | } \ |
| 2435 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2436 | #endif |
| 2437 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2438 | |
| 2439 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2440 | This macro was not mandated originally: define only if we know |
| 2441 | we won't break user code: when these are the locations we know. */ |
| 2442 | |
| 2443 | #ifndef YY_LOCATION_PRINT |
| 2444 | # if YYLTYPE_IS_TRIVIAL |
| 2445 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2446 | fprintf (File, "%d.%d-%d.%d", \ |
| 2447 | (Loc).first_line, (Loc).first_column, \ |
| 2448 | (Loc).last_line, (Loc).last_column) |
| 2449 | # else |
| 2450 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2451 | # endif |
| 2452 | #endif |
| 2453 | |
| 2454 | |
| 2455 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2456 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2457 | #ifdef YYLEX_PARAM |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2458 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2459 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2460 | # define YYLEX yylex () |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2461 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2462 | |
| 2463 | /* Enable debugging if requested. */ |
| 2464 | #if YYDEBUG |
| 2465 | |
| 2466 | # ifndef YYFPRINTF |
| 2467 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2468 | # define YYFPRINTF fprintf |
| 2469 | # endif |
| 2470 | |
| 2471 | # define YYDPRINTF(Args) \ |
| 2472 | do { \ |
| 2473 | if (yydebug) \ |
| 2474 | YYFPRINTF Args; \ |
| 2475 | } while (0) |
| 2476 | |
| 2477 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2478 | do { \ |
| 2479 | if (yydebug) \ |
| 2480 | { \ |
| 2481 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2482 | yysymprint (stderr, \ |
| 2483 | Type, Value); \ |
| 2484 | YYFPRINTF (stderr, "\n"); \ |
| 2485 | } \ |
| 2486 | } while (0) |
| 2487 | |
| 2488 | /*------------------------------------------------------------------. |
| 2489 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2490 | | TOP (included). | |
| 2491 | `------------------------------------------------------------------*/ |
| 2492 | |
| 2493 | #if defined (__STDC__) || defined (__cplusplus) |
| 2494 | static void |
| 2495 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2496 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2497 | static void |
| 2498 | yy_stack_print (bottom, top) |
| 2499 | short int *bottom; |
| 2500 | short int *top; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2501 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2502 | { |
| 2503 | YYFPRINTF (stderr, "Stack now"); |
| 2504 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2505 | YYFPRINTF (stderr, " %d", *bottom); |
| 2506 | YYFPRINTF (stderr, "\n"); |
| 2507 | } |
| 2508 | |
| 2509 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2510 | do { \ |
| 2511 | if (yydebug) \ |
| 2512 | yy_stack_print ((Bottom), (Top)); \ |
| 2513 | } while (0) |
| 2514 | |
| 2515 | |
| 2516 | /*------------------------------------------------. |
| 2517 | | Report that the YYRULE is going to be reduced. | |
| 2518 | `------------------------------------------------*/ |
| 2519 | |
| 2520 | #if defined (__STDC__) || defined (__cplusplus) |
| 2521 | static void |
| 2522 | yy_reduce_print (int yyrule) |
| 2523 | #else |
| 2524 | static void |
| 2525 | yy_reduce_print (yyrule) |
| 2526 | int yyrule; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2527 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2528 | { |
| 2529 | int yyi; |
| 2530 | unsigned long int yylno = yyrline[yyrule]; |
| 2531 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2532 | yyrule - 1, yylno); |
| 2533 | /* Print the symbols being reduced, and their result. */ |
| 2534 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2535 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2536 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2537 | } |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2538 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2539 | # define YY_REDUCE_PRINT(Rule) \ |
| 2540 | do { \ |
| 2541 | if (yydebug) \ |
| 2542 | yy_reduce_print (Rule); \ |
| 2543 | } while (0) |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2544 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2545 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2546 | multiple parsers can coexist. */ |
| 2547 | int yydebug; |
| 2548 | #else /* !YYDEBUG */ |
| 2549 | # define YYDPRINTF(Args) |
| 2550 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2551 | # define YY_STACK_PRINT(Bottom, Top) |
| 2552 | # define YY_REDUCE_PRINT(Rule) |
| 2553 | #endif /* !YYDEBUG */ |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2554 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2555 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2556 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2557 | #ifndef YYINITDEPTH |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2558 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2559 | #endif |
| 2560 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2561 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2562 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2563 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2564 | Do not make this value too large; the results are undefined if |
| 2565 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2566 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2567 | |
| 2568 | #ifndef YYMAXDEPTH |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2569 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2570 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2571 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2572 | |
| 2573 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2574 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2575 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2576 | # ifndef yystrlen |
| 2577 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2578 | # define yystrlen strlen |
| 2579 | # else |
| 2580 | /* Return the length of YYSTR. */ |
| 2581 | static YYSIZE_T |
| 2582 | # if defined (__STDC__) || defined (__cplusplus) |
| 2583 | yystrlen (const char *yystr) |
| 2584 | # else |
| 2585 | yystrlen (yystr) |
| 2586 | const char *yystr; |
| 2587 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2588 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2589 | const char *yys = yystr; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2590 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2591 | while (*yys++ != '\0') |
| 2592 | continue; |
| 2593 | |
| 2594 | return yys - yystr - 1; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2595 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2596 | # endif |
| 2597 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2598 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2599 | # ifndef yystpcpy |
| 2600 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2601 | # define yystpcpy stpcpy |
| 2602 | # else |
| 2603 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2604 | YYDEST. */ |
| 2605 | static char * |
| 2606 | # if defined (__STDC__) || defined (__cplusplus) |
| 2607 | yystpcpy (char *yydest, const char *yysrc) |
| 2608 | # else |
| 2609 | yystpcpy (yydest, yysrc) |
| 2610 | char *yydest; |
| 2611 | const char *yysrc; |
| 2612 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2613 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2614 | char *yyd = yydest; |
| 2615 | const char *yys = yysrc; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2616 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2617 | while ((*yyd++ = *yys++) != '\0') |
| 2618 | continue; |
| 2619 | |
| 2620 | return yyd - 1; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2621 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2622 | # endif |
| 2623 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2624 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2625 | # ifndef yytnamerr |
| 2626 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2627 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2628 | heuristic is that double-quoting is unnecessary unless the string |
| 2629 | contains an apostrophe, a comma, or backslash (other than |
| 2630 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2631 | null, do not copy; instead, return the length of what the result |
| 2632 | would have been. */ |
| 2633 | static YYSIZE_T |
| 2634 | yytnamerr (char *yyres, const char *yystr) |
| 2635 | { |
| 2636 | if (*yystr == '"') |
| 2637 | { |
| 2638 | size_t yyn = 0; |
| 2639 | char const *yyp = yystr; |
| 2640 | |
| 2641 | for (;;) |
| 2642 | switch (*++yyp) |
| 2643 | { |
| 2644 | case '\'': |
| 2645 | case ',': |
| 2646 | goto do_not_strip_quotes; |
| 2647 | |
| 2648 | case '\\': |
| 2649 | if (*++yyp != '\\') |
| 2650 | goto do_not_strip_quotes; |
| 2651 | /* Fall through. */ |
| 2652 | default: |
| 2653 | if (yyres) |
| 2654 | yyres[yyn] = *yyp; |
| 2655 | yyn++; |
| 2656 | break; |
| 2657 | |
| 2658 | case '"': |
| 2659 | if (yyres) |
| 2660 | yyres[yyn] = '\0'; |
| 2661 | return yyn; |
| 2662 | } |
| 2663 | do_not_strip_quotes: ; |
| 2664 | } |
| 2665 | |
| 2666 | if (! yyres) |
| 2667 | return yystrlen (yystr); |
| 2668 | |
| 2669 | return yystpcpy (yyres, yystr) - yyres; |
| 2670 | } |
| 2671 | # endif |
| 2672 | |
| 2673 | #endif /* YYERROR_VERBOSE */ |
| 2674 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2675 | |
| 2676 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2677 | #if YYDEBUG |
| 2678 | /*--------------------------------. |
| 2679 | | Print this symbol on YYOUTPUT. | |
| 2680 | `--------------------------------*/ |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2681 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2682 | #if defined (__STDC__) || defined (__cplusplus) |
| 2683 | static void |
| 2684 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2685 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2686 | static void |
| 2687 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2688 | FILE *yyoutput; |
| 2689 | int yytype; |
| 2690 | YYSTYPE *yyvaluep; |
| 2691 | #endif |
| 2692 | { |
| 2693 | /* Pacify ``unused variable'' warnings. */ |
| 2694 | (void) yyvaluep; |
| 2695 | |
| 2696 | if (yytype < YYNTOKENS) |
| 2697 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2698 | else |
| 2699 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2700 | |
| 2701 | |
| 2702 | # ifdef YYPRINT |
| 2703 | if (yytype < YYNTOKENS) |
| 2704 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2705 | # endif |
| 2706 | switch (yytype) |
| 2707 | { |
| 2708 | default: |
| 2709 | break; |
| 2710 | } |
| 2711 | YYFPRINTF (yyoutput, ")"); |
| 2712 | } |
| 2713 | |
| 2714 | #endif /* ! YYDEBUG */ |
| 2715 | /*-----------------------------------------------. |
| 2716 | | Release the memory associated to this symbol. | |
| 2717 | `-----------------------------------------------*/ |
| 2718 | |
| 2719 | #if defined (__STDC__) || defined (__cplusplus) |
| 2720 | static void |
| 2721 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2722 | #else |
| 2723 | static void |
| 2724 | yydestruct (yymsg, yytype, yyvaluep) |
| 2725 | const char *yymsg; |
| 2726 | int yytype; |
| 2727 | YYSTYPE *yyvaluep; |
| 2728 | #endif |
| 2729 | { |
| 2730 | /* Pacify ``unused variable'' warnings. */ |
| 2731 | (void) yyvaluep; |
| 2732 | |
| 2733 | if (!yymsg) |
| 2734 | yymsg = "Deleting"; |
| 2735 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2736 | |
| 2737 | switch (yytype) |
| 2738 | { |
| 2739 | |
| 2740 | default: |
| 2741 | break; |
| 2742 | } |
| 2743 | } |
| 2744 | |
| 2745 | |
| 2746 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2747 | |
| 2748 | #ifdef YYPARSE_PARAM |
| 2749 | # if defined (__STDC__) || defined (__cplusplus) |
| 2750 | int yyparse (void *YYPARSE_PARAM); |
| 2751 | # else |
| 2752 | int yyparse (); |
| 2753 | # endif |
| 2754 | #else /* ! YYPARSE_PARAM */ |
| 2755 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2756 | int yyparse (void); |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2757 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2758 | int yyparse (); |
| 2759 | #endif |
| 2760 | #endif /* ! YYPARSE_PARAM */ |
| 2761 | |
| 2762 | |
| 2763 | |
| 2764 | /* The look-ahead symbol. */ |
| 2765 | int yychar; |
| 2766 | |
| 2767 | /* The semantic value of the look-ahead symbol. */ |
| 2768 | YYSTYPE yylval; |
| 2769 | |
| 2770 | /* Number of syntax errors so far. */ |
| 2771 | int yynerrs; |
| 2772 | |
| 2773 | |
| 2774 | |
| 2775 | /*----------. |
| 2776 | | yyparse. | |
| 2777 | `----------*/ |
| 2778 | |
| 2779 | #ifdef YYPARSE_PARAM |
| 2780 | # if defined (__STDC__) || defined (__cplusplus) |
| 2781 | int yyparse (void *YYPARSE_PARAM) |
| 2782 | # else |
| 2783 | int yyparse (YYPARSE_PARAM) |
| 2784 | void *YYPARSE_PARAM; |
| 2785 | # endif |
| 2786 | #else /* ! YYPARSE_PARAM */ |
| 2787 | #if defined (__STDC__) || defined (__cplusplus) |
| 2788 | int |
| 2789 | yyparse (void) |
| 2790 | #else |
| 2791 | int |
| 2792 | yyparse () |
| 2793 | |
| 2794 | #endif |
| 2795 | #endif |
| 2796 | { |
| 2797 | |
| 2798 | int yystate; |
| 2799 | int yyn; |
| 2800 | int yyresult; |
| 2801 | /* Number of tokens to shift before error messages enabled. */ |
| 2802 | int yyerrstatus; |
| 2803 | /* Look-ahead token as an internal (translated) token number. */ |
| 2804 | int yytoken = 0; |
| 2805 | |
| 2806 | /* Three stacks and their tools: |
| 2807 | `yyss': related to states, |
| 2808 | `yyvs': related to semantic values, |
| 2809 | `yyls': related to locations. |
| 2810 | |
| 2811 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2812 | to reallocate them elsewhere. */ |
| 2813 | |
| 2814 | /* The state stack. */ |
| 2815 | short int yyssa[YYINITDEPTH]; |
| 2816 | short int *yyss = yyssa; |
| 2817 | short int *yyssp; |
| 2818 | |
| 2819 | /* The semantic value stack. */ |
| 2820 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2821 | YYSTYPE *yyvs = yyvsa; |
| 2822 | YYSTYPE *yyvsp; |
| 2823 | |
| 2824 | |
| 2825 | |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2826 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2827 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2828 | YYSIZE_T yystacksize = YYINITDEPTH; |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2829 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2830 | /* The variables used to return semantic value and location from the |
| 2831 | action routines. */ |
| 2832 | YYSTYPE yyval; |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2833 | |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2834 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2835 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2836 | rule. */ |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2837 | int yylen; |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2838 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2839 | YYDPRINTF ((stderr, "Starting parse\n")); |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2840 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2841 | yystate = 0; |
| 2842 | yyerrstatus = 0; |
| 2843 | yynerrs = 0; |
| 2844 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2845 | |
| 2846 | /* Initialize stack pointers. |
| 2847 | Waste one element of value and location stack |
| 2848 | so that they stay on the same level as the state stack. |
| 2849 | The wasted elements are never initialized. */ |
| 2850 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2851 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2852 | yyvsp = yyvs; |
| 2853 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2854 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2855 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2856 | /*------------------------------------------------------------. |
| 2857 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2858 | `------------------------------------------------------------*/ |
| 2859 | yynewstate: |
| 2860 | /* In all cases, when you get here, the value and location stacks |
| 2861 | have just been pushed. so pushing a state here evens the stacks. |
| 2862 | */ |
| 2863 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2864 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2865 | yysetstate: |
| 2866 | *yyssp = yystate; |
| 2867 | |
| 2868 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2869 | { |
| 2870 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2871 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2872 | |
| 2873 | #ifdef yyoverflow |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2874 | { |
| 2875 | /* Give user a chance to reallocate the stack. Use copies of |
| 2876 | these so that the &'s don't force the real ones into |
| 2877 | memory. */ |
| 2878 | YYSTYPE *yyvs1 = yyvs; |
| 2879 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2880 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2881 | |
| 2882 | /* Each stack pointer address is followed by the size of the |
| 2883 | data in use in that stack, in bytes. This used to be a |
| 2884 | conditional around just the two extra args, but that might |
| 2885 | be undefined if yyoverflow is a macro. */ |
| 2886 | yyoverflow (YY_("memory exhausted"), |
| 2887 | &yyss1, yysize * sizeof (*yyssp), |
| 2888 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2889 | |
| 2890 | &yystacksize); |
| 2891 | |
| 2892 | yyss = yyss1; |
| 2893 | yyvs = yyvs1; |
| 2894 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2895 | #else /* no yyoverflow */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2896 | # ifndef YYSTACK_RELOCATE |
| 2897 | goto yyexhaustedlab; |
| 2898 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2899 | /* Extend the stack our own way. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2900 | if (YYMAXDEPTH <= yystacksize) |
| 2901 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2902 | yystacksize *= 2; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2903 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2904 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2905 | |
| 2906 | { |
| 2907 | short int *yyss1 = yyss; |
| 2908 | union yyalloc *yyptr = |
| 2909 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2910 | if (! yyptr) |
| 2911 | goto yyexhaustedlab; |
| 2912 | YYSTACK_RELOCATE (yyss); |
| 2913 | YYSTACK_RELOCATE (yyvs); |
| 2914 | |
| 2915 | # undef YYSTACK_RELOCATE |
| 2916 | if (yyss1 != yyssa) |
| 2917 | YYSTACK_FREE (yyss1); |
| 2918 | } |
| 2919 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2920 | #endif /* no yyoverflow */ |
| 2921 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2922 | yyssp = yyss + yysize - 1; |
| 2923 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2924 | |
| 2925 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2926 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2927 | (unsigned long int) yystacksize)); |
| 2928 | |
| 2929 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2930 | YYABORT; |
| 2931 | } |
| 2932 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2933 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2934 | |
| 2935 | goto yybackup; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2936 | |
| 2937 | /*-----------. |
| 2938 | | yybackup. | |
| 2939 | `-----------*/ |
| 2940 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2941 | |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2942 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2943 | /* Read a look-ahead token if we need one and don't already have one. */ |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2944 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2945 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2946 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2947 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2948 | yyn = yypact[yystate]; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2949 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2950 | goto yydefault; |
| 2951 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2952 | /* 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] | 2953 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2954 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2955 | if (yychar == YYEMPTY) |
| 2956 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2957 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2958 | yychar = YYLEX; |
| 2959 | } |
| 2960 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2961 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2962 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2963 | yychar = yytoken = YYEOF; |
| 2964 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2965 | } |
| 2966 | else |
| 2967 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2968 | yytoken = YYTRANSLATE (yychar); |
| 2969 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2970 | } |
| 2971 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2972 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 2973 | detect an error, take that action. */ |
| 2974 | yyn += yytoken; |
| 2975 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2976 | goto yydefault; |
| 2977 | yyn = yytable[yyn]; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2978 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2979 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2980 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2981 | goto yyerrlab; |
| 2982 | yyn = -yyn; |
| 2983 | goto yyreduce; |
| 2984 | } |
| 2985 | |
| 2986 | if (yyn == YYFINAL) |
| 2987 | YYACCEPT; |
| 2988 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2989 | /* Shift the look-ahead token. */ |
| 2990 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2991 | |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2992 | /* Discard the token being shifted unless it is eof. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2993 | if (yychar != YYEOF) |
| 2994 | yychar = YYEMPTY; |
| 2995 | |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2996 | *++yyvsp = yylval; |
| 2997 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2998 | |
| 2999 | /* Count tokens shifted since error; after three, turn off error |
| 3000 | status. */ |
| 3001 | if (yyerrstatus) |
| 3002 | yyerrstatus--; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 3003 | |
| 3004 | yystate = yyn; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3005 | goto yynewstate; |
| 3006 | |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3007 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3008 | /*-----------------------------------------------------------. |
| 3009 | | yydefault -- do the default action for the current state. | |
| 3010 | `-----------------------------------------------------------*/ |
| 3011 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3012 | yyn = yydefact[yystate]; |
| 3013 | if (yyn == 0) |
| 3014 | goto yyerrlab; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3015 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3016 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3017 | |
| 3018 | /*-----------------------------. |
| 3019 | | yyreduce -- Do a reduction. | |
| 3020 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3021 | yyreduce: |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3022 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3023 | yylen = yyr2[yyn]; |
| 3024 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3025 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3026 | `$$ = $1'. |
| 3027 | |
| 3028 | Otherwise, the following line sets YYVAL to garbage. |
| 3029 | This behavior is undocumented and Bison |
| 3030 | users should not rely upon it. Assigning to YYVAL |
| 3031 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3032 | GCC warning that YYVAL may be used uninitialized. */ |
| 3033 | yyval = yyvsp[1-yylen]; |
| 3034 | |
| 3035 | |
| 3036 | YY_REDUCE_PRINT (yyn); |
| 3037 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3038 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3039 | case 29: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3040 | #line 1099 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3041 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3042 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3043 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3044 | case 30: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3045 | #line 1099 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3046 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3047 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3048 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3049 | case 31: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3050 | #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3051 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3052 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3053 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3054 | case 32: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3055 | #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3056 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3057 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3058 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3059 | case 33: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3060 | #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3061 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3062 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3063 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3064 | case 34: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3065 | #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3066 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3067 | break; |
| 3068 | |
| 3069 | case 35: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3070 | #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3071 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3072 | break; |
| 3073 | |
| 3074 | case 36: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3075 | #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3076 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3077 | break; |
| 3078 | |
| 3079 | case 37: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3080 | #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3081 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3082 | break; |
| 3083 | |
| 3084 | case 38: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3085 | #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3086 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3087 | break; |
| 3088 | |
| 3089 | case 39: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3090 | #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3091 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3092 | break; |
| 3093 | |
| 3094 | case 40: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3095 | #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3096 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3097 | break; |
| 3098 | |
| 3099 | case 41: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3100 | #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3101 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3102 | break; |
| 3103 | |
| 3104 | case 42: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3105 | #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3106 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3107 | break; |
| 3108 | |
| 3109 | case 43: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3110 | #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3111 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3112 | break; |
| 3113 | |
| 3114 | case 44: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3115 | #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3116 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3117 | break; |
| 3118 | |
| 3119 | case 45: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3120 | #line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3121 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3122 | break; |
| 3123 | |
| 3124 | case 46: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3125 | #line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3126 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3127 | break; |
| 3128 | |
| 3129 | case 47: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3130 | #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3131 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3132 | break; |
| 3133 | |
| 3134 | case 48: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3135 | #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3136 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3137 | break; |
| 3138 | |
| 3139 | case 49: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3140 | #line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3141 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3142 | break; |
| 3143 | |
| 3144 | case 50: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3145 | #line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3146 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3147 | break; |
| 3148 | |
| 3149 | case 51: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3150 | #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3151 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3152 | break; |
| 3153 | |
| 3154 | case 52: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3155 | #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3156 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3157 | break; |
| 3158 | |
| 3159 | case 53: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3160 | #line 1114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3161 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3162 | break; |
| 3163 | |
| 3164 | case 54: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3165 | #line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3166 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3167 | break; |
| 3168 | |
| 3169 | case 61: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3170 | #line 1124 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3171 | { (yyval.StrVal) = 0; ;} |
| 3172 | break; |
| 3173 | |
| 3174 | case 62: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3175 | #line 1128 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3176 | { |
| 3177 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3178 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3179 | ;} |
| 3180 | break; |
| 3181 | |
| 3182 | case 63: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3183 | #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3184 | { |
| 3185 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3186 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3187 | ;} |
| 3188 | break; |
| 3189 | |
| 3190 | case 66: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3191 | #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3192 | { |
| 3193 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3194 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3195 | ;} |
| 3196 | break; |
| 3197 | |
| 3198 | case 67: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3199 | #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3200 | { |
| 3201 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3202 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3203 | ;} |
| 3204 | break; |
| 3205 | |
| 3206 | case 68: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3207 | #line 1149 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3208 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3209 | break; |
| 3210 | |
| 3211 | case 69: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3212 | #line 1150 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3213 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3214 | break; |
| 3215 | |
| 3216 | case 70: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3217 | #line 1151 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3218 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3219 | break; |
| 3220 | |
| 3221 | case 71: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3222 | #line 1152 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3223 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3224 | break; |
| 3225 | |
| 3226 | case 72: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3227 | #line 1153 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3228 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3229 | break; |
| 3230 | |
| 3231 | case 73: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3232 | #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3233 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3234 | break; |
| 3235 | |
| 3236 | case 74: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3237 | #line 1158 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3238 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3239 | break; |
| 3240 | |
| 3241 | case 75: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3242 | #line 1159 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3243 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3244 | break; |
| 3245 | |
| 3246 | case 76: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3247 | #line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3248 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3249 | break; |
| 3250 | |
| 3251 | case 77: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3252 | #line 1164 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3253 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3254 | break; |
| 3255 | |
| 3256 | case 78: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3257 | #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3258 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3259 | break; |
| 3260 | |
| 3261 | case 79: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3262 | #line 1169 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3263 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3264 | break; |
| 3265 | |
| 3266 | case 80: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3267 | #line 1170 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3268 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3269 | break; |
| 3270 | |
| 3271 | case 81: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3272 | #line 1174 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3273 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3274 | break; |
| 3275 | |
| 3276 | case 82: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3277 | #line 1175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3278 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3279 | break; |
| 3280 | |
| 3281 | case 83: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3282 | #line 1176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3283 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3284 | break; |
| 3285 | |
| 3286 | case 84: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3287 | #line 1177 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3288 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3289 | break; |
| 3290 | |
| 3291 | case 85: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3292 | #line 1178 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3293 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3294 | break; |
| 3295 | |
| 3296 | case 86: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3297 | #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3298 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3299 | break; |
| 3300 | |
| 3301 | case 87: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3302 | #line 1182 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3303 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3304 | break; |
| 3305 | |
| 3306 | case 88: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3307 | #line 1183 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3308 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3309 | break; |
| 3310 | |
| 3311 | case 89: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3312 | #line 1184 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3313 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3314 | break; |
| 3315 | |
| 3316 | case 90: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3317 | #line 1185 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3318 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3319 | break; |
| 3320 | |
| 3321 | case 91: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3322 | #line 1186 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3323 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3324 | break; |
| 3325 | |
| 3326 | case 92: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3327 | #line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3328 | { |
| 3329 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3330 | GEN_ERROR("Calling conv too large"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3331 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3332 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3333 | ;} |
| 3334 | break; |
| 3335 | |
| 3336 | case 93: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3337 | #line 1194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3338 | { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;} |
| 3339 | break; |
| 3340 | |
| 3341 | case 94: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3342 | #line 1195 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3343 | { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;} |
| 3344 | break; |
| 3345 | |
| 3346 | case 95: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3347 | #line 1196 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3348 | { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;} |
| 3349 | break; |
| 3350 | |
| 3351 | case 96: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3352 | #line 1197 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3353 | { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;} |
| 3354 | break; |
| 3355 | |
| 3356 | case 97: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3357 | #line 1200 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3358 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
| 3359 | break; |
| 3360 | |
| 3361 | case 98: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3362 | #line 1201 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3363 | { |
| 3364 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3365 | ;} |
| 3366 | break; |
| 3367 | |
| 3368 | case 99: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3369 | #line 1206 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3370 | { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;} |
| 3371 | break; |
| 3372 | |
| 3373 | case 101: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3374 | #line 1210 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3375 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
| 3376 | break; |
| 3377 | |
| 3378 | case 102: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3379 | #line 1211 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3380 | { |
| 3381 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3382 | ;} |
| 3383 | break; |
| 3384 | |
| 3385 | case 103: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3386 | #line 1218 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3387 | { (yyval.UIntVal) = 0; ;} |
| 3388 | break; |
| 3389 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3390 | case 104: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3391 | #line 1219 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3392 | { |
| 3393 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3394 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3395 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3396 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3397 | ;} |
| 3398 | break; |
| 3399 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3400 | case 105: |
| 3401 | #line 1225 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3402 | { (yyval.UIntVal) = 0; ;} |
| 3403 | break; |
| 3404 | |
| 3405 | case 106: |
| 3406 | #line 1226 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3407 | { |
| 3408 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3409 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3410 | GEN_ERROR("Alignment must be a power of two"); |
| 3411 | CHECK_FOR_ERROR |
| 3412 | ;} |
| 3413 | break; |
| 3414 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3415 | case 107: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3416 | #line 1234 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3417 | { |
| 3418 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3419 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3420 | GEN_ERROR("Invalid character in section name"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3421 | (yyval.StrVal) = (yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3422 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3423 | ;} |
| 3424 | break; |
| 3425 | |
| 3426 | case 108: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3427 | #line 1242 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3428 | { (yyval.StrVal) = 0; ;} |
| 3429 | break; |
| 3430 | |
| 3431 | case 109: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3432 | #line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3433 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3434 | break; |
| 3435 | |
| 3436 | case 110: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3437 | #line 1248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3438 | {;} |
| 3439 | break; |
| 3440 | |
| 3441 | case 111: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3442 | #line 1249 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3443 | {;} |
| 3444 | break; |
| 3445 | |
| 3446 | case 112: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3447 | #line 1250 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3448 | { |
| 3449 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3450 | free((yyvsp[0].StrVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3451 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3452 | ;} |
| 3453 | break; |
| 3454 | |
| 3455 | case 113: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3456 | #line 1255 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3457 | { |
| 3458 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3459 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3460 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3461 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3462 | ;} |
| 3463 | break; |
| 3464 | |
| 3465 | case 118: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3466 | #line 1271 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3467 | { |
| 3468 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3469 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3470 | ;} |
| 3471 | break; |
| 3472 | |
| 3473 | case 119: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3474 | #line 1275 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3475 | { |
| 3476 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3477 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3478 | ;} |
| 3479 | break; |
| 3480 | |
| 3481 | case 120: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3482 | #line 1279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3483 | { // Pointer type? |
| 3484 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3485 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3486 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3487 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3488 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3489 | ;} |
| 3490 | break; |
| 3491 | |
| 3492 | case 121: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3493 | #line 1286 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3494 | { // Named types are also simple types... |
| 3495 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3496 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3497 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 3498 | ;} |
| 3499 | break; |
| 3500 | |
| 3501 | case 122: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3502 | #line 1291 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3503 | { // Type UpReference |
| 3504 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3505 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3506 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3507 | (yyval.TypeVal) = new PATypeHolder(OT); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3508 | UR_OUT("New Upreference!\n"); |
| 3509 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3510 | ;} |
| 3511 | break; |
| 3512 | |
| 3513 | case 123: |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3514 | #line 1299 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3515 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3516 | std::vector<const Type*> Params; |
| 3517 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3518 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3519 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3520 | const Type *Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3521 | Params.push_back(Ty); |
| 3522 | if (Ty != Type::VoidTy) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3523 | Attrs.push_back(I->Attrs); |
| 3524 | } |
| 3525 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3526 | if (isVarArg) Params.pop_back(); |
| 3527 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3528 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs); |
| 3529 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3530 | delete (yyvsp[-4].TypeVal); // Delete the return type handle |
| 3531 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3532 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3533 | ;} |
| 3534 | break; |
| 3535 | |
| 3536 | case 124: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3537 | #line 1318 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3538 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3539 | std::vector<const Type*> Params; |
| 3540 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3541 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3542 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3543 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3544 | Params.push_back(Ty); |
| 3545 | if (Ty != Type::VoidTy) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3546 | Attrs.push_back(I->Attrs); |
| 3547 | } |
| 3548 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3549 | if (isVarArg) Params.pop_back(); |
| 3550 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3551 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs); |
| 3552 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3553 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3554 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3555 | ;} |
| 3556 | break; |
| 3557 | |
| 3558 | case 125: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3559 | #line 1337 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3560 | { // Sized array type? |
| 3561 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3562 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3563 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3564 | ;} |
| 3565 | break; |
| 3566 | |
| 3567 | case 126: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3568 | #line 1342 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3569 | { // Vector type? |
| 3570 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3571 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3572 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3573 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 3574 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3575 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3576 | GEN_ERROR("Vector length should be a power of 2"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3577 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3578 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3579 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3580 | ;} |
| 3581 | break; |
| 3582 | |
| 3583 | case 127: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3584 | #line 1354 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3585 | { // Structure type? |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3586 | std::vector<const Type*> Elements; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3587 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3588 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3589 | Elements.push_back(*I); |
| 3590 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3591 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3592 | delete (yyvsp[-1].TypeList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3593 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3594 | ;} |
| 3595 | break; |
| 3596 | |
| 3597 | case 128: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3598 | #line 1364 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3599 | { // Empty structure type? |
| 3600 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3601 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3602 | ;} |
| 3603 | break; |
| 3604 | |
| 3605 | case 129: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3606 | #line 1368 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3607 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3608 | std::vector<const Type*> Elements; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3609 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 3610 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3611 | Elements.push_back(*I); |
| 3612 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3613 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3614 | delete (yyvsp[-2].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3615 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3616 | ;} |
| 3617 | break; |
| 3618 | |
| 3619 | case 130: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3620 | #line 1378 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3621 | { // Empty structure type? |
| 3622 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3623 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3624 | ;} |
| 3625 | break; |
| 3626 | |
| 3627 | case 131: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3628 | #line 1385 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3629 | { |
| 3630 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3631 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3632 | ;} |
| 3633 | break; |
| 3634 | |
| 3635 | case 132: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3636 | #line 1392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3637 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3638 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3639 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 3640 | if (!(*(yyvsp[0].TypeVal))->isFirstClassType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3641 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3642 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
| 3643 | ;} |
| 3644 | break; |
| 3645 | |
| 3646 | case 133: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3647 | #line 1399 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3648 | { |
| 3649 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 3650 | ;} |
| 3651 | break; |
| 3652 | |
| 3653 | case 134: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3654 | #line 1404 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3655 | { |
| 3656 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3657 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3658 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3659 | ;} |
| 3660 | break; |
| 3661 | |
| 3662 | case 135: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3663 | #line 1409 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3664 | { |
| 3665 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3666 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3667 | ;} |
| 3668 | break; |
| 3669 | |
| 3670 | case 137: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3671 | #line 1417 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3672 | { |
| 3673 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3674 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3675 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3676 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3677 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3678 | ;} |
| 3679 | break; |
| 3680 | |
| 3681 | case 138: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3682 | #line 1424 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3683 | { |
| 3684 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3685 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3686 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3687 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3688 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3689 | ;} |
| 3690 | break; |
| 3691 | |
| 3692 | case 139: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3693 | #line 1431 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3694 | { |
| 3695 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3696 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3697 | ;} |
| 3698 | break; |
| 3699 | |
| 3700 | case 140: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3701 | #line 1439 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3702 | { |
| 3703 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3704 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); |
| 3705 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3706 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3707 | ;} |
| 3708 | break; |
| 3709 | |
| 3710 | case 141: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3711 | #line 1445 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3712 | { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 3713 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); |
| 3714 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3715 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3716 | ;} |
| 3717 | break; |
| 3718 | |
| 3719 | case 142: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3720 | #line 1457 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3721 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3722 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3723 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3724 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3725 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3726 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3727 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3728 | const Type *ETy = ATy->getElementType(); |
| 3729 | int NumElements = ATy->getNumElements(); |
| 3730 | |
| 3731 | // Verify that we have the correct size... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3732 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3733 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3734 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3735 | itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3736 | |
| 3737 | // Verify all elements are correct type! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3738 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3739 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3740 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3741 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3742 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3743 | } |
| 3744 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3745 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3746 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3747 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3748 | ;} |
| 3749 | break; |
| 3750 | |
| 3751 | case 143: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3752 | #line 1485 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3753 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3754 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3755 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3756 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3757 | if (ATy == 0) |
| 3758 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3759 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3760 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3761 | int NumElements = ATy->getNumElements(); |
| 3762 | if (NumElements != -1 && NumElements != 0) |
| 3763 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3764 | " arguments, but has size of " + itostr(NumElements) +""); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3765 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3766 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3767 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3768 | ;} |
| 3769 | break; |
| 3770 | |
| 3771 | case 144: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3772 | #line 1501 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3773 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3774 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3775 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3776 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3777 | if (ATy == 0) |
| 3778 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3779 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3780 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3781 | int NumElements = ATy->getNumElements(); |
| 3782 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3783 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 3784 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3785 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3786 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3787 | " when array has size " + itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3788 | std::vector<Constant*> Vals; |
| 3789 | if (ETy == Type::Int8Ty) { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3790 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3791 | C != (unsigned char*)EndStr; ++C) |
| 3792 | Vals.push_back(ConstantInt::get(ETy, *C)); |
| 3793 | } else { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3794 | free((yyvsp[0].StrVal)); |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3795 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3796 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3797 | free((yyvsp[0].StrVal)); |
| 3798 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3799 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3800 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3801 | ;} |
| 3802 | break; |
| 3803 | |
| 3804 | case 145: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3805 | #line 1530 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3806 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3807 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3808 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3809 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3810 | if (PTy == 0) |
| 3811 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3812 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3813 | const Type *ETy = PTy->getElementType(); |
| 3814 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3815 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3816 | // Verify that we have the correct size... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3817 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3818 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3819 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3820 | itostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3821 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3822 | // Verify all elements are correct type! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3823 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3824 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3825 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3826 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3827 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3828 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3829 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3830 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector)); |
| 3831 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3832 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3833 | ;} |
| 3834 | break; |
| 3835 | |
| 3836 | case 146: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3837 | #line 1558 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3838 | { |
| 3839 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3840 | if (STy == 0) |
| 3841 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3842 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3843 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3844 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3845 | GEN_ERROR("Illegal number of initializers for structure type"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3846 | |
| 3847 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3848 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
| 3849 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3850 | GEN_ERROR("Expected type '" + |
| 3851 | STy->getElementType(i)->getDescription() + |
| 3852 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3853 | " of structure initializer"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3854 | |
| 3855 | // Check to ensure that Type is not packed |
| 3856 | if (STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3857 | GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3858 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3859 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 3860 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3861 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3862 | ;} |
| 3863 | break; |
| 3864 | |
| 3865 | case 147: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3866 | #line 1583 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3867 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3868 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3869 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3870 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3871 | if (STy == 0) |
| 3872 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3873 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3874 | |
| 3875 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3876 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3877 | |
| 3878 | // Check to ensure that Type is not packed |
| 3879 | if (STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3880 | GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3881 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3882 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3883 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3884 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3885 | ;} |
| 3886 | break; |
| 3887 | |
| 3888 | case 148: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3889 | #line 1602 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3890 | { |
| 3891 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3892 | if (STy == 0) |
| 3893 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3894 | (*(yyvsp[-5].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3895 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3896 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3897 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3898 | |
| 3899 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3900 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) |
| 3901 | if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3902 | GEN_ERROR("Expected type '" + |
| 3903 | STy->getElementType(i)->getDescription() + |
| 3904 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3905 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3906 | |
| 3907 | // Check to ensure that Type is packed |
| 3908 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3909 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 3910 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3911 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3912 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector)); |
| 3913 | delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3914 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3915 | ;} |
| 3916 | break; |
| 3917 | |
| 3918 | case 149: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3919 | #line 1628 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3920 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3921 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3922 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 3923 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3924 | if (STy == 0) |
| 3925 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3926 | (*(yyvsp[-4].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3927 | |
| 3928 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3929 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3930 | |
| 3931 | // Check to ensure that Type is packed |
| 3932 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3933 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 3934 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3935 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3936 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3937 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3938 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3939 | ;} |
| 3940 | break; |
| 3941 | |
| 3942 | case 150: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3943 | #line 1648 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3944 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3945 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3946 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3947 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3948 | if (PTy == 0) |
| 3949 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3950 | (*(yyvsp[-1].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3951 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3952 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 3953 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3954 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3955 | ;} |
| 3956 | break; |
| 3957 | |
| 3958 | case 151: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3959 | #line 1660 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3960 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3961 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3962 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3963 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 3964 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3965 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3966 | ;} |
| 3967 | break; |
| 3968 | |
| 3969 | case 152: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 3970 | #line 1667 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3971 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3972 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3973 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3974 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3975 | if (Ty == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3976 | GEN_ERROR("Global const reference must be a pointer type"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3977 | |
| 3978 | // ConstExprs can exist in the body of a function, thus creating |
| 3979 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3980 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3981 | // symbol table instead of the module symbol table for the global symbol, |
| 3982 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3983 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3984 | // |
| 3985 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3986 | CurFun.CurrentFunction = 0; |
| 3987 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3988 | Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3989 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3990 | |
| 3991 | CurFun.CurrentFunction = SavedCurFn; |
| 3992 | |
| 3993 | // If this is an initializer for a constant pointer, which is referencing a |
| 3994 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3995 | // in the future with the right type of variable. |
| 3996 | // |
| 3997 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 3998 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3999 | const PointerType *PT = cast<PointerType>(Ty); |
| 4000 | |
| 4001 | // First check to see if the forward references value is already created! |
| 4002 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4003 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4004 | |
| 4005 | if (I != CurModule.GlobalRefs.end()) { |
| 4006 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4007 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4008 | } else { |
| 4009 | std::string Name; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4010 | if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName) |
| 4011 | Name = (yyvsp[0].ValIDVal).Name; |
| 4012 | else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4013 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4014 | |
| 4015 | // Create the forward referenced global. |
| 4016 | GlobalValue *GV; |
| 4017 | if (const FunctionType *FTy = |
| 4018 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 4019 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 4020 | CurModule.CurrentModule); |
| 4021 | } else { |
| 4022 | GV = new GlobalVariable(PT->getElementType(), false, |
| 4023 | GlobalValue::ExternalLinkage, 0, |
| 4024 | Name, CurModule.CurrentModule); |
| 4025 | } |
| 4026 | |
| 4027 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4028 | 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] | 4029 | V = GV; |
| 4030 | } |
| 4031 | } |
| 4032 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4033 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4034 | delete (yyvsp[-1].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4035 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4036 | ;} |
| 4037 | break; |
| 4038 | |
| 4039 | case 153: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4040 | #line 1733 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4041 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4042 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4043 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4044 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4045 | GEN_ERROR("Mismatched types for constant expression: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4046 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); |
| 4047 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 4048 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4049 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4050 | ;} |
| 4051 | break; |
| 4052 | |
| 4053 | case 154: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4054 | #line 1743 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4055 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4056 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4057 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4058 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4059 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4060 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4061 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4062 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4063 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4064 | ;} |
| 4065 | break; |
| 4066 | |
| 4067 | case 155: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4068 | #line 1753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4069 | { // integral constants |
| 4070 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4071 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4072 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4073 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4074 | ;} |
| 4075 | break; |
| 4076 | |
| 4077 | case 156: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4078 | #line 1759 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4079 | { // arbitrary precision integer constants |
| 4080 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4081 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
| 4082 | GEN_ERROR("Constant value does not fit in type"); |
Reid Spencer | 1079427 | 2007-03-01 19:41:47 +0000 | [diff] [blame] | 4083 | } |
| 4084 | (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth); |
| 4085 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4086 | delete (yyvsp[0].APIntVal); |
| 4087 | CHECK_FOR_ERROR |
| 4088 | ;} |
| 4089 | break; |
| 4090 | |
| 4091 | case 157: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4092 | #line 1769 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4093 | { // integral constants |
| 4094 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4095 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4096 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4097 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4098 | ;} |
| 4099 | break; |
| 4100 | |
| 4101 | case 158: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4102 | #line 1775 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4103 | { // arbitrary precision integer constants |
| 4104 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4105 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
| 4106 | GEN_ERROR("Constant value does not fit in type"); |
Reid Spencer | 1079427 | 2007-03-01 19:41:47 +0000 | [diff] [blame] | 4107 | } |
| 4108 | (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth); |
| 4109 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4110 | delete (yyvsp[0].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4111 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4112 | ;} |
| 4113 | break; |
| 4114 | |
| 4115 | case 159: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4116 | #line 1785 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4117 | { // Boolean constants |
| 4118 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4119 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4120 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4121 | ;} |
| 4122 | break; |
| 4123 | |
| 4124 | case 160: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4125 | #line 1790 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4126 | { // Boolean constants |
| 4127 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4128 | (yyval.ConstVal) = ConstantInt::getFalse(); |
| 4129 | CHECK_FOR_ERROR |
| 4130 | ;} |
| 4131 | break; |
| 4132 | |
| 4133 | case 161: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4134 | #line 1795 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4135 | { // Float & Double constants |
| 4136 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4137 | GEN_ERROR("Floating point constant invalid for type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4138 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4139 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4140 | ;} |
| 4141 | break; |
| 4142 | |
| 4143 | case 162: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4144 | #line 1803 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4145 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4146 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4147 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4148 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4149 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4150 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4151 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4152 | Val->getType()->getDescription() + "' to '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4153 | DestTy->getDescription() + "'"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4154 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
| 4155 | delete (yyvsp[-1].TypeVal); |
| 4156 | ;} |
| 4157 | break; |
| 4158 | |
| 4159 | case 163: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4160 | #line 1815 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4161 | { |
| 4162 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4163 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4164 | |
| 4165 | const Type *IdxTy = |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4166 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(), |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 4167 | true); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4168 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4169 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4170 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4171 | SmallVector<Constant*, 8> IdxVec; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4172 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 4173 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4174 | IdxVec.push_back(C); |
| 4175 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4176 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4177 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4178 | delete (yyvsp[-1].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4179 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4180 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4181 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4182 | ;} |
| 4183 | break; |
| 4184 | |
| 4185 | case 164: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4186 | #line 1837 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4187 | { |
| 4188 | if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4189 | GEN_ERROR("Select condition must be of boolean type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4190 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4191 | GEN_ERROR("Select operand types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4192 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4193 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4194 | ;} |
| 4195 | break; |
| 4196 | |
| 4197 | case 165: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4198 | #line 1845 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4199 | { |
| 4200 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4201 | GEN_ERROR("Binary operator types must match"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4202 | CHECK_FOR_ERROR; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4203 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4204 | ;} |
| 4205 | break; |
| 4206 | |
| 4207 | case 166: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4208 | #line 1851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4209 | { |
| 4210 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4211 | GEN_ERROR("Logical operator types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4212 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) { |
| 4213 | if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) || |
| 4214 | !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4215 | GEN_ERROR("Logical operator requires integral operands"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4216 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4217 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4218 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4219 | ;} |
| 4220 | break; |
| 4221 | |
| 4222 | case 167: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4223 | #line 1862 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4224 | { |
| 4225 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4226 | GEN_ERROR("icmp operand types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4227 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4228 | ;} |
| 4229 | break; |
| 4230 | |
| 4231 | case 168: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4232 | #line 1867 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4233 | { |
| 4234 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4235 | GEN_ERROR("fcmp operand types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4236 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4237 | ;} |
| 4238 | break; |
| 4239 | |
| 4240 | case 169: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4241 | #line 1872 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4242 | { |
| 4243 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4244 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4245 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4246 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4247 | ;} |
| 4248 | break; |
| 4249 | |
| 4250 | case 170: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4251 | #line 1878 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4252 | { |
| 4253 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4254 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4255 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4256 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4257 | ;} |
| 4258 | break; |
| 4259 | |
| 4260 | case 171: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4261 | #line 1884 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4262 | { |
| 4263 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4264 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4265 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4266 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4267 | ;} |
| 4268 | break; |
| 4269 | |
| 4270 | case 172: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4271 | #line 1893 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4272 | { |
| 4273 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4274 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4275 | ;} |
| 4276 | break; |
| 4277 | |
| 4278 | case 173: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4279 | #line 1897 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4280 | { |
| 4281 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4282 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4283 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4284 | ;} |
| 4285 | break; |
| 4286 | |
| 4287 | case 174: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4288 | #line 1905 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4289 | { (yyval.BoolVal) = false; ;} |
| 4290 | break; |
| 4291 | |
| 4292 | case 175: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4293 | #line 1905 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4294 | { (yyval.BoolVal) = true; ;} |
| 4295 | break; |
| 4296 | |
| 4297 | case 176: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4298 | #line 1916 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4299 | { |
| 4300 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4301 | CurModule.ModuleDone(); |
| 4302 | CHECK_FOR_ERROR; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4303 | ;} |
| 4304 | break; |
| 4305 | |
| 4306 | case 177: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4307 | #line 1921 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4308 | { |
| 4309 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4310 | CurModule.ModuleDone(); |
| 4311 | CHECK_FOR_ERROR; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4312 | ;} |
| 4313 | break; |
| 4314 | |
| 4315 | case 180: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4316 | #line 1934 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4317 | { CurFun.isDeclare = false; ;} |
| 4318 | break; |
| 4319 | |
| 4320 | case 181: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4321 | #line 1934 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4322 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4323 | CurFun.FunctionDone(); |
| 4324 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4325 | ;} |
| 4326 | break; |
| 4327 | |
| 4328 | case 182: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4329 | #line 1938 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4330 | { CurFun.isDeclare = true; ;} |
| 4331 | break; |
| 4332 | |
| 4333 | case 183: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4334 | #line 1938 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4335 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4336 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4337 | ;} |
| 4338 | break; |
| 4339 | |
| 4340 | case 184: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4341 | #line 1941 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4342 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4343 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4344 | ;} |
| 4345 | break; |
| 4346 | |
| 4347 | case 185: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4348 | #line 1944 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4349 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4350 | // Emit an error if there are any unresolved types left. |
| 4351 | if (!CurModule.LateResolveTypes.empty()) { |
| 4352 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4353 | if (DID.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4354 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4355 | } else { |
| 4356 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4357 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4358 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4359 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4360 | ;} |
| 4361 | break; |
| 4362 | |
| 4363 | case 186: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4364 | #line 1956 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4365 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4366 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4367 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4368 | // Eagerly resolve types. This is not an optimization, this is a |
| 4369 | // requirement that is due to the fact that we could have this: |
| 4370 | // |
| 4371 | // %list = type { %list * } |
| 4372 | // %list = type { %list * } ; repeated type decl |
| 4373 | // |
| 4374 | // If types are not resolved eagerly, then the two types will not be |
| 4375 | // determined to be the same type! |
| 4376 | // |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4377 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4378 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4379 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4380 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4381 | // If this is a named type that is not a redefinition, add it to the slot |
| 4382 | // table. |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4383 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4384 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4385 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4386 | delete (yyvsp[0].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4387 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4388 | ;} |
| 4389 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4390 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4391 | case 187: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4392 | #line 1980 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4393 | { |
| 4394 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); |
| 4395 | |
| 4396 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4397 | CHECK_FOR_ERROR |
| 4398 | // If this is a named type that is not a redefinition, add it to the slot |
| 4399 | // table. |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4400 | CurModule.Types.push_back((yyvsp[0].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4401 | } |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4402 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4403 | ;} |
| 4404 | break; |
| 4405 | |
| 4406 | case 188: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4407 | #line 1991 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4408 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4409 | /* "Externally Visible" Linkage */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4410 | if ((yyvsp[0].ConstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4411 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4412 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, |
| 4413 | (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4414 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4415 | ;} |
| 4416 | break; |
| 4417 | |
| 4418 | case 189: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4419 | #line 1998 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4420 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4421 | CurGV = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4422 | ;} |
| 4423 | break; |
| 4424 | |
| 4425 | case 190: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4426 | #line 2001 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4427 | { |
| 4428 | if ((yyvsp[0].ConstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4429 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4430 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4431 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4432 | ;} |
| 4433 | break; |
| 4434 | |
| 4435 | case 191: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4436 | #line 2006 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4437 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4438 | CurGV = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4439 | ;} |
| 4440 | break; |
| 4441 | |
| 4442 | case 192: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4443 | #line 2009 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4444 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4445 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4446 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 4447 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4448 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4449 | delete (yyvsp[0].TypeVal); |
| 4450 | ;} |
| 4451 | break; |
| 4452 | |
| 4453 | case 193: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4454 | #line 2015 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4455 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4456 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4457 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4458 | ;} |
| 4459 | break; |
| 4460 | |
| 4461 | case 194: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4462 | #line 2019 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4463 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4464 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4465 | ;} |
| 4466 | break; |
| 4467 | |
| 4468 | case 195: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4469 | #line 2022 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4470 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4471 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4472 | ;} |
| 4473 | break; |
| 4474 | |
| 4475 | case 196: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4476 | #line 2028 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4477 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4478 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4479 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4480 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4481 | free((yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4482 | |
| 4483 | if (AsmSoFar.empty()) |
| 4484 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4485 | else |
| 4486 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4487 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4488 | ;} |
| 4489 | break; |
| 4490 | |
| 4491 | case 197: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4492 | #line 2041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4493 | { |
| 4494 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4495 | free((yyvsp[0].StrVal)); |
| 4496 | ;} |
| 4497 | break; |
| 4498 | |
| 4499 | case 198: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4500 | #line 2045 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4501 | { |
| 4502 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4503 | free((yyvsp[0].StrVal)); |
| 4504 | ;} |
| 4505 | break; |
| 4506 | |
| 4507 | case 200: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4508 | #line 2052 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4509 | { |
| 4510 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4511 | free((yyvsp[0].StrVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4512 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4513 | ;} |
| 4514 | break; |
| 4515 | |
| 4516 | case 201: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4517 | #line 2057 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4518 | { |
| 4519 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4520 | free((yyvsp[0].StrVal)); |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 4521 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4522 | ;} |
| 4523 | break; |
| 4524 | |
| 4525 | case 202: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4526 | #line 2062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4527 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4528 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4529 | ;} |
| 4530 | break; |
| 4531 | |
| 4532 | case 203: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4533 | #line 2071 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4534 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4535 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4536 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4537 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4538 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4539 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4540 | (yyval.ArgList) = (yyvsp[-4].ArgList); |
| 4541 | (yyvsp[-4].ArgList)->push_back(E); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4542 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4543 | ;} |
| 4544 | break; |
| 4545 | |
| 4546 | case 204: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4547 | #line 2081 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4548 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4549 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4550 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4551 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4552 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4553 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4554 | (yyval.ArgList) = new ArgListType; |
| 4555 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4556 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4557 | ;} |
| 4558 | break; |
| 4559 | |
| 4560 | case 205: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4561 | #line 2092 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4562 | { |
| 4563 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4564 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4565 | ;} |
| 4566 | break; |
| 4567 | |
| 4568 | case 206: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4569 | #line 2096 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4570 | { |
| 4571 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4572 | struct ArgListEntry E; |
| 4573 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4574 | E.Name = 0; |
| 4575 | E.Attrs = FunctionType::NoAttributeSet; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4576 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4577 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4578 | ;} |
| 4579 | break; |
| 4580 | |
| 4581 | case 207: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4582 | #line 2105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4583 | { |
| 4584 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4585 | struct ArgListEntry E; |
| 4586 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4587 | E.Name = 0; |
| 4588 | E.Attrs = FunctionType::NoAttributeSet; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4589 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4590 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4591 | ;} |
| 4592 | break; |
| 4593 | |
| 4594 | case 208: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4595 | #line 2114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4596 | { |
| 4597 | (yyval.ArgList) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4598 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4599 | ;} |
| 4600 | break; |
| 4601 | |
| 4602 | case 209: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4603 | #line 2120 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4604 | { |
| 4605 | UnEscapeLexed((yyvsp[-6].StrVal)); |
| 4606 | std::string FunctionName((yyvsp[-6].StrVal)); |
| 4607 | free((yyvsp[-6].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4608 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4609 | // Check the function result for abstractness if this is a define. We should |
| 4610 | // have no abstract types at this point |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4611 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal))) |
| 4612 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4613 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4614 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4615 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4616 | ParamAttrs.push_back((yyvsp[-2].ParamAttrs)); |
| 4617 | if ((yyvsp[-4].ArgList)) { // If there are arguments... |
| 4618 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4619 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4620 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4621 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4622 | ParamTypeList.push_back(Ty); |
| 4623 | if (Ty != Type::VoidTy) |
| 4624 | ParamAttrs.push_back(I->Attrs); |
| 4625 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4626 | } |
| 4627 | |
| 4628 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4629 | if (isVarArg) ParamTypeList.pop_back(); |
| 4630 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4631 | FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4632 | ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4633 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4634 | delete (yyvsp[-7].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4635 | |
| 4636 | ValID ID; |
| 4637 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4638 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4639 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4640 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4641 | } |
| 4642 | |
| 4643 | Function *Fn = 0; |
| 4644 | // See if this function was forward referenced. If so, recycle the object. |
| 4645 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4646 | // Move the function to the end of the list, from whereever it was |
| 4647 | // previously inserted. |
| 4648 | Fn = cast<Function>(FWRef); |
| 4649 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4650 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4651 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4652 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
| 4653 | if (Fn->getFunctionType() != FT ) { |
| 4654 | // The existing function doesn't have the same type. This is an overload |
| 4655 | // error. |
| 4656 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
| 4657 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
| 4658 | // Neither the existing or the current function is a declaration and they |
| 4659 | // have the same name and same type. Clearly this is a redefinition. |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4660 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4661 | } if (Fn->isDeclaration()) { |
| 4662 | // Make sure to strip off any argument names so we can't get conflicts. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4663 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4664 | AI != AE; ++AI) |
| 4665 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4666 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4667 | } else { // Not already defined? |
| 4668 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4669 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4670 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4671 | InsertValue(Fn, CurModule.Values); |
| 4672 | } |
| 4673 | |
| 4674 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4675 | |
| 4676 | if (CurFun.isDeclare) { |
| 4677 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4678 | // correctly handle cases, when pointer to function is passed as argument to |
| 4679 | // another function. |
| 4680 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4681 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4682 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4683 | Fn->setCallingConv((yyvsp[-8].UIntVal)); |
| 4684 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4685 | if ((yyvsp[-1].StrVal)) { |
| 4686 | Fn->setSection((yyvsp[-1].StrVal)); |
| 4687 | free((yyvsp[-1].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4688 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4689 | |
| 4690 | // Add all of the arguments we parsed to the function... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4691 | if ((yyvsp[-4].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4692 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4693 | assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 && |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4694 | "Not a varargs marker!"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4695 | delete (yyvsp[-4].ArgList)->back().Ty; |
| 4696 | (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4697 | } |
| 4698 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4699 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4700 | unsigned Idx = 1; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4701 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); |
| 4702 | I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4703 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4704 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4705 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4706 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4707 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4708 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4709 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4710 | delete (yyvsp[-4].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4711 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4712 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4713 | ;} |
| 4714 | break; |
| 4715 | |
| 4716 | case 212: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4717 | #line 2233 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4718 | { |
| 4719 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4720 | |
| 4721 | // Make sure that we keep track of the linkage type even if there was a |
| 4722 | // previous "declare". |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4723 | (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage)); |
| 4724 | (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility)); |
| 4725 | ;} |
| 4726 | break; |
| 4727 | |
| 4728 | case 215: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4729 | #line 2244 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4730 | { |
| 4731 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4732 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4733 | ;} |
| 4734 | break; |
| 4735 | |
| 4736 | case 216: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4737 | #line 2249 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4738 | { |
| 4739 | CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); |
| 4740 | CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); |
| 4741 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4742 | CurFun.FunctionDone(); |
| 4743 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4744 | ;} |
| 4745 | break; |
| 4746 | |
| 4747 | case 217: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4748 | #line 2261 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4749 | { |
| 4750 | (yyval.BoolVal) = false; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4751 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4752 | ;} |
| 4753 | break; |
| 4754 | |
| 4755 | case 218: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4756 | #line 2265 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4757 | { |
| 4758 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4759 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4760 | ;} |
| 4761 | break; |
| 4762 | |
| 4763 | case 219: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4764 | #line 2270 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4765 | { // A reference to a direct constant |
| 4766 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4767 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4768 | ;} |
| 4769 | break; |
| 4770 | |
| 4771 | case 220: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4772 | #line 2274 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4773 | { |
| 4774 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4775 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4776 | ;} |
| 4777 | break; |
| 4778 | |
| 4779 | case 221: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4780 | #line 2278 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4781 | { // Perhaps it's an FP constant? |
| 4782 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4783 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4784 | ;} |
| 4785 | break; |
| 4786 | |
| 4787 | case 222: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4788 | #line 2282 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4789 | { |
| 4790 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4791 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4792 | ;} |
| 4793 | break; |
| 4794 | |
| 4795 | case 223: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4796 | #line 2286 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4797 | { |
| 4798 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4799 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4800 | ;} |
| 4801 | break; |
| 4802 | |
| 4803 | case 224: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4804 | #line 2290 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4805 | { |
| 4806 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4807 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4808 | ;} |
| 4809 | break; |
| 4810 | |
| 4811 | case 225: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4812 | #line 2294 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4813 | { |
| 4814 | (yyval.ValIDVal) = ValID::createUndef(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4815 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4816 | ;} |
| 4817 | break; |
| 4818 | |
| 4819 | case 226: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4820 | #line 2298 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4821 | { // A vector zero constant. |
| 4822 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4823 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4824 | ;} |
| 4825 | break; |
| 4826 | |
| 4827 | case 227: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4828 | #line 2302 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4829 | { // Nonempty unsized packed vector |
| 4830 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
| 4831 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4832 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 4833 | VectorType* pt = VectorType::get(ETy, NumElements); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4834 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4835 | HandleUpRefs( |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 4836 | VectorType::get( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4837 | ETy, |
| 4838 | NumElements) |
| 4839 | ) |
| 4840 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4841 | |
| 4842 | // Verify all elements are correct type! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4843 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4844 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4845 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4846 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4847 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4848 | } |
| 4849 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4850 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector))); |
| 4851 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4852 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4853 | ;} |
| 4854 | break; |
| 4855 | |
| 4856 | case 228: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4857 | #line 2327 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4858 | { |
| 4859 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4860 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4861 | ;} |
| 4862 | break; |
| 4863 | |
| 4864 | case 229: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4865 | #line 2331 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4866 | { |
| 4867 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 4868 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 4869 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4870 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 4871 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 4872 | free((yyvsp[-2].StrVal)); |
| 4873 | free((yyvsp[0].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4874 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4875 | ;} |
| 4876 | break; |
| 4877 | |
| 4878 | case 230: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4879 | #line 2345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4880 | { // Is it an integer reference...? |
| 4881 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4882 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4883 | ;} |
| 4884 | break; |
| 4885 | |
| 4886 | case 231: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4887 | #line 2349 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4888 | { |
| 4889 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4890 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4891 | ;} |
| 4892 | break; |
| 4893 | |
| 4894 | case 232: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4895 | #line 2353 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4896 | { // Is it a named reference...? |
| 4897 | (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4898 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4899 | ;} |
| 4900 | break; |
| 4901 | |
| 4902 | case 233: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4903 | #line 2357 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4904 | { // Is it a named reference...? |
| 4905 | (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4906 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4907 | ;} |
| 4908 | break; |
| 4909 | |
| 4910 | case 236: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4911 | #line 2369 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4912 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4913 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4914 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4915 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
| 4916 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4917 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4918 | ;} |
| 4919 | break; |
| 4920 | |
| 4921 | case 237: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4922 | #line 2378 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4923 | { |
| 4924 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4925 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4926 | ;} |
| 4927 | break; |
| 4928 | |
| 4929 | case 238: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4930 | #line 2382 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4931 | { // Do not allow functions with 0 basic blocks |
| 4932 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4933 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4934 | ;} |
| 4935 | break; |
| 4936 | |
| 4937 | case 239: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4938 | #line 2391 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4939 | { |
| 4940 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4941 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4942 | InsertValue((yyvsp[0].TermInstVal)); |
| 4943 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4944 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4945 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4946 | ;} |
| 4947 | break; |
| 4948 | |
| 4949 | case 240: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4950 | #line 2400 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4951 | { |
| 4952 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4953 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4954 | if (CI2->getParent() == 0) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4955 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
| 4956 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 4957 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4958 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4959 | ;} |
| 4960 | break; |
| 4961 | |
| 4962 | case 241: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4963 | #line 2409 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4964 | { // Empty space between instruction lists |
| 4965 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4966 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4967 | ;} |
| 4968 | break; |
| 4969 | |
| 4970 | case 242: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4971 | #line 2413 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4972 | { // Labelled (named) basic block |
| 4973 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal))); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4974 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4975 | ;} |
| 4976 | break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4977 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4978 | case 243: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4979 | #line 2418 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4980 | { // Return with a result... |
| 4981 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
| 4982 | CHECK_FOR_ERROR |
| 4983 | ;} |
| 4984 | break; |
| 4985 | |
| 4986 | case 244: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4987 | #line 2422 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4988 | { // Return with no result... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4989 | (yyval.TermInstVal) = new ReturnInst(); |
| 4990 | CHECK_FOR_ERROR |
| 4991 | ;} |
| 4992 | break; |
| 4993 | |
| 4994 | case 245: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 4995 | #line 2426 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4996 | { // Unconditional Branch... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4997 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4998 | CHECK_FOR_ERROR |
| 4999 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 5000 | ;} |
| 5001 | break; |
| 5002 | |
| 5003 | case 246: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5004 | #line 2431 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5005 | { |
| 5006 | assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 5007 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 5008 | CHECK_FOR_ERROR |
| 5009 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5010 | CHECK_FOR_ERROR |
| 5011 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); |
| 5012 | CHECK_FOR_ERROR |
| 5013 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 5014 | ;} |
| 5015 | break; |
| 5016 | |
| 5017 | case 247: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5018 | #line 2441 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5019 | { |
| 5020 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
| 5021 | CHECK_FOR_ERROR |
| 5022 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 5023 | CHECK_FOR_ERROR |
| 5024 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 5025 | (yyval.TermInstVal) = S; |
| 5026 | |
| 5027 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 5028 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5029 | for (; I != E; ++I) { |
| 5030 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5031 | S->addCase(CI, I->second); |
| 5032 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5033 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5034 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5035 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5036 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5037 | ;} |
| 5038 | break; |
| 5039 | |
| 5040 | case 248: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5041 | #line 2460 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5042 | { |
| 5043 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5044 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5045 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5046 | CHECK_FOR_ERROR |
| 5047 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5048 | (yyval.TermInstVal) = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5049 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5050 | ;} |
| 5051 | break; |
| 5052 | |
| 5053 | case 249: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5054 | #line 2470 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5055 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5056 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5057 | // Handle the short syntax |
| 5058 | const PointerType *PFTy = 0; |
| 5059 | const FunctionType *Ty = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5060 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5061 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5062 | // Pull out the types of all of the arguments... |
| 5063 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5064 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5065 | ParamAttrs.push_back((yyvsp[-6].ParamAttrs)); |
| 5066 | for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5067 | const Type *Ty = I->Val->getType(); |
| 5068 | if (Ty == Type::VoidTy) |
| 5069 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5070 | ParamTypes.push_back(Ty); |
| 5071 | ParamAttrs.push_back(I->Attrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5072 | } |
| 5073 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5074 | Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5075 | PFTy = PointerType::get(Ty); |
| 5076 | } |
| 5077 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5078 | delete (yyvsp[-11].TypeVal); |
| 5079 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5080 | Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5081 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5082 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5083 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5084 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5085 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5086 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5087 | // Check the arguments |
| 5088 | ValueList Args; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5089 | if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5090 | // Make sure no arguments is a good thing! |
| 5091 | if (Ty->getNumParams() != 0) |
| 5092 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5093 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5094 | } else { // Has arguments? |
| 5095 | // Loop through FunctionType's arguments and ensure they are specified |
| 5096 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5097 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5098 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5099 | ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5100 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5101 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5102 | if (ArgI->Val->getType() != *I) |
| 5103 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5104 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5105 | Args.push_back(ArgI->Val); |
| 5106 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5107 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5108 | if (Ty->isVarArg()) { |
| 5109 | if (I == E) |
| 5110 | for (; ArgI != ArgE; ++ArgI) |
| 5111 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5112 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5113 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5114 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5115 | |
| 5116 | // Create the InvokeInst |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5117 | InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size()); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5118 | II->setCallingConv((yyvsp[-12].UIntVal)); |
| 5119 | (yyval.TermInstVal) = II; |
| 5120 | delete (yyvsp[-8].ValueRefList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5121 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5122 | ;} |
| 5123 | break; |
| 5124 | |
| 5125 | case 250: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5126 | #line 2538 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5127 | { |
| 5128 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5129 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5130 | ;} |
| 5131 | break; |
| 5132 | |
| 5133 | case 251: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5134 | #line 2542 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5135 | { |
| 5136 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5137 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5138 | ;} |
| 5139 | break; |
| 5140 | |
| 5141 | case 252: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5142 | #line 2549 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5143 | { |
| 5144 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5145 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5146 | CHECK_FOR_ERROR |
| 5147 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5148 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5149 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5150 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5151 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5152 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5153 | ;} |
| 5154 | break; |
| 5155 | |
| 5156 | case 253: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5157 | #line 2560 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5158 | { |
| 5159 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5160 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5161 | CHECK_FOR_ERROR |
| 5162 | |
| 5163 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5164 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5165 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5166 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5167 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5168 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5169 | ;} |
| 5170 | break; |
| 5171 | |
| 5172 | case 254: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5173 | #line 2573 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5174 | { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5175 | // Is this definition named?? if so, assign the name... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5176 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5177 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5178 | InsertValue((yyvsp[0].InstVal)); |
| 5179 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5180 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5181 | ;} |
| 5182 | break; |
| 5183 | |
| 5184 | case 255: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5185 | #line 2583 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5186 | { // Used for PHI nodes |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5187 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5188 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); |
| 5189 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5190 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5191 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5192 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5193 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5194 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5195 | delete (yyvsp[-5].TypeVal); |
| 5196 | ;} |
| 5197 | break; |
| 5198 | |
| 5199 | case 256: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5200 | #line 2594 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5201 | { |
| 5202 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5203 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5204 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5205 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5206 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5207 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5208 | ;} |
| 5209 | break; |
| 5210 | |
| 5211 | case 257: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5212 | #line 2604 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5213 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5214 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5215 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5216 | // Used for call and invoke instructions |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5217 | (yyval.ValueRefList) = new ValueRefList(); |
| 5218 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5219 | (yyval.ValueRefList)->push_back(E); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5220 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5221 | ;} |
| 5222 | break; |
| 5223 | |
| 5224 | case 258: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5225 | #line 2613 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5226 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5227 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5228 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5229 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); |
| 5230 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5231 | (yyval.ValueRefList)->push_back(E); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5232 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5233 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5234 | ;} |
| 5235 | break; |
| 5236 | |
| 5237 | case 259: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5238 | #line 2622 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5239 | { (yyval.ValueRefList) = new ValueRefList(); ;} |
| 5240 | break; |
| 5241 | |
| 5242 | case 260: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5243 | #line 2625 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5244 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5245 | break; |
| 5246 | |
| 5247 | case 261: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5248 | #line 2626 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5249 | { |
| 5250 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5251 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5252 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5253 | ;} |
| 5254 | break; |
| 5255 | |
| 5256 | case 262: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5257 | #line 2633 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5258 | { |
| 5259 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5260 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5261 | ;} |
| 5262 | break; |
| 5263 | |
| 5264 | case 263: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5265 | #line 2637 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5266 | { |
| 5267 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5268 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5269 | ;} |
| 5270 | break; |
| 5271 | |
| 5272 | case 264: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5273 | #line 2642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5274 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5275 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5276 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5277 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5278 | !isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5279 | GEN_ERROR( |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5280 | "Arithmetic operator requires integer, FP, or packed operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5281 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5282 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5283 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5284 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5285 | GEN_ERROR("Remainder not supported on vector types"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5286 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5287 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5288 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5289 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5290 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
| 5291 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5292 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5293 | delete (yyvsp[-3].TypeVal); |
| 5294 | ;} |
| 5295 | break; |
| 5296 | |
| 5297 | case 265: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5298 | #line 2663 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5299 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5300 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5301 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5302 | if (!(*(yyvsp[-3].TypeVal))->isInteger()) { |
| 5303 | if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) || |
| 5304 | !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5305 | GEN_ERROR("Logical operator requires integral operands"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5306 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5307 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5308 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5309 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5310 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5311 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
| 5312 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5313 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5314 | delete (yyvsp[-3].TypeVal); |
| 5315 | ;} |
| 5316 | break; |
| 5317 | |
| 5318 | case 266: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5319 | #line 2680 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5320 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5321 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5322 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5323 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5324 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5325 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5326 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5327 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5328 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5329 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5330 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5331 | GEN_ERROR("icmp operator returned null"); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5332 | delete (yyvsp[-3].TypeVal); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5333 | ;} |
| 5334 | break; |
| 5335 | |
| 5336 | case 267: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5337 | #line 2694 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5338 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5339 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5340 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5341 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5342 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5343 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5344 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5345 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5346 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5347 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5348 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5349 | GEN_ERROR("fcmp operator returned null"); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5350 | delete (yyvsp[-3].TypeVal); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5351 | ;} |
| 5352 | break; |
| 5353 | |
| 5354 | case 268: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5355 | #line 2708 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5356 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5357 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5358 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5359 | Value* Val = (yyvsp[-2].ValueVal); |
| 5360 | const Type* DestTy = (yyvsp[0].TypeVal)->get(); |
| 5361 | if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5362 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5363 | Val->getType()->getDescription() + "' to '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5364 | DestTy->getDescription() + "'"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5365 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy); |
| 5366 | delete (yyvsp[0].TypeVal); |
| 5367 | ;} |
| 5368 | break; |
| 5369 | |
| 5370 | case 269: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5371 | #line 2720 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5372 | { |
| 5373 | if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5374 | GEN_ERROR("select condition must be boolean"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5375 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5376 | GEN_ERROR("select value types should match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5377 | (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] | 5378 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5379 | ;} |
| 5380 | break; |
| 5381 | |
| 5382 | case 270: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5383 | #line 2728 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5384 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5385 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5386 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5387 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5388 | delete (yyvsp[0].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5389 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5390 | ;} |
| 5391 | break; |
| 5392 | |
| 5393 | case 271: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5394 | #line 2735 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5395 | { |
| 5396 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5397 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5398 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5399 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5400 | ;} |
| 5401 | break; |
| 5402 | |
| 5403 | case 272: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5404 | #line 2741 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5405 | { |
| 5406 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5407 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5408 | (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] | 5409 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5410 | ;} |
| 5411 | break; |
| 5412 | |
| 5413 | case 273: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5414 | #line 2747 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5415 | { |
| 5416 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5417 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5418 | (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] | 5419 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5420 | ;} |
| 5421 | break; |
| 5422 | |
| 5423 | case 274: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5424 | #line 2753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5425 | { |
| 5426 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5427 | if (!Ty->isFirstClassType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5428 | GEN_ERROR("PHI node operands must be of first class type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5429 | (yyval.InstVal) = new PHINode(Ty); |
| 5430 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5431 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5432 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5433 | GEN_ERROR("All elements of a PHI node must be of the same type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5434 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5435 | (yyvsp[0].PHIList)->pop_front(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5436 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5437 | delete (yyvsp[0].PHIList); // Free the list... |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5438 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5439 | ;} |
| 5440 | break; |
| 5441 | |
| 5442 | case 275: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5443 | #line 2769 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5444 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5445 | |
| 5446 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5447 | const PointerType *PFTy = 0; |
| 5448 | const FunctionType *Ty = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5449 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5450 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5451 | // Pull out the types of all of the arguments... |
| 5452 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5453 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5454 | ParamAttrs.push_back((yyvsp[0].ParamAttrs)); |
| 5455 | for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5456 | const Type *Ty = I->Val->getType(); |
| 5457 | if (Ty == Type::VoidTy) |
| 5458 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5459 | ParamTypes.push_back(Ty); |
| 5460 | ParamAttrs.push_back(I->Attrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5461 | } |
| 5462 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5463 | Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5464 | PFTy = PointerType::get(Ty); |
| 5465 | } |
| 5466 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5467 | Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5468 | CHECK_FOR_ERROR |
| 5469 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5470 | // Check the arguments |
| 5471 | ValueList Args; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5472 | if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5473 | // Make sure no arguments is a good thing! |
| 5474 | if (Ty->getNumParams() != 0) |
| 5475 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5476 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5477 | } else { // Has arguments? |
| 5478 | // Loop through FunctionType's arguments and ensure they are specified |
| 5479 | // correctly! |
| 5480 | // |
| 5481 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5482 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5483 | ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end(); |
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 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5486 | if (ArgI->Val->getType() != *I) |
| 5487 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5488 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5489 | Args.push_back(ArgI->Val); |
| 5490 | } |
| 5491 | if (Ty->isVarArg()) { |
| 5492 | if (I == E) |
| 5493 | for (; ArgI != ArgE; ++ArgI) |
| 5494 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5495 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5496 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5497 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5498 | // Create the call node |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5499 | CallInst *CI = new CallInst(V, &Args[0], Args.size()); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5500 | CI->setTailCall((yyvsp[-7].BoolVal)); |
| 5501 | CI->setCallingConv((yyvsp[-6].UIntVal)); |
| 5502 | (yyval.InstVal) = CI; |
| 5503 | delete (yyvsp[-2].ValueRefList); |
| 5504 | delete (yyvsp[-5].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5505 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5506 | ;} |
| 5507 | break; |
| 5508 | |
| 5509 | case 276: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5510 | #line 2832 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5511 | { |
| 5512 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5513 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5514 | ;} |
| 5515 | break; |
| 5516 | |
| 5517 | case 277: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5518 | #line 2837 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5519 | { |
| 5520 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5521 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5522 | ;} |
| 5523 | break; |
| 5524 | |
| 5525 | case 278: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5526 | #line 2841 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5527 | { |
| 5528 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5529 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5530 | ;} |
| 5531 | break; |
| 5532 | |
| 5533 | case 279: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5534 | #line 2848 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5535 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5536 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5537 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5538 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5539 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5540 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5541 | ;} |
| 5542 | break; |
| 5543 | |
| 5544 | case 280: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5545 | #line 2855 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5546 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5547 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5548 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5549 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5550 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5551 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5552 | delete (yyvsp[-4].TypeVal); |
| 5553 | ;} |
| 5554 | break; |
| 5555 | |
| 5556 | case 281: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5557 | #line 2863 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5558 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5559 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5560 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5561 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5562 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5563 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5564 | ;} |
| 5565 | break; |
| 5566 | |
| 5567 | case 282: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5568 | #line 2870 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5569 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5570 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5571 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5572 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5573 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5574 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5575 | delete (yyvsp[-4].TypeVal); |
| 5576 | ;} |
| 5577 | break; |
| 5578 | |
| 5579 | case 283: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5580 | #line 2878 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5581 | { |
| 5582 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5583 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5584 | (yyvsp[0].ValueVal)->getType()->getDescription() + ""); |
| 5585 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5586 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5587 | ;} |
| 5588 | break; |
| 5589 | |
| 5590 | case 284: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5591 | #line 2886 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5592 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5593 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5594 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5595 | if (!isa<PointerType>((yyvsp[-1].TypeVal)->get())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5596 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5597 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5598 | if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5599 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5600 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5601 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5602 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5603 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
| 5604 | delete (yyvsp[-1].TypeVal); |
| 5605 | ;} |
| 5606 | break; |
| 5607 | |
| 5608 | case 285: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5609 | #line 2900 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5610 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5611 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5612 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5613 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5614 | if (!PT) |
| 5615 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5616 | (*(yyvsp[-1].TypeVal))->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5617 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5618 | if (ElTy != (yyvsp[-3].ValueVal)->getType()) |
| 5619 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5620 | "' into space of type '" + ElTy->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5621 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5622 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5623 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5624 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); |
| 5625 | delete (yyvsp[-1].TypeVal); |
| 5626 | ;} |
| 5627 | break; |
| 5628 | |
| 5629 | case 286: |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5630 | #line 2917 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5631 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5632 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5633 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5634 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5635 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5636 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5637 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5638 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5639 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'"); |
| 5640 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5641 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5642 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size()); |
| 5643 | delete (yyvsp[-2].TypeVal); |
| 5644 | delete (yyvsp[0].ValueList); |
| 5645 | ;} |
| 5646 | break; |
| 5647 | |
| 5648 | |
| 5649 | default: break; |
| 5650 | } |
| 5651 | |
| 5652 | /* Line 1126 of yacc.c. */ |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5653 | #line 5654 "llvmAsmParser.tab.c" |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5654 | |
| 5655 | yyvsp -= yylen; |
| 5656 | yyssp -= yylen; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5657 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5658 | |
| 5659 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5660 | |
| 5661 | *++yyvsp = yyval; |
| 5662 | |
| 5663 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5664 | /* Now `shift' the result of the reduction. Determine what state |
| 5665 | that goes to, based on the state we popped back to and the rule |
| 5666 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5667 | |
| 5668 | yyn = yyr1[yyn]; |
| 5669 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5670 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5671 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5672 | yystate = yytable[yystate]; |
| 5673 | else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5674 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5675 | |
| 5676 | goto yynewstate; |
| 5677 | |
| 5678 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5679 | /*------------------------------------. |
| 5680 | | yyerrlab -- here on detecting error | |
| 5681 | `------------------------------------*/ |
| 5682 | yyerrlab: |
| 5683 | /* If not already recovering from an error, report this error. */ |
| 5684 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5685 | { |
| 5686 | ++yynerrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5687 | #if YYERROR_VERBOSE |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5688 | yyn = yypact[yystate]; |
| 5689 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5690 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5691 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5692 | int yytype = YYTRANSLATE (yychar); |
| 5693 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5694 | YYSIZE_T yysize = yysize0; |
| 5695 | YYSIZE_T yysize1; |
| 5696 | int yysize_overflow = 0; |
| 5697 | char *yymsg = 0; |
| 5698 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5699 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5700 | int yyx; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5701 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5702 | #if 0 |
| 5703 | /* This is so xgettext sees the translatable formats that are |
| 5704 | constructed on the fly. */ |
| 5705 | YY_("syntax error, unexpected %s"); |
| 5706 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5707 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5708 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5709 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5710 | #endif |
| 5711 | char *yyfmt; |
| 5712 | char const *yyf; |
| 5713 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5714 | static char const yyexpecting[] = ", expecting %s"; |
| 5715 | static char const yyor[] = " or %s"; |
| 5716 | char yyformat[sizeof yyunexpected |
| 5717 | + sizeof yyexpecting - 1 |
| 5718 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5719 | * (sizeof yyor - 1))]; |
| 5720 | char const *yyprefix = yyexpecting; |
| 5721 | |
| 5722 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5723 | YYCHECK. */ |
| 5724 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5725 | |
| 5726 | /* Stay within bounds of both yycheck and yytname. */ |
| 5727 | int yychecklim = YYLAST - yyn; |
| 5728 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5729 | int yycount = 1; |
| 5730 | |
| 5731 | yyarg[0] = yytname[yytype]; |
| 5732 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5733 | |
| 5734 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5735 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5736 | { |
| 5737 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 5738 | { |
| 5739 | yycount = 1; |
| 5740 | yysize = yysize0; |
| 5741 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 5742 | break; |
| 5743 | } |
| 5744 | yyarg[yycount++] = yytname[yyx]; |
| 5745 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5746 | yysize_overflow |= yysize1 < yysize; |
| 5747 | yysize = yysize1; |
| 5748 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5749 | yyprefix = yyor; |
| 5750 | } |
| 5751 | |
| 5752 | yyf = YY_(yyformat); |
| 5753 | yysize1 = yysize + yystrlen (yyf); |
| 5754 | yysize_overflow |= yysize1 < yysize; |
| 5755 | yysize = yysize1; |
| 5756 | |
| 5757 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5758 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5759 | if (yymsg) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5760 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5761 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5762 | Don't have undefined behavior even if the translation |
| 5763 | produced a string with the wrong number of "%s"s. */ |
| 5764 | char *yyp = yymsg; |
| 5765 | int yyi = 0; |
| 5766 | while ((*yyp = *yyf)) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5767 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5768 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5769 | { |
| 5770 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5771 | yyf += 2; |
| 5772 | } |
| 5773 | else |
| 5774 | { |
| 5775 | yyp++; |
| 5776 | yyf++; |
| 5777 | } |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5778 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5779 | yyerror (yymsg); |
| 5780 | YYSTACK_FREE (yymsg); |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5781 | } |
| 5782 | else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5783 | { |
| 5784 | yyerror (YY_("syntax error")); |
| 5785 | goto yyexhaustedlab; |
| 5786 | } |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5787 | } |
| 5788 | else |
| 5789 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5790 | yyerror (YY_("syntax error")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5791 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5792 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5793 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5794 | |
| 5795 | if (yyerrstatus == 3) |
| 5796 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5797 | /* If just tried and failed to reuse look-ahead token after an |
| 5798 | error, discard it. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5799 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5800 | if (yychar <= YYEOF) |
| 5801 | { |
| 5802 | /* Return failure if at end of input. */ |
| 5803 | if (yychar == YYEOF) |
| 5804 | YYABORT; |
| 5805 | } |
| 5806 | else |
| 5807 | { |
| 5808 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 5809 | yychar = YYEMPTY; |
| 5810 | } |
| 5811 | } |
| 5812 | |
| 5813 | /* Else will try to reuse look-ahead token after shifting the error |
| 5814 | token. */ |
| 5815 | goto yyerrlab1; |
| 5816 | |
| 5817 | |
| 5818 | /*---------------------------------------------------. |
| 5819 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5820 | `---------------------------------------------------*/ |
| 5821 | yyerrorlab: |
| 5822 | |
| 5823 | /* Pacify compilers like GCC when the user code never invokes |
| 5824 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5825 | code. */ |
| 5826 | if (0) |
| 5827 | goto yyerrorlab; |
| 5828 | |
| 5829 | yyvsp -= yylen; |
| 5830 | yyssp -= yylen; |
| 5831 | yystate = *yyssp; |
| 5832 | goto yyerrlab1; |
| 5833 | |
| 5834 | |
| 5835 | /*-------------------------------------------------------------. |
| 5836 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5837 | `-------------------------------------------------------------*/ |
| 5838 | yyerrlab1: |
| 5839 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5840 | |
| 5841 | for (;;) |
| 5842 | { |
| 5843 | yyn = yypact[yystate]; |
| 5844 | if (yyn != YYPACT_NINF) |
| 5845 | { |
| 5846 | yyn += YYTERROR; |
| 5847 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5848 | { |
| 5849 | yyn = yytable[yyn]; |
| 5850 | if (0 < yyn) |
| 5851 | break; |
| 5852 | } |
| 5853 | } |
| 5854 | |
| 5855 | /* Pop the current state because it cannot handle the error token. */ |
| 5856 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5857 | YYABORT; |
| 5858 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5859 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5860 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 5861 | YYPOPSTACK; |
| 5862 | yystate = *yyssp; |
| 5863 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5864 | } |
| 5865 | |
| 5866 | if (yyn == YYFINAL) |
| 5867 | YYACCEPT; |
| 5868 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5869 | *++yyvsp = yylval; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5870 | |
| 5871 | |
| 5872 | /* Shift the error token. */ |
| 5873 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5874 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5875 | yystate = yyn; |
| 5876 | goto yynewstate; |
| 5877 | |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5878 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5879 | /*-------------------------------------. |
| 5880 | | yyacceptlab -- YYACCEPT comes here. | |
| 5881 | `-------------------------------------*/ |
| 5882 | yyacceptlab: |
| 5883 | yyresult = 0; |
| 5884 | goto yyreturn; |
| 5885 | |
| 5886 | /*-----------------------------------. |
| 5887 | | yyabortlab -- YYABORT comes here. | |
| 5888 | `-----------------------------------*/ |
| 5889 | yyabortlab: |
| 5890 | yyresult = 1; |
| 5891 | goto yyreturn; |
| 5892 | |
| 5893 | #ifndef yyoverflow |
| 5894 | /*-------------------------------------------------. |
| 5895 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5896 | `-------------------------------------------------*/ |
| 5897 | yyexhaustedlab: |
| 5898 | yyerror (YY_("memory exhausted")); |
| 5899 | yyresult = 2; |
| 5900 | /* Fall through. */ |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5901 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5902 | |
| 5903 | yyreturn: |
| 5904 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5905 | yydestruct ("Cleanup: discarding lookahead", |
| 5906 | yytoken, &yylval); |
| 5907 | while (yyssp != yyss) |
| 5908 | { |
| 5909 | yydestruct ("Cleanup: popping", |
| 5910 | yystos[*yyssp], yyvsp); |
| 5911 | YYPOPSTACK; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5912 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5913 | #ifndef yyoverflow |
| 5914 | if (yyss != yyssa) |
| 5915 | YYSTACK_FREE (yyss); |
| 5916 | #endif |
| 5917 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5918 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5919 | |
| 5920 | |
Reid Spencer | 9eba7a2 | 2007-03-20 17:19:31 +0000 | [diff] [blame] | 5921 | #line 2934 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5922 | |
| 5923 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5924 | // common code from the two 'RunVMAsmParser' functions |
| 5925 | static Module* RunParser(Module * M) { |
| 5926 | |
| 5927 | llvmAsmlineno = 1; // Reset the current line number... |
| 5928 | CurModule.CurrentModule = M; |
| 5929 | #if YYDEBUG |
| 5930 | yydebug = Debug; |
| 5931 | #endif |
| 5932 | |
| 5933 | // Check to make sure the parser succeeded |
| 5934 | if (yyparse()) { |
| 5935 | if (ParserResult) |
| 5936 | delete ParserResult; |
| 5937 | return 0; |
| 5938 | } |
| 5939 | |
| 5940 | // Check to make sure that parsing produced a result |
| 5941 | if (!ParserResult) |
| 5942 | return 0; |
| 5943 | |
| 5944 | // Reset ParserResult variable while saving its value for the result. |
| 5945 | Module *Result = ParserResult; |
| 5946 | ParserResult = 0; |
| 5947 | |
| 5948 | return Result; |
| 5949 | } |
| 5950 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5951 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5952 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5953 | // TODO: column number in exception |
| 5954 | if (TheParseError) |
| 5955 | TheParseError->setError(CurFilename, message, LineNo); |
| 5956 | TriggerError = 1; |
| 5957 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5958 | |
| 5959 | int yyerror(const char *ErrorMsg) { |
| 5960 | std::string where |
| 5961 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5962 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5963 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
| 5964 | if (yychar != YYEMPTY && yychar != 0) |
| 5965 | errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ |
| 5966 | "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5967 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5968 | return 0; |
| 5969 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5970 | |