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 | |
| 840 | // Erase the forward ref from the map as its no longer "forward" |
| 841 | CurFun.BBForwardRefs.erase(ID); |
| 842 | |
| 843 | // If its a numbered definition, bump the number and set the BB value. |
| 844 | if (ID.Type == ValID::LocalID) { |
| 845 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 846 | InsertValue(BB); |
| 847 | } |
| 848 | |
| 849 | ID.destroy(); |
| 850 | return BB; |
| 851 | } |
| 852 | |
| 853 | // We haven't seen this BB before and its first mention is a definition. |
| 854 | // Just create it and return it. |
| 855 | std::string Name (ID.Type == ValID::LocalName ? ID.Name : ""); |
| 856 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 857 | if (ID.Type == ValID::LocalID) { |
| 858 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 859 | InsertValue(BB); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 860 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 861 | |
| 862 | ID.destroy(); // Free strdup'd memory |
| 863 | return BB; |
| 864 | } |
| 865 | |
| 866 | /// getBBVal - get an existing BB value or create a forward reference for it. |
| 867 | /// |
| 868 | static BasicBlock *getBBVal(const ValID &ID) { |
| 869 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 870 | |
| 871 | BasicBlock *BB = 0; |
| 872 | |
| 873 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 874 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 875 | BB = BBI->second; |
| 876 | } if (ID.Type == ValID::LocalName) { |
| 877 | std::string Name = ID.Name; |
| 878 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
| 879 | if (N) |
| 880 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 881 | BB = cast<BasicBlock>(N); |
| 882 | else |
| 883 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 884 | N->getType()->getDescription() + "'"); |
| 885 | } else if (ID.Type == ValID::LocalID) { |
| 886 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 887 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 888 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 889 | else |
| 890 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 891 | "' is actually of type '"+ |
| 892 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 893 | } |
| 894 | } else { |
| 895 | GenerateError("Illegal label reference " + ID.getName()); |
| 896 | return 0; |
| 897 | } |
| 898 | |
| 899 | // If its already been defined, return it now. |
| 900 | if (BB) { |
| 901 | ID.destroy(); // Free strdup'd memory. |
| 902 | return BB; |
| 903 | } |
| 904 | |
| 905 | // Otherwise, this block has not been seen before, create it. |
| 906 | std::string Name; |
| 907 | if (ID.Type == ValID::LocalName) |
| 908 | Name = ID.Name; |
| 909 | BB = new BasicBlock(Name, CurFun.CurrentFunction); |
| 910 | |
| 911 | // Insert it in the forward refs map. |
| 912 | CurFun.BBForwardRefs[ID] = BB; |
| 913 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 914 | return BB; |
| 915 | } |
| 916 | |
| 917 | |
| 918 | //===----------------------------------------------------------------------===// |
| 919 | // Code to handle forward references in instructions |
| 920 | //===----------------------------------------------------------------------===// |
| 921 | // |
| 922 | // This code handles the late binding needed with statements that reference |
| 923 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 924 | // a loop body. |
| 925 | // |
| 926 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 927 | // and back patchs after we are done. |
| 928 | // |
| 929 | |
| 930 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 931 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 932 | // defs now... |
| 933 | // |
| 934 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 935 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 936 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 937 | while (!LateResolvers.empty()) { |
| 938 | Value *V = LateResolvers.back(); |
| 939 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 940 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 941 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 942 | CurModule.PlaceHolderInfo.find(V); |
| 943 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 944 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 945 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 946 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 947 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 948 | if (TriggerError) |
| 949 | return; |
| 950 | if (TheRealValue) { |
| 951 | V->replaceAllUsesWith(TheRealValue); |
| 952 | delete V; |
| 953 | CurModule.PlaceHolderInfo.erase(PHI); |
| 954 | } else if (FutureLateResolvers) { |
| 955 | // Functions have their unresolved items forwarded to the module late |
| 956 | // resolver table |
| 957 | InsertValue(V, *FutureLateResolvers); |
| 958 | } else { |
| 959 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 960 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 961 | "' of type '" + V->getType()->getDescription() + "'", |
| 962 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 963 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 964 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 965 | GenerateError("Reference to an invalid definition: #" + |
| 966 | itostr(DID.Num) + " of type '" + |
| 967 | V->getType()->getDescription() + "'", |
| 968 | PHI->second.second); |
| 969 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 970 | } |
| 971 | } |
| 972 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 973 | LateResolvers.clear(); |
| 974 | } |
| 975 | |
| 976 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 977 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 978 | // refering to the number can be resolved. Do this now. |
| 979 | // |
| 980 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 981 | ValID D; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 982 | if (Name) D = ValID::createLocalName(Name); |
| 983 | else D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 984 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 985 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 986 | CurModule.LateResolveTypes.find(D); |
| 987 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 988 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 989 | CurModule.LateResolveTypes.erase(I); |
| 990 | } |
| 991 | } |
| 992 | |
| 993 | // setValueName - Set the specified value to the name given. The name may be |
| 994 | // null potentially, in which case this is a noop. The string passed in is |
| 995 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 996 | // |
| 997 | static void setValueName(Value *V, char *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 998 | if (!NameStr) return; |
| 999 | std::string Name(NameStr); // Copy string |
| 1000 | free(NameStr); // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1001 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1002 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1003 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1004 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1005 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1006 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1007 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1008 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1009 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1010 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1011 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1012 | return; |
| 1013 | } |
| 1014 | |
| 1015 | // Set the name. |
| 1016 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1017 | } |
| 1018 | |
| 1019 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1020 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1021 | static GlobalVariable * |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1022 | ParseGlobalVariable(char *NameStr, |
| 1023 | GlobalValue::LinkageTypes Linkage, |
| 1024 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1025 | bool isConstantGlobal, const Type *Ty, |
| 1026 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1027 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1028 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1029 | return 0; |
| 1030 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1031 | |
| 1032 | const PointerType *PTy = PointerType::get(Ty); |
| 1033 | |
| 1034 | std::string Name; |
| 1035 | if (NameStr) { |
| 1036 | Name = NameStr; // Copy string |
| 1037 | free(NameStr); // Free old string |
| 1038 | } |
| 1039 | |
| 1040 | // See if this global value was forward referenced. If so, recycle the |
| 1041 | // object. |
| 1042 | ValID ID; |
| 1043 | if (!Name.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1044 | ID = ValID::createGlobalName((char*)Name.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1045 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1046 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1047 | } |
| 1048 | |
| 1049 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1050 | // Move the global to the end of the list, from whereever it was |
| 1051 | // previously inserted. |
| 1052 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1053 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1054 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1055 | GV->setInitializer(Initializer); |
| 1056 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1057 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1058 | GV->setConstant(isConstantGlobal); |
| 1059 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1060 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1061 | } |
| 1062 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1063 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1064 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1065 | // if the global we're parsing has an initializer (is a definition) and |
| 1066 | // has external linkage. |
| 1067 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1068 | // If there is already a global with external linkage with this name |
| 1069 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1070 | // If we allow this GVar to get created, it will be renamed in the |
| 1071 | // symbol table because it conflicts with an existing GVar. We can't |
| 1072 | // allow redefinition of GVars whose linking indicates that their name |
| 1073 | // must stay the same. Issue the error. |
| 1074 | GenerateError("Redefinition of global variable named '" + Name + |
| 1075 | "' of type '" + Ty->getDescription() + "'"); |
| 1076 | return 0; |
| 1077 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1078 | } |
| 1079 | |
| 1080 | // Otherwise there is no existing GV to use, create one now. |
| 1081 | GlobalVariable *GV = |
| 1082 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1083 | CurModule.CurrentModule); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1084 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1085 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1086 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1087 | } |
| 1088 | |
| 1089 | // setTypeName - Set the specified type to the name given. The name may be |
| 1090 | // null potentially, in which case this is a noop. The string passed in is |
| 1091 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1092 | // |
| 1093 | // This function returns true if the type has already been defined, but is |
| 1094 | // allowed to be redefined in the specified context. If the name is a new name |
| 1095 | // for the type plane, it is inserted and false is returned. |
| 1096 | static bool setTypeName(const Type *T, char *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1097 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1098 | if (NameStr == 0) return false; |
| 1099 | |
| 1100 | std::string Name(NameStr); // Copy string |
| 1101 | free(NameStr); // Free old string |
| 1102 | |
| 1103 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1104 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1105 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1106 | return false; |
| 1107 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1108 | |
| 1109 | // Set the type name, checking for conflicts as we do so. |
| 1110 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1111 | |
| 1112 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1113 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1114 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1115 | |
| 1116 | // There is only one case where this is allowed: when we are refining an |
| 1117 | // opaque type. In this case, Existing will be an opaque type. |
| 1118 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1119 | // We ARE replacing an opaque type! |
| 1120 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1121 | return true; |
| 1122 | } |
| 1123 | |
| 1124 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1125 | // the redefinition is identical to the original. This will be so if |
| 1126 | // Existing and T point to the same Type object. In this one case we |
| 1127 | // allow the equivalent redefinition. |
| 1128 | if (Existing == T) return true; // Yes, it's equal. |
| 1129 | |
| 1130 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1131 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1132 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1133 | } |
| 1134 | |
| 1135 | return false; |
| 1136 | } |
| 1137 | |
| 1138 | //===----------------------------------------------------------------------===// |
| 1139 | // Code for handling upreferences in type names... |
| 1140 | // |
| 1141 | |
| 1142 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1143 | // |
| 1144 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1145 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1146 | E) != Ty->subtype_end(); |
| 1147 | } |
| 1148 | |
| 1149 | namespace { |
| 1150 | struct UpRefRecord { |
| 1151 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1152 | // this type is resolved. |
| 1153 | unsigned NestingLevel; |
| 1154 | |
| 1155 | // LastContainedTy - This is the type at the current binding level for the |
| 1156 | // type. Every time we reduce the nesting level, this gets updated. |
| 1157 | const Type *LastContainedTy; |
| 1158 | |
| 1159 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1160 | // represented with. |
| 1161 | OpaqueType *UpRefTy; |
| 1162 | |
| 1163 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1164 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1165 | }; |
| 1166 | } |
| 1167 | |
| 1168 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1169 | static std::vector<UpRefRecord> UpRefs; |
| 1170 | |
| 1171 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1172 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1173 | /// currently active types. For each type, if the up reference is contained in |
| 1174 | /// the newly completed type, we decrement the level count. When the level |
| 1175 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1176 | /// thus we can complete the cycle. |
| 1177 | /// |
| 1178 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1179 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1180 | // nothing to resolve here. |
| 1181 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1182 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1183 | PATypeHolder Ty(ty); |
| 1184 | UR_OUT("Type '" << Ty->getDescription() << |
| 1185 | "' newly formed. Resolving upreferences.\n" << |
| 1186 | UpRefs.size() << " upreferences active!\n"); |
| 1187 | |
| 1188 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1189 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1190 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1191 | // this variable. |
| 1192 | OpaqueType *TypeToResolve = 0; |
| 1193 | |
| 1194 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1195 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1196 | << UpRefs[i].second->getDescription() << ") = " |
| 1197 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1198 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1199 | // Decrement level of upreference |
| 1200 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1201 | UpRefs[i].LastContainedTy = Ty; |
| 1202 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1203 | if (Level == 0) { // Upreference should be resolved! |
| 1204 | if (!TypeToResolve) { |
| 1205 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1206 | } else { |
| 1207 | UR_OUT(" * Resolving upreference for " |
| 1208 | << UpRefs[i].second->getDescription() << "\n"; |
| 1209 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1210 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1211 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1212 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1213 | } |
| 1214 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1215 | --i; // Do not skip the next element... |
| 1216 | } |
| 1217 | } |
| 1218 | } |
| 1219 | |
| 1220 | if (TypeToResolve) { |
| 1221 | UR_OUT(" * Resolving upreference for " |
| 1222 | << UpRefs[i].second->getDescription() << "\n"; |
| 1223 | std::string OldName = TypeToResolve->getDescription()); |
| 1224 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1225 | } |
| 1226 | |
| 1227 | return Ty; |
| 1228 | } |
| 1229 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1230 | //===----------------------------------------------------------------------===// |
| 1231 | // RunVMAsmParser - Define an interface to this parser |
| 1232 | //===----------------------------------------------------------------------===// |
| 1233 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1234 | static Module* RunParser(Module * M); |
| 1235 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1236 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1237 | set_scan_file(F); |
| 1238 | |
| 1239 | CurFilename = Filename; |
| 1240 | return RunParser(new Module(CurFilename)); |
| 1241 | } |
| 1242 | |
| 1243 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1244 | set_scan_string(AsmString); |
| 1245 | |
| 1246 | CurFilename = "from_memory"; |
| 1247 | if (M == NULL) { |
| 1248 | return RunParser(new Module (CurFilename)); |
| 1249 | } else { |
| 1250 | return RunParser(M); |
| 1251 | } |
| 1252 | } |
| 1253 | |
| 1254 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1255 | |
| 1256 | /* Enabling traces. */ |
| 1257 | #ifndef YYDEBUG |
| 1258 | # define YYDEBUG 0 |
| 1259 | #endif |
| 1260 | |
| 1261 | /* Enabling verbose error messages. */ |
| 1262 | #ifdef YYERROR_VERBOSE |
| 1263 | # undef YYERROR_VERBOSE |
| 1264 | # define YYERROR_VERBOSE 1 |
| 1265 | #else |
| 1266 | # define YYERROR_VERBOSE 0 |
| 1267 | #endif |
| 1268 | |
| 1269 | /* Enabling the token table. */ |
| 1270 | #ifndef YYTOKEN_TABLE |
| 1271 | # define YYTOKEN_TABLE 0 |
| 1272 | #endif |
| 1273 | |
| 1274 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1275 | #line 932 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1276 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1277 | llvm::Module *ModuleVal; |
| 1278 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1279 | llvm::BasicBlock *BasicBlockVal; |
| 1280 | llvm::TerminatorInst *TermInstVal; |
| 1281 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1282 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1283 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1284 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1285 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1286 | llvm::PATypeHolder *TypeVal; |
| 1287 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1288 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1289 | llvm::ArgListType *ArgList; |
| 1290 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1291 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1292 | llvm::ValueRefList *ValueRefList; |
| 1293 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1294 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1295 | std::list<std::pair<llvm::Value*, |
| 1296 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1297 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1298 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1299 | |
| 1300 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1301 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1302 | llvm::FunctionType::ParameterAttributes ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1303 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1304 | int64_t SInt64Val; |
| 1305 | uint64_t UInt64Val; |
| 1306 | int SIntVal; |
| 1307 | unsigned UIntVal; |
| 1308 | double FPVal; |
| 1309 | bool BoolVal; |
| 1310 | |
| 1311 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1312 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1313 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1314 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1315 | llvm::Instruction::TermOps TermOpVal; |
| 1316 | llvm::Instruction::MemoryOps MemOpVal; |
| 1317 | llvm::Instruction::CastOps CastOpVal; |
| 1318 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1319 | llvm::ICmpInst::Predicate IPredicate; |
| 1320 | llvm::FCmpInst::Predicate FPredicate; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1321 | } YYSTYPE; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1322 | /* Line 196 of yacc.c. */ |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1323 | #line 1324 "llvmAsmParser.tab.c" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1324 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1325 | # define YYSTYPE_IS_DECLARED 1 |
| 1326 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1327 | #endif |
| 1328 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1329 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1330 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1331 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1332 | |
| 1333 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1334 | /* Line 219 of yacc.c. */ |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1335 | #line 1336 "llvmAsmParser.tab.c" |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1336 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1337 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1338 | # define YYSIZE_T __SIZE_TYPE__ |
| 1339 | #endif |
| 1340 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1341 | # define YYSIZE_T size_t |
| 1342 | #endif |
| 1343 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1344 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1345 | # define YYSIZE_T size_t |
| 1346 | #endif |
| 1347 | #if ! defined (YYSIZE_T) |
| 1348 | # define YYSIZE_T unsigned int |
| 1349 | #endif |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1350 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1351 | #ifndef YY_ |
| 1352 | # if YYENABLE_NLS |
| 1353 | # if ENABLE_NLS |
| 1354 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1355 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1356 | # endif |
| 1357 | # endif |
| 1358 | # ifndef YY_ |
| 1359 | # define YY_(msgid) msgid |
| 1360 | # endif |
| 1361 | #endif |
| 1362 | |
| 1363 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1364 | |
| 1365 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1366 | |
| 1367 | # ifdef YYSTACK_USE_ALLOCA |
| 1368 | # if YYSTACK_USE_ALLOCA |
| 1369 | # ifdef __GNUC__ |
| 1370 | # define YYSTACK_ALLOC __builtin_alloca |
| 1371 | # else |
| 1372 | # define YYSTACK_ALLOC alloca |
| 1373 | # if defined (__STDC__) || defined (__cplusplus) |
| 1374 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1375 | # define YYINCLUDED_STDLIB_H |
| 1376 | # endif |
| 1377 | # endif |
| 1378 | # endif |
| 1379 | # endif |
| 1380 | |
| 1381 | # ifdef YYSTACK_ALLOC |
| 1382 | /* Pacify GCC's `empty if-body' warning. */ |
| 1383 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1384 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1385 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1386 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1387 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1388 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1389 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1390 | # endif |
| 1391 | # else |
| 1392 | # define YYSTACK_ALLOC YYMALLOC |
| 1393 | # define YYSTACK_FREE YYFREE |
| 1394 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1395 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1396 | # endif |
| 1397 | # ifdef __cplusplus |
| 1398 | extern "C" { |
| 1399 | # endif |
| 1400 | # ifndef YYMALLOC |
| 1401 | # define YYMALLOC malloc |
| 1402 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1403 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1404 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1405 | # endif |
| 1406 | # endif |
| 1407 | # ifndef YYFREE |
| 1408 | # define YYFREE free |
| 1409 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1410 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1411 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1412 | # endif |
| 1413 | # endif |
| 1414 | # ifdef __cplusplus |
| 1415 | } |
| 1416 | # endif |
| 1417 | # endif |
| 1418 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1419 | |
| 1420 | |
| 1421 | #if (! defined (yyoverflow) \ |
| 1422 | && (! defined (__cplusplus) \ |
| 1423 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1424 | |
| 1425 | /* A type that is properly aligned for any stack member. */ |
| 1426 | union yyalloc |
| 1427 | { |
| 1428 | short int yyss; |
| 1429 | YYSTYPE yyvs; |
| 1430 | }; |
| 1431 | |
| 1432 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1433 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1434 | |
| 1435 | /* The size of an array large to enough to hold all stacks, each with |
| 1436 | N elements. */ |
| 1437 | # define YYSTACK_BYTES(N) \ |
| 1438 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1439 | + YYSTACK_GAP_MAXIMUM) |
| 1440 | |
| 1441 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1442 | not overlap. */ |
| 1443 | # ifndef YYCOPY |
| 1444 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1445 | # define YYCOPY(To, From, Count) \ |
| 1446 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1447 | # else |
| 1448 | # define YYCOPY(To, From, Count) \ |
| 1449 | do \ |
| 1450 | { \ |
| 1451 | YYSIZE_T yyi; \ |
| 1452 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1453 | (To)[yyi] = (From)[yyi]; \ |
| 1454 | } \ |
| 1455 | while (0) |
| 1456 | # endif |
| 1457 | # endif |
| 1458 | |
| 1459 | /* Relocate STACK from its old location to the new one. The |
| 1460 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1461 | elements in the stack, and YYPTR gives the new location of the |
| 1462 | stack. Advance YYPTR to a properly aligned location for the next |
| 1463 | stack. */ |
| 1464 | # define YYSTACK_RELOCATE(Stack) \ |
| 1465 | do \ |
| 1466 | { \ |
| 1467 | YYSIZE_T yynewbytes; \ |
| 1468 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1469 | Stack = &yyptr->Stack; \ |
| 1470 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1471 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1472 | } \ |
| 1473 | while (0) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1474 | |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1475 | #endif |
| 1476 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1477 | #if defined (__STDC__) || defined (__cplusplus) |
| 1478 | typedef signed char yysigned_char; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1479 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1480 | typedef short int yysigned_char; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1481 | #endif |
| 1482 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1483 | /* YYFINAL -- State number of the termination state. */ |
| 1484 | #define YYFINAL 40 |
| 1485 | /* YYLAST -- Last index in YYTABLE. */ |
| 1486 | #define YYLAST 1429 |
| 1487 | |
| 1488 | /* YYNTOKENS -- Number of terminals. */ |
| 1489 | #define YYNTOKENS 148 |
| 1490 | /* YYNNTS -- Number of nonterminals. */ |
| 1491 | #define YYNNTS 78 |
| 1492 | /* YYNRULES -- Number of rules. */ |
| 1493 | #define YYNRULES 286 |
| 1494 | /* YYNRULES -- Number of states. */ |
| 1495 | #define YYNSTATES 559 |
| 1496 | |
| 1497 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1498 | #define YYUNDEFTOK 2 |
| 1499 | #define YYMAXUTOK 388 |
| 1500 | |
| 1501 | #define YYTRANSLATE(YYX) \ |
| 1502 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1503 | |
| 1504 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1505 | static const unsigned char yytranslate[] = |
| 1506 | { |
| 1507 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1508 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1509 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1510 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1511 | 138, 139, 136, 2, 135, 2, 2, 2, 2, 2, |
| 1512 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1513 | 143, 134, 144, 2, 2, 2, 2, 2, 2, 2, |
| 1514 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1515 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1516 | 2, 140, 137, 142, 2, 2, 2, 2, 2, 147, |
| 1517 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1518 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1519 | 141, 2, 2, 145, 2, 146, 2, 2, 2, 2, |
| 1520 | 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1524 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1525 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1526 | 2, 2, 2, 2, 2, 2, 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, 1, 2, 3, 4, |
| 1533 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1534 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1535 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1536 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1537 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1538 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1539 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1540 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1541 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1542 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1543 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1544 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1545 | 125, 126, 127, 128, 129, 130, 131, 132, 133 |
| 1546 | }; |
| 1547 | |
| 1548 | #if YYDEBUG |
| 1549 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1550 | YYRHS. */ |
| 1551 | static const unsigned short int yyprhs[] = |
| 1552 | { |
| 1553 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1554 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1555 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1556 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1557 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1558 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1559 | 119, 121, 122, 125, 126, 128, 130, 133, 134, 136, |
| 1560 | 138, 140, 142, 144, 146, 148, 150, 151, 153, 154, |
| 1561 | 156, 158, 159, 161, 163, 165, 167, 168, 170, 172, |
| 1562 | 174, 176, 178, 181, 183, 185, 187, 189, 190, 193, |
| 1563 | 195, 197, 198, 201, 202, 205, 206, 210, 213, 214, |
| 1564 | 216, 217, 221, 223, 226, 228, 230, 232, 234, 236, |
| 1565 | 238, 241, 243, 246, 252, 258, 264, 270, 274, 277, |
| 1566 | 283, 288, 291, 293, 295, 297, 301, 303, 307, 309, |
| 1567 | 310, 312, 316, 321, 325, 329, 334, 339, 343, 350, |
| 1568 | 356, 359, 362, 365, 368, 371, 374, 377, 380, 383, |
| 1569 | 386, 389, 392, 399, 405, 414, 421, 428, 436, 444, |
| 1570 | 451, 460, 469, 473, 475, 477, 479, 481, 482, 484, |
| 1571 | 487, 488, 492, 493, 497, 501, 503, 507, 511, 512, |
| 1572 | 519, 520, 528, 529, 537, 540, 544, 546, 550, 554, |
| 1573 | 558, 562, 564, 565, 571, 575, 577, 581, 583, 584, |
| 1574 | 594, 596, 598, 603, 605, 607, 610, 614, 615, 617, |
| 1575 | 619, 621, 623, 625, 627, 629, 631, 633, 637, 639, |
| 1576 | 645, 647, 649, 651, 653, 655, 657, 660, 663, 666, |
| 1577 | 670, 673, 674, 676, 679, 682, 686, 696, 706, 715, |
| 1578 | 730, 732, 734, 741, 747, 750, 757, 765, 769, 775, |
| 1579 | 776, 777, 781, 784, 786, 792, 798, 805, 812, 817, |
| 1580 | 824, 829, 834, 841, 848, 851, 860, 862, 864, 865, |
| 1581 | 869, 876, 880, 887, 890, 895, 902 |
| 1582 | }; |
| 1583 | |
| 1584 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1585 | static const short int yyrhs[] = |
| 1586 | { |
| 1587 | 188, 0, -1, 68, -1, 69, -1, 70, -1, 71, |
| 1588 | -1, 72, -1, 73, -1, 74, -1, 75, -1, 76, |
| 1589 | -1, 80, -1, 81, -1, 82, -1, 77, -1, 78, |
| 1590 | -1, 79, -1, 111, -1, 112, -1, 113, -1, 114, |
| 1591 | -1, 115, -1, 116, -1, 117, -1, 118, -1, 119, |
| 1592 | -1, 120, -1, 121, -1, 122, -1, 85, -1, 86, |
| 1593 | -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, |
| 1594 | -1, 92, -1, 93, -1, 94, -1, 95, -1, 96, |
| 1595 | -1, 97, -1, 98, -1, 99, -1, 100, -1, 101, |
| 1596 | -1, 102, -1, 103, -1, 104, -1, 91, -1, 92, |
| 1597 | -1, 93, -1, 94, -1, 23, -1, 24, -1, 11, |
| 1598 | -1, 12, -1, 13, -1, 16, -1, 19, -1, 156, |
| 1599 | -1, -1, 156, 134, -1, -1, 17, -1, 20, -1, |
| 1600 | 159, 134, -1, -1, 37, -1, 39, -1, 38, -1, |
| 1601 | 40, -1, 42, -1, 41, -1, 43, -1, 45, -1, |
| 1602 | -1, 133, -1, -1, 41, -1, 43, -1, -1, 37, |
| 1603 | -1, 38, -1, 39, -1, 42, -1, -1, 56, -1, |
| 1604 | 57, -1, 58, -1, 59, -1, 60, -1, 55, 4, |
| 1605 | -1, 112, -1, 113, -1, 130, -1, 131, -1, -1, |
| 1606 | 168, 167, -1, 129, -1, 167, -1, -1, 170, 169, |
| 1607 | -1, -1, 48, 4, -1, -1, 135, 48, 4, -1, |
| 1608 | 31, 19, -1, -1, 173, -1, -1, 135, 176, 175, |
| 1609 | -1, 173, -1, 48, 4, -1, 11, -1, 12, -1, |
| 1610 | 13, -1, 14, -1, 44, -1, 177, -1, 178, 136, |
| 1611 | -1, 210, -1, 137, 4, -1, 178, 138, 182, 139, |
| 1612 | 170, -1, 10, 138, 182, 139, 170, -1, 140, 4, |
| 1613 | 141, 178, 142, -1, 143, 4, 141, 178, 144, -1, |
| 1614 | 145, 183, 146, -1, 145, 146, -1, 143, 145, 183, |
| 1615 | 146, 144, -1, 143, 145, 146, 144, -1, 178, 168, |
| 1616 | -1, 178, -1, 10, -1, 179, -1, 181, 135, 179, |
| 1617 | -1, 181, -1, 181, 135, 34, -1, 34, -1, -1, |
| 1618 | 178, -1, 183, 135, 178, -1, 178, 140, 186, 142, |
| 1619 | -1, 178, 140, 142, -1, 178, 147, 19, -1, 178, |
| 1620 | 143, 186, 144, -1, 178, 145, 186, 146, -1, 178, |
| 1621 | 145, 146, -1, 178, 143, 145, 186, 146, 144, -1, |
| 1622 | 178, 143, 145, 146, 144, -1, 178, 35, -1, 178, |
| 1623 | 36, -1, 178, 210, -1, 178, 185, -1, 178, 22, |
| 1624 | -1, 154, 3, -1, 154, 5, -1, 154, 4, -1, |
| 1625 | 154, 6, -1, 11, 23, -1, 11, 24, -1, 155, |
| 1626 | 9, -1, 151, 138, 184, 33, 178, 139, -1, 110, |
| 1627 | 138, 184, 221, 139, -1, 124, 138, 184, 135, 184, |
| 1628 | 135, 184, 139, -1, 149, 138, 184, 135, 184, 139, |
| 1629 | -1, 150, 138, 184, 135, 184, 139, -1, 83, 152, |
| 1630 | 138, 184, 135, 184, 139, -1, 84, 153, 138, 184, |
| 1631 | 135, 184, 139, -1, 126, 138, 184, 135, 184, 139, |
| 1632 | -1, 127, 138, 184, 135, 184, 135, 184, 139, -1, |
| 1633 | 128, 138, 184, 135, 184, 135, 184, 139, -1, 186, |
| 1634 | 135, 184, -1, 184, -1, 29, -1, 30, -1, 189, |
| 1635 | -1, -1, 190, -1, 189, 190, -1, -1, 28, 191, |
| 1636 | 206, -1, -1, 27, 192, 207, -1, 53, 52, 196, |
| 1637 | -1, 21, -1, 158, 15, 178, -1, 158, 15, 10, |
| 1638 | -1, -1, 160, 163, 187, 184, 193, 175, -1, -1, |
| 1639 | 160, 161, 163, 187, 184, 194, 175, -1, -1, 160, |
| 1640 | 162, 163, 187, 178, 195, 175, -1, 46, 197, -1, |
| 1641 | 49, 134, 198, -1, 19, -1, 47, 134, 19, -1, |
| 1642 | 61, 134, 19, -1, 140, 199, 142, -1, 199, 135, |
| 1643 | 19, -1, 19, -1, -1, 200, 135, 178, 168, 157, |
| 1644 | -1, 178, 168, 157, -1, 200, -1, 200, 135, 34, |
| 1645 | -1, 34, -1, -1, 166, 180, 159, 138, 201, 139, |
| 1646 | 170, 174, 171, -1, 25, -1, 145, -1, 165, 163, |
| 1647 | 202, 203, -1, 26, -1, 146, -1, 213, 205, -1, |
| 1648 | 164, 163, 202, -1, -1, 54, -1, 3, -1, 4, |
| 1649 | -1, 9, -1, 23, -1, 24, -1, 35, -1, 36, |
| 1650 | -1, 22, -1, 143, 186, 144, -1, 185, -1, 52, |
| 1651 | 208, 19, 135, 19, -1, 7, -1, 8, -1, 156, |
| 1652 | -1, 159, -1, 210, -1, 209, -1, 178, 211, -1, |
| 1653 | 213, 214, -1, 204, 214, -1, 215, 158, 216, -1, |
| 1654 | 215, 218, -1, -1, 18, -1, 62, 212, -1, 62, |
| 1655 | 10, -1, 63, 14, 211, -1, 63, 11, 211, 135, |
| 1656 | 14, 211, 135, 14, 211, -1, 64, 154, 211, 135, |
| 1657 | 14, 211, 140, 217, 142, -1, 64, 154, 211, 135, |
| 1658 | 14, 211, 140, 142, -1, 65, 166, 180, 211, 138, |
| 1659 | 220, 139, 170, 33, 14, 211, 66, 14, 211, -1, |
| 1660 | 66, -1, 67, -1, 217, 154, 209, 135, 14, 211, |
| 1661 | -1, 154, 209, 135, 14, 211, -1, 158, 223, -1, |
| 1662 | 178, 140, 211, 135, 211, 142, -1, 219, 135, 140, |
| 1663 | 211, 135, 211, 142, -1, 178, 211, 168, -1, 220, |
| 1664 | 135, 178, 211, 168, -1, -1, -1, 221, 135, 212, |
| 1665 | -1, 51, 50, -1, 50, -1, 149, 178, 211, 135, |
| 1666 | 211, -1, 150, 178, 211, 135, 211, -1, 83, 152, |
| 1667 | 178, 211, 135, 211, -1, 84, 153, 178, 211, 135, |
| 1668 | 211, -1, 151, 212, 33, 178, -1, 124, 212, 135, |
| 1669 | 212, 135, 212, -1, 125, 212, 135, 178, -1, 126, |
| 1670 | 212, 135, 212, -1, 127, 212, 135, 212, 135, 212, |
| 1671 | -1, 128, 212, 135, 212, 135, 212, -1, 123, 219, |
| 1672 | -1, 222, 166, 180, 211, 138, 220, 139, 170, -1, |
| 1673 | 225, -1, 32, -1, -1, 105, 178, 172, -1, 105, |
| 1674 | 178, 135, 11, 211, 172, -1, 106, 178, 172, -1, |
| 1675 | 106, 178, 135, 11, 211, 172, -1, 107, 212, -1, |
| 1676 | 224, 108, 178, 211, -1, 224, 109, 212, 135, 178, |
| 1677 | 211, -1, 110, 178, 211, 221, -1 |
| 1678 | }; |
| 1679 | |
| 1680 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1681 | static const unsigned short int yyrline[] = |
| 1682 | { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1683 | 0, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, |
| 1684 | 1086, 1087, 1087, 1087, 1087, 1087, 1087, 1088, 1088, 1088, |
| 1685 | 1088, 1088, 1088, 1089, 1089, 1089, 1089, 1089, 1089, 1092, |
| 1686 | 1092, 1093, 1093, 1094, 1094, 1095, 1095, 1096, 1096, 1100, |
| 1687 | 1100, 1101, 1101, 1102, 1102, 1103, 1103, 1104, 1104, 1105, |
| 1688 | 1105, 1106, 1106, 1107, 1108, 1113, 1114, 1114, 1116, 1116, |
| 1689 | 1117, 1117, 1121, 1125, 1130, 1130, 1132, 1136, 1142, 1143, |
| 1690 | 1144, 1145, 1146, 1150, 1151, 1152, 1156, 1157, 1161, 1162, |
| 1691 | 1163, 1167, 1168, 1169, 1170, 1171, 1174, 1175, 1176, 1177, |
| 1692 | 1178, 1179, 1180, 1187, 1188, 1189, 1190, 1193, 1194, 1199, |
| 1693 | 1200, 1203, 1204, 1211, 1212, 1218, 1219, 1227, 1235, 1236, |
| 1694 | 1241, 1242, 1243, 1248, 1261, 1261, 1261, 1261, 1264, 1268, |
| 1695 | 1272, 1279, 1284, 1292, 1310, 1328, 1333, 1345, 1355, 1359, |
| 1696 | 1369, 1376, 1383, 1390, 1395, 1400, 1407, 1408, 1415, 1422, |
| 1697 | 1430, 1435, 1446, 1474, 1490, 1519, 1547, 1572, 1591, 1617, |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 1698 | 1637, 1649, 1656, 1722, 1732, 1742, 1748, 1758, 1764, 1774, |
| 1699 | 1779, 1784, 1792, 1804, 1826, 1834, 1840, 1851, 1856, 1861, |
| 1700 | 1867, 1873, 1882, 1886, 1894, 1894, 1905, 1910, 1918, 1919, |
| 1701 | 1923, 1923, 1927, 1927, 1930, 1933, 1945, 1969, 1980, 1980, |
| 1702 | 1990, 1990, 1998, 1998, 2008, 2011, 2017, 2030, 2034, 2039, |
| 1703 | 2041, 2046, 2051, 2060, 2070, 2081, 2085, 2094, 2103, 2108, |
| 1704 | 2220, 2220, 2222, 2231, 2231, 2233, 2238, 2250, 2254, 2259, |
| 1705 | 2263, 2267, 2271, 2275, 2279, 2283, 2287, 2291, 2316, 2320, |
| 1706 | 2334, 2338, 2342, 2346, 2352, 2352, 2358, 2367, 2371, 2380, |
| 1707 | 2389, 2398, 2402, 2407, 2411, 2415, 2420, 2430, 2449, 2458, |
| 1708 | 2525, 2529, 2536, 2547, 2560, 2570, 2581, 2591, 2599, 2607, |
| 1709 | 2610, 2611, 2618, 2622, 2627, 2648, 2665, 2678, 2691, 2703, |
| 1710 | 2711, 2718, 2724, 2730, 2736, 2751, 2815, 2820, 2824, 2831, |
| 1711 | 2838, 2846, 2853, 2861, 2869, 2883, 2900 |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1712 | }; |
| 1713 | #endif |
| 1714 | |
| 1715 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1716 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1717 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1718 | static const char *const yytname[] = |
| 1719 | { |
| 1720 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1721 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1722 | "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR", |
| 1723 | "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION", |
| 1724 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1725 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1726 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
| 1727 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1728 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL", |
| 1729 | "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK", |
| 1730 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1731 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", |
| 1732 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", |
| 1733 | "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", |
| 1734 | "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", |
| 1735 | "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", |
| 1736 | "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", |
| 1737 | "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", |
| 1738 | "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", |
| 1739 | "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT", |
| 1740 | "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", |
| 1741 | "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", |
| 1742 | "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType", |
| 1743 | "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName", |
| 1744 | "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage", |
| 1745 | "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", |
| 1746 | "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr", |
| 1747 | "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection", |
| 1748 | "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", |
| 1749 | "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI", |
| 1750 | "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module", |
| 1751 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1752 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1753 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1754 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1755 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", |
| 1756 | "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", |
| 1757 | "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal", |
| 1758 | "OptVolatile", "MemoryInst", 0 |
| 1759 | }; |
| 1760 | #endif |
| 1761 | |
| 1762 | # ifdef YYPRINT |
| 1763 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1764 | token YYLEX-NUM. */ |
| 1765 | static const unsigned short int yytoknum[] = |
| 1766 | { |
| 1767 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1768 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1769 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1770 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1771 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1772 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1773 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1774 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1775 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1776 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1777 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1778 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1779 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1780 | 385, 386, 387, 388, 61, 44, 42, 92, 40, 41, |
| 1781 | 91, 120, 93, 60, 62, 123, 125, 99 |
| 1782 | }; |
| 1783 | # endif |
| 1784 | |
| 1785 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1786 | static const unsigned char yyr1[] = |
| 1787 | { |
| 1788 | 0, 148, 149, 149, 149, 149, 149, 149, 149, 149, |
| 1789 | 149, 150, 150, 150, 150, 150, 150, 151, 151, 151, |
| 1790 | 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, |
| 1791 | 152, 152, 152, 152, 152, 152, 152, 152, 152, 153, |
| 1792 | 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, |
| 1793 | 153, 153, 153, 153, 153, 154, 155, 155, 156, 156, |
| 1794 | 157, 157, 158, 158, 159, 159, 160, 160, 161, 161, |
| 1795 | 161, 161, 161, 162, 162, 162, 163, 163, 164, 164, |
| 1796 | 164, 165, 165, 165, 165, 165, 166, 166, 166, 166, |
| 1797 | 166, 166, 166, 167, 167, 167, 167, 168, 168, 169, |
| 1798 | 169, 170, 170, 171, 171, 172, 172, 173, 174, 174, |
| 1799 | 175, 175, 176, 176, 177, 177, 177, 177, 178, 178, |
| 1800 | 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, |
| 1801 | 178, 179, 180, 180, 181, 181, 182, 182, 182, 182, |
| 1802 | 183, 183, 184, 184, 184, 184, 184, 184, 184, 184, |
| 1803 | 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, |
| 1804 | 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, |
| 1805 | 185, 185, 186, 186, 187, 187, 188, 188, 189, 189, |
| 1806 | 191, 190, 192, 190, 190, 190, 190, 190, 193, 190, |
| 1807 | 194, 190, 195, 190, 190, 190, 196, 197, 197, 198, |
| 1808 | 199, 199, 199, 200, 200, 201, 201, 201, 201, 202, |
| 1809 | 203, 203, 204, 205, 205, 206, 207, 208, 208, 209, |
| 1810 | 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, |
| 1811 | 210, 210, 210, 210, 211, 211, 212, 213, 213, 214, |
| 1812 | 215, 215, 215, 216, 216, 216, 216, 216, 216, 216, |
| 1813 | 216, 216, 217, 217, 218, 219, 219, 220, 220, 220, |
| 1814 | 221, 221, 222, 222, 223, 223, 223, 223, 223, 223, |
| 1815 | 223, 223, 223, 223, 223, 223, 223, 224, 224, 225, |
| 1816 | 225, 225, 225, 225, 225, 225, 225 |
| 1817 | }; |
| 1818 | |
| 1819 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1820 | static const unsigned char yyr2[] = |
| 1821 | { |
| 1822 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1823 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1824 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1825 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1826 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1827 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1828 | 1, 0, 2, 0, 1, 1, 2, 0, 1, 1, |
| 1829 | 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, |
| 1830 | 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, |
| 1831 | 1, 1, 2, 1, 1, 1, 1, 0, 2, 1, |
| 1832 | 1, 0, 2, 0, 2, 0, 3, 2, 0, 1, |
| 1833 | 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, |
| 1834 | 2, 1, 2, 5, 5, 5, 5, 3, 2, 5, |
| 1835 | 4, 2, 1, 1, 1, 3, 1, 3, 1, 0, |
| 1836 | 1, 3, 4, 3, 3, 4, 4, 3, 6, 5, |
| 1837 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1838 | 2, 2, 6, 5, 8, 6, 6, 7, 7, 6, |
| 1839 | 8, 8, 3, 1, 1, 1, 1, 0, 1, 2, |
| 1840 | 0, 3, 0, 3, 3, 1, 3, 3, 0, 6, |
| 1841 | 0, 7, 0, 7, 2, 3, 1, 3, 3, 3, |
| 1842 | 3, 1, 0, 5, 3, 1, 3, 1, 0, 9, |
| 1843 | 1, 1, 4, 1, 1, 2, 3, 0, 1, 1, |
| 1844 | 1, 1, 1, 1, 1, 1, 1, 3, 1, 5, |
| 1845 | 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, |
| 1846 | 2, 0, 1, 2, 2, 3, 9, 9, 8, 14, |
| 1847 | 1, 1, 6, 5, 2, 6, 7, 3, 5, 0, |
| 1848 | 0, 3, 2, 1, 5, 5, 6, 6, 4, 6, |
| 1849 | 4, 4, 6, 6, 2, 8, 1, 1, 0, 3, |
| 1850 | 6, 3, 6, 2, 4, 6, 4 |
| 1851 | }; |
| 1852 | |
| 1853 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1854 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1855 | means the default is an error. */ |
| 1856 | static const unsigned short int yydefact[] = |
| 1857 | { |
| 1858 | 67, 58, 64, 59, 65, 185, 182, 180, 0, 0, |
| 1859 | 0, 0, 0, 0, 76, 0, 67, 178, 78, 81, |
| 1860 | 0, 0, 194, 0, 0, 62, 0, 66, 68, 70, |
| 1861 | 69, 71, 73, 72, 74, 75, 77, 76, 76, 0, |
| 1862 | 1, 179, 79, 80, 76, 183, 82, 83, 84, 85, |
| 1863 | 76, 241, 181, 241, 0, 0, 202, 195, 196, 184, |
| 1864 | 230, 231, 187, 114, 115, 116, 117, 118, 0, 0, |
| 1865 | 0, 0, 232, 233, 119, 186, 121, 0, 0, 174, |
| 1866 | 175, 0, 86, 86, 242, 238, 63, 213, 214, 215, |
| 1867 | 237, 197, 198, 201, 0, 139, 122, 0, 0, 0, |
| 1868 | 0, 128, 140, 0, 120, 139, 0, 0, 114, 115, |
| 1869 | 116, 0, 0, 0, 188, 0, 87, 88, 89, 90, |
| 1870 | 91, 0, 216, 0, 278, 240, 0, 199, 138, 97, |
| 1871 | 134, 136, 0, 0, 0, 0, 0, 0, 127, 0, |
| 1872 | 190, 192, 159, 160, 155, 157, 156, 158, 161, 154, |
| 1873 | 150, 151, 2, 3, 4, 5, 6, 7, 8, 9, |
| 1874 | 10, 14, 15, 16, 11, 12, 13, 0, 0, 0, |
| 1875 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 1876 | 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1877 | 0, 0, 0, 153, 152, 110, 92, 133, 132, 0, |
| 1878 | 210, 211, 212, 277, 263, 0, 0, 0, 0, 86, |
| 1879 | 250, 251, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1880 | 0, 0, 0, 0, 0, 0, 0, 239, 86, 254, |
| 1881 | 0, 276, 200, 131, 0, 101, 0, 0, 130, 0, |
| 1882 | 141, 101, 110, 110, 29, 30, 31, 32, 33, 34, |
| 1883 | 35, 36, 37, 38, 0, 53, 54, 49, 50, 51, |
| 1884 | 52, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
| 1885 | 48, 0, 0, 0, 0, 0, 0, 143, 173, 0, |
| 1886 | 0, 0, 147, 0, 144, 0, 0, 0, 0, 189, |
| 1887 | 0, 262, 244, 0, 243, 0, 0, 55, 0, 0, |
| 1888 | 0, 0, 105, 105, 283, 0, 0, 274, 0, 0, |
| 1889 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, |
| 1890 | 94, 95, 96, 98, 137, 135, 124, 125, 126, 129, |
| 1891 | 123, 191, 193, 0, 0, 260, 0, 0, 0, 0, |
| 1892 | 0, 142, 128, 140, 0, 145, 146, 0, 0, 0, |
| 1893 | 0, 0, 112, 110, 208, 219, 220, 221, 226, 222, |
| 1894 | 223, 224, 225, 217, 0, 228, 235, 234, 236, 0, |
| 1895 | 245, 0, 0, 0, 0, 0, 279, 0, 281, 260, |
| 1896 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1897 | 0, 0, 0, 99, 100, 102, 0, 0, 0, 0, |
| 1898 | 0, 0, 0, 172, 149, 0, 0, 0, 0, 107, |
| 1899 | 113, 111, 207, 97, 205, 0, 218, 0, 0, 0, |
| 1900 | 0, 0, 0, 0, 0, 0, 0, 286, 0, 0, |
| 1901 | 0, 270, 271, 0, 0, 0, 0, 268, 0, 284, |
| 1902 | 0, 0, 0, 0, 163, 0, 0, 0, 0, 148, |
| 1903 | 0, 0, 0, 61, 0, 101, 0, 227, 0, 0, |
| 1904 | 259, 0, 0, 105, 106, 105, 0, 0, 0, 0, |
| 1905 | 0, 264, 265, 259, 0, 0, 0, 261, 0, 169, |
| 1906 | 0, 0, 165, 166, 162, 60, 204, 206, 97, 108, |
| 1907 | 0, 0, 0, 0, 0, 266, 267, 0, 280, 282, |
| 1908 | 0, 0, 269, 272, 273, 0, 285, 167, 168, 0, |
| 1909 | 0, 0, 61, 109, 103, 229, 0, 0, 97, 0, |
| 1910 | 101, 255, 0, 101, 164, 170, 171, 203, 0, 209, |
| 1911 | 0, 248, 0, 0, 257, 0, 0, 256, 275, 104, |
| 1912 | 246, 0, 247, 0, 97, 0, 0, 0, 258, 0, |
| 1913 | 0, 0, 0, 253, 0, 0, 252, 0, 249 |
| 1914 | }; |
| 1915 | |
| 1916 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1917 | static const short int yydefgoto[] = |
| 1918 | { |
| 1919 | -1, 190, 191, 192, 254, 271, 111, 112, 72, 486, |
| 1920 | 12, 73, 14, 37, 38, 39, 44, 50, 121, 323, |
| 1921 | 233, 395, 326, 529, 376, 352, 514, 289, 353, 74, |
| 1922 | 113, 130, 199, 131, 132, 103, 278, 365, 279, 81, |
| 1923 | 15, 16, 17, 19, 18, 195, 242, 243, 59, 22, |
| 1924 | 57, 94, 414, 415, 122, 202, 51, 89, 52, 45, |
| 1925 | 417, 366, 76, 368, 294, 53, 85, 86, 227, 533, |
| 1926 | 125, 307, 494, 398, 228, 229, 230, 231 |
| 1927 | }; |
| 1928 | |
| 1929 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1930 | STATE-NUM. */ |
| 1931 | #define YYPACT_NINF -440 |
| 1932 | static const short int yypact[] = |
| 1933 | { |
| 1934 | 406, -440, -440, -440, -440, -440, -440, -440, -2, -101, |
| 1935 | 21, -55, 80, -20, 15, 132, 556, -440, 253, 197, |
| 1936 | -7, 87, -440, 20, 207, -440, 893, -440, -440, -440, |
| 1937 | -440, -440, -440, -440, -440, -440, -440, 97, 97, 125, |
| 1938 | -440, -440, -440, -440, 97, -440, -440, -440, -440, -440, |
| 1939 | 97, 235, -440, 6, 240, 248, 258, -440, -440, -440, |
| 1940 | -440, -440, 134, -440, -440, -440, -440, -440, 269, 277, |
| 1941 | 11, 123, -440, -440, -440, 33, -440, 125, 125, -440, |
| 1942 | -440, 1055, 128, 128, -440, -440, 47, -440, -440, -440, |
| 1943 | -440, -440, -440, -440, -57, 939, -440, 154, 156, 488, |
| 1944 | 134, -440, 33, -112, -440, 939, 1055, 1149, 38, 281, |
| 1945 | 289, 239, 293, 850, -440, 299, -440, -440, -440, -440, |
| 1946 | -440, 1168, -440, 2, 1301, -440, 285, -440, -440, 33, |
| 1947 | -440, 170, 167, 1149, 1149, 164, -97, 1149, -440, 171, |
| 1948 | -440, 33, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1949 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1950 | -440, -440, -440, -440, -440, -440, -440, 254, 446, 174, |
| 1951 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1952 | -440, -440, 175, 176, 177, 178, 109, 1203, 676, 290, |
| 1953 | 181, 182, 183, -440, -440, 187, -440, 134, 33, 93, |
| 1954 | -440, -440, -440, -440, -440, 273, 1217, 127, 313, 128, |
| 1955 | -440, -440, 254, 446, 1149, 1149, 1149, 1149, 1149, 1149, |
| 1956 | 1149, 1149, 1149, 1149, 1149, 1149, 1149, -440, 128, -440, |
| 1957 | 70, -440, -440, -29, 1098, -440, 72, -39, -440, 184, |
| 1958 | 33, -440, 187, 187, -440, -440, -440, -440, -440, -440, |
| 1959 | -440, -440, -440, -440, 188, -440, -440, -440, -440, -440, |
| 1960 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1961 | -440, 196, 1055, 1055, 1055, 1055, 1055, -440, -440, 22, |
| 1962 | 771, -44, -440, -59, -440, 1055, 1055, 1055, -9, -440, |
| 1963 | 198, -440, 134, 591, -440, 728, 728, -440, 728, 1168, |
| 1964 | 1149, 1149, 112, 147, -440, 591, 75, 190, 200, 214, |
| 1965 | 215, 217, 219, 591, 591, 322, 1168, 1149, 1149, -440, |
| 1966 | -440, -440, -440, -440, -440, -440, -41, -440, -440, -440, |
| 1967 | -41, -440, -440, 1055, 1055, -440, 230, 231, 232, 233, |
| 1968 | 1055, -440, 225, 850, -43, -440, -440, 236, 241, 337, |
| 1969 | 355, 371, -440, 187, 1114, -440, -440, -440, -440, -440, |
| 1970 | -440, -440, -440, 323, 1055, -440, -440, -440, -440, 243, |
| 1971 | -440, 244, 728, 591, 591, 17, -440, 19, -440, -440, |
| 1972 | 728, 242, 1149, 1149, 1149, 1149, 1149, 245, 246, 1149, |
| 1973 | 728, 591, 249, -440, -440, -440, 252, 255, -24, 1055, |
| 1974 | 1055, 1055, 1055, -440, -440, 247, 1055, 1055, 1149, -440, |
| 1975 | -440, -440, -440, 33, 257, 260, -440, 375, -37, 383, |
| 1976 | 386, 264, 268, 272, 728, 400, 728, 275, 282, 728, |
| 1977 | 284, 33, -440, 295, 296, 728, 728, 33, 270, -440, |
| 1978 | 1149, 1055, 1055, 1149, -440, 297, 298, 301, 303, -440, |
| 1979 | 300, 302, 150, 32, 1133, -440, 305, -440, 728, 728, |
| 1980 | 1149, 728, 728, 307, -440, 307, 728, 311, 1149, 1149, |
| 1981 | 1149, -440, -440, 1149, 591, 308, 310, -440, 1055, -440, |
| 1982 | 1055, 1055, -440, -440, -440, -440, -440, -440, 33, 46, |
| 1983 | 397, 315, 314, 591, 26, -440, -440, 376, -440, -440, |
| 1984 | 309, 728, -440, -440, -440, 89, -440, -440, -440, 317, |
| 1985 | 319, 321, 32, -440, 413, -440, 449, 7, -440, 1149, |
| 1986 | -440, -440, 324, -440, -440, -440, -440, -440, 460, -440, |
| 1987 | 728, -440, 976, 9, -29, 591, 149, -440, -41, -440, |
| 1988 | -440, 330, -440, 976, -440, 453, 454, 336, -29, 728, |
| 1989 | 728, 461, 412, -440, 728, 465, -440, 728, -440 |
| 1990 | }; |
| 1991 | |
| 1992 | /* YYPGOTO[NTERM-NUM]. */ |
| 1993 | static const short int yypgoto[] = |
| 1994 | { |
| 1995 | -440, 358, 359, 361, 274, 276, -206, -440, 0, -19, |
| 1996 | 401, 13, -440, -440, -440, 31, -440, -440, -178, -309, |
| 1997 | -394, -440, -236, -440, -297, -1, -440, -207, -440, -440, |
| 1998 | -25, 263, -252, -440, 387, 404, -69, -110, -162, 160, |
| 1999 | -440, -440, 490, -440, -440, -440, -440, -440, -440, -440, |
| 2000 | -440, -440, -440, -440, 426, -440, -440, -440, -440, -440, |
| 2001 | -440, -439, -73, 100, -212, -440, 457, -440, -440, -440, |
| 2002 | -440, -440, 40, 135, -440, -440, -440, -440 |
| 2003 | }; |
| 2004 | |
| 2005 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2006 | positive, shift that token. If negative, reduce the rule which |
| 2007 | number is the opposite. If zero, do what YYDEFACT says. |
| 2008 | If YYTABLE_NINF, syntax error. */ |
| 2009 | #define YYTABLE_NINF -178 |
| 2010 | static const short int yytable[] = |
| 2011 | { |
| 2012 | 11, 75, 298, 193, 304, 330, 378, 308, 309, 310, |
| 2013 | 311, 312, 114, 13, 315, 98, 11, 394, 297, 453, |
| 2014 | 297, 394, 350, 137, 84, 281, 283, 200, 424, 13, |
| 2015 | 426, 299, 87, 23, 138, 331, 332, 140, 137, 351, |
| 2016 | 194, -55, -55, -55, -55, 20, 102, 372, 1, 239, |
| 2017 | 316, 3, 28, 29, 30, 31, 32, 33, 34, 21, |
| 2018 | 35, 142, 143, 1, 390, 425, 3, 425, 77, 78, |
| 2019 | 129, 319, 320, 24, 102, 82, 340, 350, 126, 25, |
| 2020 | 129, 83, 141, 319, 320, 127, 11, 346, 393, 321, |
| 2021 | 322, 340, 340, 541, 512, 26, 198, 104, 340, 105, |
| 2022 | 345, 321, 322, 405, 547, 328, 392, 457, 236, 237, |
| 2023 | 2, 443, 240, 4, 27, 444, 60, 61, 344, 100, |
| 2024 | 108, 109, 110, 66, 534, 1, 2, 54, 3, 4, |
| 2025 | 60, 61, 40, 100, 63, 64, 65, 66, 295, 1, |
| 2026 | 2, 296, 3, 4, 319, 320, 411, 201, 36, 531, |
| 2027 | 548, 542, 88, 67, 79, 80, 99, 340, 319, 320, |
| 2028 | 56, 519, 321, 322, 341, 520, 498, 67, 499, 104, |
| 2029 | 430, 105, 432, 433, 434, 393, 321, 322, 317, 318, |
| 2030 | 394, 293, 545, 115, 116, 117, 118, 119, 120, 302, |
| 2031 | 303, 293, 305, 306, 293, 293, 293, 293, 293, 313, |
| 2032 | 314, 293, 418, 335, 336, 337, 338, 339, 104, 129, |
| 2033 | 105, 104, 290, 105, 327, 380, 347, 348, 349, 489, |
| 2034 | 367, 55, 367, 367, 519, 367, 58, 394, 523, 394, |
| 2035 | 36, 477, 367, 193, 46, 47, 48, 106, 107, 49, |
| 2036 | 367, 367, 144, 145, 146, 147, 68, 375, 104, 69, |
| 2037 | 105, 277, 70, 84, 71, 343, 502, 503, 504, 91, |
| 2038 | 68, 319, 320, 69, 396, 397, 70, 92, 71, 101, |
| 2039 | 194, 403, 95, 96, 198, 373, 374, 93, 393, 321, |
| 2040 | 322, 97, 377, 104, 536, 105, 104, 538, 105, 484, |
| 2041 | -56, 198, 391, 293, 42, 133, 43, 134, -57, 367, |
| 2042 | 367, 367, 148, 196, 232, 234, 235, 367, 238, 284, |
| 2043 | 241, 532, 272, 273, 274, 275, 276, 367, 367, 285, |
| 2044 | 286, 287, 288, 291, 297, 381, 333, 543, 329, 413, |
| 2045 | 445, 446, 447, 448, 334, 382, 354, 450, 451, 244, |
| 2046 | 245, 246, 247, 248, 249, 250, 251, 252, 253, 383, |
| 2047 | 384, 367, 385, 367, 386, 389, 367, 293, 431, 293, |
| 2048 | 293, 293, 367, 367, 437, 399, 400, 401, 402, 404, |
| 2049 | 408, 406, 475, 476, 409, 410, 407, 416, 419, 420, |
| 2050 | 435, 436, 429, 452, 440, 367, 367, 441, 367, 367, |
| 2051 | 442, 449, 454, 367, 456, 369, 370, 458, 371, 455, |
| 2052 | 459, 367, 460, 461, 464, 379, -177, 462, 473, 509, |
| 2053 | 443, 510, 511, 387, 388, 474, 515, 466, 293, 468, |
| 2054 | 367, -63, 1, 2, 425, 3, 4, 5, 367, 488, |
| 2055 | 469, 470, 478, 6, 7, 493, 480, 479, 481, 482, |
| 2056 | 490, 483, 497, 293, 293, 293, 501, 507, 493, 508, |
| 2057 | 516, 521, 8, 485, 517, 9, 524, 367, 525, 10, |
| 2058 | 526, 528, 367, 530, 539, 546, 537, 549, 550, 255, |
| 2059 | 256, 551, 421, 422, 423, 554, 367, 367, 555, 557, |
| 2060 | 428, 367, 224, 225, 367, 226, 300, 124, 513, 301, |
| 2061 | 438, 439, 139, 527, 535, 60, 61, 325, 100, 63, |
| 2062 | 64, 65, 66, 136, 1, 2, 41, 3, 4, 123, |
| 2063 | 90, 0, 485, 505, 427, 0, 0, 0, 0, 0, |
| 2064 | 0, 0, 0, 0, 463, 0, 465, 0, 0, 467, |
| 2065 | 0, 0, 67, 0, 0, 471, 472, 257, 258, 259, |
| 2066 | 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, |
| 2067 | 270, 0, 0, 0, 0, 0, -176, 0, 491, 492, |
| 2068 | 0, 495, 496, 0, 0, 0, 500, 0, 0, 0, |
| 2069 | 0, -63, 1, 2, 506, 3, 4, 5, 0, 0, |
| 2070 | 0, 0, 0, 6, 7, 0, 0, 0, 0, 0, |
| 2071 | 0, 0, 0, 518, 355, 356, 0, 0, 60, 61, |
| 2072 | 357, 522, 8, 0, 0, 9, 0, 1, 2, 10, |
| 2073 | 3, 4, 0, 358, 359, 360, 0, 0, 0, 0, |
| 2074 | 0, 0, 0, 0, 0, 68, 361, 362, 69, 0, |
| 2075 | 540, 70, 0, 71, 135, 544, 0, 0, 0, 0, |
| 2076 | 0, 0, 0, 363, 0, 0, 0, 0, 0, 552, |
| 2077 | 553, 0, 0, 0, 556, 0, 0, 558, 0, 152, |
| 2078 | 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, |
| 2079 | 163, 164, 165, 166, 167, 168, 0, 0, 0, 0, |
| 2080 | 0, 0, 0, 60, 61, 0, 100, 108, 109, 110, |
| 2081 | 66, 0, 1, 2, 0, 3, 4, 0, 0, 0, |
| 2082 | 0, 169, 170, 171, 172, 173, 174, 175, 176, 177, |
| 2083 | 178, 179, 180, 181, 0, 182, 0, 183, 184, 185, |
| 2084 | 67, 0, 0, 0, 0, 0, 0, 104, 0, 105, |
| 2085 | 0, 355, 356, 0, 364, 60, 61, 357, 0, 0, |
| 2086 | 0, 0, 0, 0, 1, 2, 0, 3, 4, 0, |
| 2087 | 358, 359, 360, 0, 0, 0, 0, 0, 0, 0, |
| 2088 | 0, 0, 0, 361, 362, 0, 0, 0, 0, 0, |
| 2089 | 0, 0, 0, 0, 0, 0, 0, 0, 60, 61, |
| 2090 | 363, 100, 108, 109, 110, 66, 0, 1, 2, 0, |
| 2091 | 3, 4, 0, 0, 0, 0, 152, 153, 154, 155, |
| 2092 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2093 | 166, 167, 168, 68, 0, 67, 69, 0, 0, 70, |
| 2094 | 0, 71, 282, 0, 0, 0, 0, 0, 0, 0, |
| 2095 | 0, 0, 0, 0, 0, 0, 0, 0, 169, 170, |
| 2096 | 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, |
| 2097 | 181, 0, 182, 0, 183, 184, 185, 60, 61, 0, |
| 2098 | 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, |
| 2099 | 4, 364, 149, 0, 0, 0, 0, 0, 0, 0, |
| 2100 | 0, 0, 0, 0, 0, 150, 151, 0, 0, 0, |
| 2101 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2102 | 60, 61, 0, 62, 63, 64, 65, 66, 68, 1, |
| 2103 | 2, 69, 3, 4, 70, 0, 71, 342, 152, 153, |
| 2104 | 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, |
| 2105 | 164, 165, 166, 167, 168, 0, 0, 67, 0, 0, |
| 2106 | 0, 0, 0, 0, 0, 0, 60, 61, 0, 100, |
| 2107 | 63, 64, 65, 66, 0, 1, 2, 0, 3, 4, |
| 2108 | 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, |
| 2109 | 179, 180, 181, 128, 182, 0, 183, 184, 185, 355, |
| 2110 | 356, 0, 0, 67, 0, 357, 104, 0, 105, 0, |
| 2111 | 186, 0, 0, 187, 0, 188, 0, 189, 358, 359, |
| 2112 | 360, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2113 | 0, 361, 362, 0, 0, 0, 0, 0, 0, 0, |
| 2114 | 0, 0, 0, 0, 0, 0, 0, 0, 363, 0, |
| 2115 | 68, 0, 0, 69, 0, 0, 70, 0, 71, 0, |
| 2116 | 0, 0, 0, 0, 152, 153, 154, 155, 156, 157, |
| 2117 | 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, |
| 2118 | 168, 0, 60, 61, 0, 100, 108, 109, 110, 66, |
| 2119 | 0, 1, 2, 0, 3, 4, 68, 0, 0, 69, |
| 2120 | 0, 0, 70, 0, 71, 0, 169, 170, 171, 172, |
| 2121 | 173, 174, 175, 176, 177, 178, 179, 180, 181, 67, |
| 2122 | 182, 0, 183, 184, 185, 60, 61, 0, 100, 63, |
| 2123 | 64, 65, 66, 0, 1, 2, 0, 3, 4, 364, |
| 2124 | 0, 60, 61, 0, 100, 63, 64, 65, 66, 0, |
| 2125 | 1, 2, 324, 3, 4, 0, 0, 0, 0, 0, |
| 2126 | 60, 61, 67, 100, 63, 64, 65, 66, 412, 1, |
| 2127 | 2, 0, 3, 4, 0, 0, 60, 61, 67, 100, |
| 2128 | 63, 64, 65, 66, 0, 1, 2, 487, 3, 4, |
| 2129 | 0, 0, 0, 0, 0, 60, 61, 67, 197, 63, |
| 2130 | 64, 65, 66, 0, 1, 2, 0, 3, 4, 0, |
| 2131 | 0, 0, 68, 67, 0, 69, 0, 0, 70, 0, |
| 2132 | 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2133 | 60, 61, 67, 100, 108, 109, 110, 66, 0, 1, |
| 2134 | 2, 0, 3, 4, 60, 61, 0, 292, 63, 64, |
| 2135 | 65, 66, 0, 1, 2, 68, 3, 4, 69, 0, |
| 2136 | 0, 70, 0, 71, 0, 0, 0, 67, 0, 0, |
| 2137 | 0, 68, 0, 0, 69, 0, 0, 70, 0, 71, |
| 2138 | 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2139 | 68, 0, 0, 69, 0, 0, 70, 0, 71, 0, |
| 2140 | 0, 0, 0, 0, 0, 0, 68, 0, 0, 69, |
| 2141 | 0, 0, 70, 0, 71, 0, 0, 0, 0, 0, |
| 2142 | 0, 0, 0, 0, 0, 68, 0, 0, 69, 0, |
| 2143 | 0, 70, 0, 71, 0, 0, 0, 0, 0, 0, |
| 2144 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2145 | 0, 0, 0, 203, 0, 0, 0, 0, 0, 0, |
| 2146 | 68, 0, 0, 69, 0, 0, 70, 0, 280, 0, |
| 2147 | 0, 204, 205, 0, 68, 0, 0, 69, 0, 0, |
| 2148 | 70, 0, 71, 206, 207, 208, 209, 210, 211, 152, |
| 2149 | 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, |
| 2150 | 163, 164, 165, 166, 212, 213, 0, 0, 0, 0, |
| 2151 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2152 | 0, 0, 0, 0, 0, 0, 214, 215, 216, 0, |
| 2153 | 0, 217, 170, 171, 172, 173, 174, 175, 176, 177, |
| 2154 | 178, 179, 180, 181, 218, 219, 220, 221, 222, 223 |
| 2155 | }; |
| 2156 | |
| 2157 | static const short int yycheck[] = |
| 2158 | { |
| 2159 | 0, 26, 208, 113, 216, 241, 303, 219, 220, 221, |
| 2160 | 222, 223, 81, 0, 226, 4, 16, 326, 11, 413, |
| 2161 | 11, 330, 31, 135, 18, 187, 188, 25, 11, 16, |
| 2162 | 11, 209, 26, 134, 146, 242, 243, 106, 135, 48, |
| 2163 | 113, 3, 4, 5, 6, 47, 71, 299, 16, 146, |
| 2164 | 228, 19, 37, 38, 39, 40, 41, 42, 43, 61, |
| 2165 | 45, 23, 24, 16, 316, 48, 19, 48, 37, 38, |
| 2166 | 95, 112, 113, 52, 99, 44, 135, 31, 135, 134, |
| 2167 | 105, 50, 107, 112, 113, 142, 86, 146, 129, 130, |
| 2168 | 131, 135, 135, 532, 488, 15, 121, 136, 135, 138, |
| 2169 | 144, 130, 131, 146, 543, 144, 318, 144, 133, 134, |
| 2170 | 17, 135, 137, 20, 134, 139, 7, 8, 280, 10, |
| 2171 | 11, 12, 13, 14, 518, 16, 17, 134, 19, 20, |
| 2172 | 7, 8, 0, 10, 11, 12, 13, 14, 11, 16, |
| 2173 | 17, 14, 19, 20, 112, 113, 353, 145, 133, 142, |
| 2174 | 544, 142, 146, 44, 29, 30, 145, 135, 112, 113, |
| 2175 | 140, 135, 130, 131, 142, 139, 463, 44, 465, 136, |
| 2176 | 382, 138, 384, 385, 386, 129, 130, 131, 108, 109, |
| 2177 | 489, 206, 33, 55, 56, 57, 58, 59, 60, 214, |
| 2178 | 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
| 2179 | 225, 226, 364, 272, 273, 274, 275, 276, 136, 234, |
| 2180 | 138, 136, 199, 138, 142, 140, 285, 286, 287, 455, |
| 2181 | 293, 134, 295, 296, 135, 298, 19, 536, 139, 538, |
| 2182 | 133, 443, 305, 343, 37, 38, 39, 77, 78, 42, |
| 2183 | 313, 314, 3, 4, 5, 6, 137, 135, 136, 140, |
| 2184 | 138, 142, 143, 18, 145, 280, 468, 469, 470, 19, |
| 2185 | 137, 112, 113, 140, 333, 334, 143, 19, 145, 146, |
| 2186 | 343, 340, 138, 4, 299, 300, 301, 19, 129, 130, |
| 2187 | 131, 4, 135, 136, 520, 138, 136, 523, 138, 139, |
| 2188 | 9, 316, 317, 318, 41, 141, 43, 141, 9, 372, |
| 2189 | 373, 374, 9, 4, 19, 135, 139, 380, 144, 19, |
| 2190 | 139, 517, 138, 138, 138, 138, 138, 390, 391, 138, |
| 2191 | 138, 138, 135, 50, 11, 135, 138, 533, 144, 354, |
| 2192 | 399, 400, 401, 402, 138, 135, 138, 406, 407, 85, |
| 2193 | 86, 87, 88, 89, 90, 91, 92, 93, 94, 135, |
| 2194 | 135, 424, 135, 426, 135, 33, 429, 382, 383, 384, |
| 2195 | 385, 386, 435, 436, 389, 135, 135, 135, 135, 144, |
| 2196 | 33, 135, 441, 442, 19, 4, 135, 54, 135, 135, |
| 2197 | 135, 135, 140, 408, 135, 458, 459, 135, 461, 462, |
| 2198 | 135, 144, 135, 466, 19, 295, 296, 14, 298, 139, |
| 2199 | 14, 474, 138, 135, 4, 305, 0, 135, 138, 478, |
| 2200 | 135, 480, 481, 313, 314, 440, 19, 135, 443, 135, |
| 2201 | 493, 15, 16, 17, 48, 19, 20, 21, 501, 454, |
| 2202 | 135, 135, 135, 27, 28, 460, 135, 139, 135, 139, |
| 2203 | 135, 139, 135, 468, 469, 470, 135, 139, 473, 139, |
| 2204 | 135, 142, 46, 453, 140, 49, 139, 530, 139, 53, |
| 2205 | 139, 48, 535, 14, 4, 135, 142, 14, 14, 23, |
| 2206 | 24, 135, 372, 373, 374, 14, 549, 550, 66, 14, |
| 2207 | 380, 554, 124, 124, 557, 124, 212, 86, 489, 213, |
| 2208 | 390, 391, 105, 512, 519, 7, 8, 234, 10, 11, |
| 2209 | 12, 13, 14, 99, 16, 17, 16, 19, 20, 83, |
| 2210 | 53, -1, 512, 473, 379, -1, -1, -1, -1, -1, |
| 2211 | -1, -1, -1, -1, 424, -1, 426, -1, -1, 429, |
| 2212 | -1, -1, 44, -1, -1, 435, 436, 91, 92, 93, |
| 2213 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
| 2214 | 104, -1, -1, -1, -1, -1, 0, -1, 458, 459, |
| 2215 | -1, 461, 462, -1, -1, -1, 466, -1, -1, -1, |
| 2216 | -1, 15, 16, 17, 474, 19, 20, 21, -1, -1, |
| 2217 | -1, -1, -1, 27, 28, -1, -1, -1, -1, -1, |
| 2218 | -1, -1, -1, 493, 3, 4, -1, -1, 7, 8, |
| 2219 | 9, 501, 46, -1, -1, 49, -1, 16, 17, 53, |
| 2220 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
| 2221 | -1, -1, -1, -1, -1, 137, 35, 36, 140, -1, |
| 2222 | 530, 143, -1, 145, 146, 535, -1, -1, -1, -1, |
| 2223 | -1, -1, -1, 52, -1, -1, -1, -1, -1, 549, |
| 2224 | 550, -1, -1, -1, 554, -1, -1, 557, -1, 68, |
| 2225 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2226 | 79, 80, 81, 82, 83, 84, -1, -1, -1, -1, |
| 2227 | -1, -1, -1, 7, 8, -1, 10, 11, 12, 13, |
| 2228 | 14, -1, 16, 17, -1, 19, 20, -1, -1, -1, |
| 2229 | -1, 110, 111, 112, 113, 114, 115, 116, 117, 118, |
| 2230 | 119, 120, 121, 122, -1, 124, -1, 126, 127, 128, |
| 2231 | 44, -1, -1, -1, -1, -1, -1, 136, -1, 138, |
| 2232 | -1, 3, 4, -1, 143, 7, 8, 9, -1, -1, |
| 2233 | -1, -1, -1, -1, 16, 17, -1, 19, 20, -1, |
| 2234 | 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2235 | -1, -1, -1, 35, 36, -1, -1, -1, -1, -1, |
| 2236 | -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, |
| 2237 | 52, 10, 11, 12, 13, 14, -1, 16, 17, -1, |
| 2238 | 19, 20, -1, -1, -1, -1, 68, 69, 70, 71, |
| 2239 | 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, |
| 2240 | 82, 83, 84, 137, -1, 44, 140, -1, -1, 143, |
| 2241 | -1, 145, 146, -1, -1, -1, -1, -1, -1, -1, |
| 2242 | -1, -1, -1, -1, -1, -1, -1, -1, 110, 111, |
| 2243 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
| 2244 | 122, -1, 124, -1, 126, 127, 128, 7, 8, -1, |
| 2245 | -1, -1, -1, -1, -1, -1, 16, 17, -1, 19, |
| 2246 | 20, 143, 22, -1, -1, -1, -1, -1, -1, -1, |
| 2247 | -1, -1, -1, -1, -1, 35, 36, -1, -1, -1, |
| 2248 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2249 | 7, 8, -1, 10, 11, 12, 13, 14, 137, 16, |
| 2250 | 17, 140, 19, 20, 143, -1, 145, 146, 68, 69, |
| 2251 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2252 | 80, 81, 82, 83, 84, -1, -1, 44, -1, -1, |
| 2253 | -1, -1, -1, -1, -1, -1, 7, 8, -1, 10, |
| 2254 | 11, 12, 13, 14, -1, 16, 17, -1, 19, 20, |
| 2255 | 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
| 2256 | 120, 121, 122, 34, 124, -1, 126, 127, 128, 3, |
| 2257 | 4, -1, -1, 44, -1, 9, 136, -1, 138, -1, |
| 2258 | 140, -1, -1, 143, -1, 145, -1, 147, 22, 23, |
| 2259 | 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2260 | -1, 35, 36, -1, -1, -1, -1, -1, -1, -1, |
| 2261 | -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, |
| 2262 | 137, -1, -1, 140, -1, -1, 143, -1, 145, -1, |
| 2263 | -1, -1, -1, -1, 68, 69, 70, 71, 72, 73, |
| 2264 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2265 | 84, -1, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2266 | -1, 16, 17, -1, 19, 20, 137, -1, -1, 140, |
| 2267 | -1, -1, 143, -1, 145, -1, 110, 111, 112, 113, |
| 2268 | 114, 115, 116, 117, 118, 119, 120, 121, 122, 44, |
| 2269 | 124, -1, 126, 127, 128, 7, 8, -1, 10, 11, |
| 2270 | 12, 13, 14, -1, 16, 17, -1, 19, 20, 143, |
| 2271 | -1, 7, 8, -1, 10, 11, 12, 13, 14, -1, |
| 2272 | 16, 17, 34, 19, 20, -1, -1, -1, -1, -1, |
| 2273 | 7, 8, 44, 10, 11, 12, 13, 14, 34, 16, |
| 2274 | 17, -1, 19, 20, -1, -1, 7, 8, 44, 10, |
| 2275 | 11, 12, 13, 14, -1, 16, 17, 34, 19, 20, |
| 2276 | -1, -1, -1, -1, -1, 7, 8, 44, 10, 11, |
| 2277 | 12, 13, 14, -1, 16, 17, -1, 19, 20, -1, |
| 2278 | -1, -1, 137, 44, -1, 140, -1, -1, 143, -1, |
| 2279 | 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2280 | 7, 8, 44, 10, 11, 12, 13, 14, -1, 16, |
| 2281 | 17, -1, 19, 20, 7, 8, -1, 10, 11, 12, |
| 2282 | 13, 14, -1, 16, 17, 137, 19, 20, 140, -1, |
| 2283 | -1, 143, -1, 145, -1, -1, -1, 44, -1, -1, |
| 2284 | -1, 137, -1, -1, 140, -1, -1, 143, -1, 145, |
| 2285 | -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2286 | 137, -1, -1, 140, -1, -1, 143, -1, 145, -1, |
| 2287 | -1, -1, -1, -1, -1, -1, 137, -1, -1, 140, |
| 2288 | -1, -1, 143, -1, 145, -1, -1, -1, -1, -1, |
| 2289 | -1, -1, -1, -1, -1, 137, -1, -1, 140, -1, |
| 2290 | -1, 143, -1, 145, -1, -1, -1, -1, -1, -1, |
| 2291 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2292 | -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, |
| 2293 | 137, -1, -1, 140, -1, -1, 143, -1, 145, -1, |
| 2294 | -1, 50, 51, -1, 137, -1, -1, 140, -1, -1, |
| 2295 | 143, -1, 145, 62, 63, 64, 65, 66, 67, 68, |
| 2296 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2297 | 79, 80, 81, 82, 83, 84, -1, -1, -1, -1, |
| 2298 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2299 | -1, -1, -1, -1, -1, -1, 105, 106, 107, -1, |
| 2300 | -1, 110, 111, 112, 113, 114, 115, 116, 117, 118, |
| 2301 | 119, 120, 121, 122, 123, 124, 125, 126, 127, 128 |
| 2302 | }; |
| 2303 | |
| 2304 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2305 | symbol of state STATE-NUM. */ |
| 2306 | static const unsigned char yystos[] = |
| 2307 | { |
| 2308 | 0, 16, 17, 19, 20, 21, 27, 28, 46, 49, |
| 2309 | 53, 156, 158, 159, 160, 188, 189, 190, 192, 191, |
| 2310 | 47, 61, 197, 134, 52, 134, 15, 134, 37, 38, |
| 2311 | 39, 40, 41, 42, 43, 45, 133, 161, 162, 163, |
| 2312 | 0, 190, 41, 43, 164, 207, 37, 38, 39, 42, |
| 2313 | 165, 204, 206, 213, 134, 134, 140, 198, 19, 196, |
| 2314 | 7, 8, 10, 11, 12, 13, 14, 44, 137, 140, |
| 2315 | 143, 145, 156, 159, 177, 178, 210, 163, 163, 29, |
| 2316 | 30, 187, 163, 163, 18, 214, 215, 26, 146, 205, |
| 2317 | 214, 19, 19, 19, 199, 138, 4, 4, 4, 145, |
| 2318 | 10, 146, 178, 183, 136, 138, 187, 187, 11, 12, |
| 2319 | 13, 154, 155, 178, 184, 55, 56, 57, 58, 59, |
| 2320 | 60, 166, 202, 202, 158, 218, 135, 142, 34, 178, |
| 2321 | 179, 181, 182, 141, 141, 146, 183, 135, 146, 182, |
| 2322 | 184, 178, 23, 24, 3, 4, 5, 6, 9, 22, |
| 2323 | 35, 36, 68, 69, 70, 71, 72, 73, 74, 75, |
| 2324 | 76, 77, 78, 79, 80, 81, 82, 83, 84, 110, |
| 2325 | 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 2326 | 121, 122, 124, 126, 127, 128, 140, 143, 145, 147, |
| 2327 | 149, 150, 151, 185, 210, 193, 4, 10, 178, 180, |
| 2328 | 25, 145, 203, 32, 50, 51, 62, 63, 64, 65, |
| 2329 | 66, 67, 83, 84, 105, 106, 107, 110, 123, 124, |
| 2330 | 125, 126, 127, 128, 149, 150, 151, 216, 222, 223, |
| 2331 | 224, 225, 19, 168, 135, 139, 178, 178, 144, 146, |
| 2332 | 178, 139, 194, 195, 85, 86, 87, 88, 89, 90, |
| 2333 | 91, 92, 93, 94, 152, 23, 24, 91, 92, 93, |
| 2334 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
| 2335 | 104, 153, 138, 138, 138, 138, 138, 142, 184, 186, |
| 2336 | 145, 186, 146, 186, 19, 138, 138, 138, 135, 175, |
| 2337 | 159, 50, 10, 178, 212, 11, 14, 11, 154, 166, |
| 2338 | 152, 153, 178, 178, 212, 178, 178, 219, 212, 212, |
| 2339 | 212, 212, 212, 178, 178, 212, 166, 108, 109, 112, |
| 2340 | 113, 130, 131, 167, 34, 179, 170, 142, 144, 144, |
| 2341 | 170, 175, 175, 138, 138, 184, 184, 184, 184, 184, |
| 2342 | 135, 142, 146, 178, 186, 144, 146, 184, 184, 184, |
| 2343 | 31, 48, 173, 176, 138, 3, 4, 9, 22, 23, |
| 2344 | 24, 35, 36, 52, 143, 185, 209, 210, 211, 211, |
| 2345 | 211, 211, 180, 178, 178, 135, 172, 135, 172, 211, |
| 2346 | 140, 135, 135, 135, 135, 135, 135, 211, 211, 33, |
| 2347 | 180, 178, 212, 129, 167, 169, 184, 184, 221, 135, |
| 2348 | 135, 135, 135, 184, 144, 146, 135, 135, 33, 19, |
| 2349 | 4, 175, 34, 178, 200, 201, 54, 208, 186, 135, |
| 2350 | 135, 211, 211, 211, 11, 48, 11, 221, 211, 140, |
| 2351 | 212, 178, 212, 212, 212, 135, 135, 178, 211, 211, |
| 2352 | 135, 135, 135, 135, 139, 184, 184, 184, 184, 144, |
| 2353 | 184, 184, 178, 168, 135, 139, 19, 144, 14, 14, |
| 2354 | 138, 135, 135, 211, 4, 211, 135, 211, 135, 135, |
| 2355 | 135, 211, 211, 138, 178, 184, 184, 212, 135, 139, |
| 2356 | 135, 135, 139, 139, 139, 156, 157, 34, 178, 170, |
| 2357 | 135, 211, 211, 178, 220, 211, 211, 135, 172, 172, |
| 2358 | 211, 135, 212, 212, 212, 220, 211, 139, 139, 184, |
| 2359 | 184, 184, 168, 173, 174, 19, 135, 140, 211, 135, |
| 2360 | 139, 142, 211, 139, 139, 139, 139, 157, 48, 171, |
| 2361 | 14, 142, 154, 217, 168, 178, 170, 142, 170, 4, |
| 2362 | 211, 209, 142, 154, 211, 33, 135, 209, 168, 14, |
| 2363 | 14, 135, 211, 211, 14, 66, 211, 14, 211 |
| 2364 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2365 | |
| 2366 | #define yyerrok (yyerrstatus = 0) |
| 2367 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2368 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2369 | #define YYEOF 0 |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2370 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2371 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2372 | #define YYABORT goto yyabortlab |
| 2373 | #define YYERROR goto yyerrorlab |
| 2374 | |
| 2375 | |
| 2376 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2377 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2378 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2379 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2380 | #define YYFAIL goto yyerrlab |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2381 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2382 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2383 | |
| 2384 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2385 | do \ |
| 2386 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2387 | { \ |
| 2388 | yychar = (Token); \ |
| 2389 | yylval = (Value); \ |
| 2390 | yytoken = YYTRANSLATE (yychar); \ |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2391 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2392 | goto yybackup; \ |
| 2393 | } \ |
| 2394 | else \ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2395 | { \ |
| 2396 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2397 | YYERROR; \ |
| 2398 | } \ |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2399 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2400 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2401 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2402 | #define YYTERROR 1 |
| 2403 | #define YYERRCODE 256 |
| 2404 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2405 | |
| 2406 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2407 | If N is 0, then set CURRENT to the empty location which ends |
| 2408 | the previous symbol: RHS[0] (always defined). */ |
| 2409 | |
| 2410 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2411 | #ifndef YYLLOC_DEFAULT |
| 2412 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2413 | do \ |
| 2414 | if (N) \ |
| 2415 | { \ |
| 2416 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2417 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2418 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2419 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2420 | } \ |
| 2421 | else \ |
| 2422 | { \ |
| 2423 | (Current).first_line = (Current).last_line = \ |
| 2424 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2425 | (Current).first_column = (Current).last_column = \ |
| 2426 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2427 | } \ |
| 2428 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2429 | #endif |
| 2430 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2431 | |
| 2432 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2433 | This macro was not mandated originally: define only if we know |
| 2434 | we won't break user code: when these are the locations we know. */ |
| 2435 | |
| 2436 | #ifndef YY_LOCATION_PRINT |
| 2437 | # if YYLTYPE_IS_TRIVIAL |
| 2438 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2439 | fprintf (File, "%d.%d-%d.%d", \ |
| 2440 | (Loc).first_line, (Loc).first_column, \ |
| 2441 | (Loc).last_line, (Loc).last_column) |
| 2442 | # else |
| 2443 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2444 | # endif |
| 2445 | #endif |
| 2446 | |
| 2447 | |
| 2448 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2449 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2450 | #ifdef YYLEX_PARAM |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2451 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2452 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2453 | # define YYLEX yylex () |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2454 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2455 | |
| 2456 | /* Enable debugging if requested. */ |
| 2457 | #if YYDEBUG |
| 2458 | |
| 2459 | # ifndef YYFPRINTF |
| 2460 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2461 | # define YYFPRINTF fprintf |
| 2462 | # endif |
| 2463 | |
| 2464 | # define YYDPRINTF(Args) \ |
| 2465 | do { \ |
| 2466 | if (yydebug) \ |
| 2467 | YYFPRINTF Args; \ |
| 2468 | } while (0) |
| 2469 | |
| 2470 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2471 | do { \ |
| 2472 | if (yydebug) \ |
| 2473 | { \ |
| 2474 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2475 | yysymprint (stderr, \ |
| 2476 | Type, Value); \ |
| 2477 | YYFPRINTF (stderr, "\n"); \ |
| 2478 | } \ |
| 2479 | } while (0) |
| 2480 | |
| 2481 | /*------------------------------------------------------------------. |
| 2482 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2483 | | TOP (included). | |
| 2484 | `------------------------------------------------------------------*/ |
| 2485 | |
| 2486 | #if defined (__STDC__) || defined (__cplusplus) |
| 2487 | static void |
| 2488 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2489 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2490 | static void |
| 2491 | yy_stack_print (bottom, top) |
| 2492 | short int *bottom; |
| 2493 | short int *top; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2494 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2495 | { |
| 2496 | YYFPRINTF (stderr, "Stack now"); |
| 2497 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2498 | YYFPRINTF (stderr, " %d", *bottom); |
| 2499 | YYFPRINTF (stderr, "\n"); |
| 2500 | } |
| 2501 | |
| 2502 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2503 | do { \ |
| 2504 | if (yydebug) \ |
| 2505 | yy_stack_print ((Bottom), (Top)); \ |
| 2506 | } while (0) |
| 2507 | |
| 2508 | |
| 2509 | /*------------------------------------------------. |
| 2510 | | Report that the YYRULE is going to be reduced. | |
| 2511 | `------------------------------------------------*/ |
| 2512 | |
| 2513 | #if defined (__STDC__) || defined (__cplusplus) |
| 2514 | static void |
| 2515 | yy_reduce_print (int yyrule) |
| 2516 | #else |
| 2517 | static void |
| 2518 | yy_reduce_print (yyrule) |
| 2519 | int yyrule; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2520 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2521 | { |
| 2522 | int yyi; |
| 2523 | unsigned long int yylno = yyrline[yyrule]; |
| 2524 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2525 | yyrule - 1, yylno); |
| 2526 | /* Print the symbols being reduced, and their result. */ |
| 2527 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2528 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2529 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2530 | } |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2531 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2532 | # define YY_REDUCE_PRINT(Rule) \ |
| 2533 | do { \ |
| 2534 | if (yydebug) \ |
| 2535 | yy_reduce_print (Rule); \ |
| 2536 | } while (0) |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2537 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2538 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2539 | multiple parsers can coexist. */ |
| 2540 | int yydebug; |
| 2541 | #else /* !YYDEBUG */ |
| 2542 | # define YYDPRINTF(Args) |
| 2543 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2544 | # define YY_STACK_PRINT(Bottom, Top) |
| 2545 | # define YY_REDUCE_PRINT(Rule) |
| 2546 | #endif /* !YYDEBUG */ |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2547 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2548 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2549 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2550 | #ifndef YYINITDEPTH |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2551 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2552 | #endif |
| 2553 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2554 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2555 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2556 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2557 | Do not make this value too large; the results are undefined if |
| 2558 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2559 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2560 | |
| 2561 | #ifndef YYMAXDEPTH |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2562 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2563 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2564 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2565 | |
| 2566 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2567 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2568 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2569 | # ifndef yystrlen |
| 2570 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2571 | # define yystrlen strlen |
| 2572 | # else |
| 2573 | /* Return the length of YYSTR. */ |
| 2574 | static YYSIZE_T |
| 2575 | # if defined (__STDC__) || defined (__cplusplus) |
| 2576 | yystrlen (const char *yystr) |
| 2577 | # else |
| 2578 | yystrlen (yystr) |
| 2579 | const char *yystr; |
| 2580 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2581 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2582 | const char *yys = yystr; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2583 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2584 | while (*yys++ != '\0') |
| 2585 | continue; |
| 2586 | |
| 2587 | return yys - yystr - 1; |
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 | # endif |
| 2590 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2591 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2592 | # ifndef yystpcpy |
| 2593 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2594 | # define yystpcpy stpcpy |
| 2595 | # else |
| 2596 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2597 | YYDEST. */ |
| 2598 | static char * |
| 2599 | # if defined (__STDC__) || defined (__cplusplus) |
| 2600 | yystpcpy (char *yydest, const char *yysrc) |
| 2601 | # else |
| 2602 | yystpcpy (yydest, yysrc) |
| 2603 | char *yydest; |
| 2604 | const char *yysrc; |
| 2605 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2606 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2607 | char *yyd = yydest; |
| 2608 | const char *yys = yysrc; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2609 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2610 | while ((*yyd++ = *yys++) != '\0') |
| 2611 | continue; |
| 2612 | |
| 2613 | return yyd - 1; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2614 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2615 | # endif |
| 2616 | # endif |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2617 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2618 | # ifndef yytnamerr |
| 2619 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2620 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2621 | heuristic is that double-quoting is unnecessary unless the string |
| 2622 | contains an apostrophe, a comma, or backslash (other than |
| 2623 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2624 | null, do not copy; instead, return the length of what the result |
| 2625 | would have been. */ |
| 2626 | static YYSIZE_T |
| 2627 | yytnamerr (char *yyres, const char *yystr) |
| 2628 | { |
| 2629 | if (*yystr == '"') |
| 2630 | { |
| 2631 | size_t yyn = 0; |
| 2632 | char const *yyp = yystr; |
| 2633 | |
| 2634 | for (;;) |
| 2635 | switch (*++yyp) |
| 2636 | { |
| 2637 | case '\'': |
| 2638 | case ',': |
| 2639 | goto do_not_strip_quotes; |
| 2640 | |
| 2641 | case '\\': |
| 2642 | if (*++yyp != '\\') |
| 2643 | goto do_not_strip_quotes; |
| 2644 | /* Fall through. */ |
| 2645 | default: |
| 2646 | if (yyres) |
| 2647 | yyres[yyn] = *yyp; |
| 2648 | yyn++; |
| 2649 | break; |
| 2650 | |
| 2651 | case '"': |
| 2652 | if (yyres) |
| 2653 | yyres[yyn] = '\0'; |
| 2654 | return yyn; |
| 2655 | } |
| 2656 | do_not_strip_quotes: ; |
| 2657 | } |
| 2658 | |
| 2659 | if (! yyres) |
| 2660 | return yystrlen (yystr); |
| 2661 | |
| 2662 | return yystpcpy (yyres, yystr) - yyres; |
| 2663 | } |
| 2664 | # endif |
| 2665 | |
| 2666 | #endif /* YYERROR_VERBOSE */ |
| 2667 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2668 | |
| 2669 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2670 | #if YYDEBUG |
| 2671 | /*--------------------------------. |
| 2672 | | Print this symbol on YYOUTPUT. | |
| 2673 | `--------------------------------*/ |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2674 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2675 | #if defined (__STDC__) || defined (__cplusplus) |
| 2676 | static void |
| 2677 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2678 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2679 | static void |
| 2680 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2681 | FILE *yyoutput; |
| 2682 | int yytype; |
| 2683 | YYSTYPE *yyvaluep; |
| 2684 | #endif |
| 2685 | { |
| 2686 | /* Pacify ``unused variable'' warnings. */ |
| 2687 | (void) yyvaluep; |
| 2688 | |
| 2689 | if (yytype < YYNTOKENS) |
| 2690 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2691 | else |
| 2692 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2693 | |
| 2694 | |
| 2695 | # ifdef YYPRINT |
| 2696 | if (yytype < YYNTOKENS) |
| 2697 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2698 | # endif |
| 2699 | switch (yytype) |
| 2700 | { |
| 2701 | default: |
| 2702 | break; |
| 2703 | } |
| 2704 | YYFPRINTF (yyoutput, ")"); |
| 2705 | } |
| 2706 | |
| 2707 | #endif /* ! YYDEBUG */ |
| 2708 | /*-----------------------------------------------. |
| 2709 | | Release the memory associated to this symbol. | |
| 2710 | `-----------------------------------------------*/ |
| 2711 | |
| 2712 | #if defined (__STDC__) || defined (__cplusplus) |
| 2713 | static void |
| 2714 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2715 | #else |
| 2716 | static void |
| 2717 | yydestruct (yymsg, yytype, yyvaluep) |
| 2718 | const char *yymsg; |
| 2719 | int yytype; |
| 2720 | YYSTYPE *yyvaluep; |
| 2721 | #endif |
| 2722 | { |
| 2723 | /* Pacify ``unused variable'' warnings. */ |
| 2724 | (void) yyvaluep; |
| 2725 | |
| 2726 | if (!yymsg) |
| 2727 | yymsg = "Deleting"; |
| 2728 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2729 | |
| 2730 | switch (yytype) |
| 2731 | { |
| 2732 | |
| 2733 | default: |
| 2734 | break; |
| 2735 | } |
| 2736 | } |
| 2737 | |
| 2738 | |
| 2739 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2740 | |
| 2741 | #ifdef YYPARSE_PARAM |
| 2742 | # if defined (__STDC__) || defined (__cplusplus) |
| 2743 | int yyparse (void *YYPARSE_PARAM); |
| 2744 | # else |
| 2745 | int yyparse (); |
| 2746 | # endif |
| 2747 | #else /* ! YYPARSE_PARAM */ |
| 2748 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2749 | int yyparse (void); |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2750 | #else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2751 | int yyparse (); |
| 2752 | #endif |
| 2753 | #endif /* ! YYPARSE_PARAM */ |
| 2754 | |
| 2755 | |
| 2756 | |
| 2757 | /* The look-ahead symbol. */ |
| 2758 | int yychar; |
| 2759 | |
| 2760 | /* The semantic value of the look-ahead symbol. */ |
| 2761 | YYSTYPE yylval; |
| 2762 | |
| 2763 | /* Number of syntax errors so far. */ |
| 2764 | int yynerrs; |
| 2765 | |
| 2766 | |
| 2767 | |
| 2768 | /*----------. |
| 2769 | | yyparse. | |
| 2770 | `----------*/ |
| 2771 | |
| 2772 | #ifdef YYPARSE_PARAM |
| 2773 | # if defined (__STDC__) || defined (__cplusplus) |
| 2774 | int yyparse (void *YYPARSE_PARAM) |
| 2775 | # else |
| 2776 | int yyparse (YYPARSE_PARAM) |
| 2777 | void *YYPARSE_PARAM; |
| 2778 | # endif |
| 2779 | #else /* ! YYPARSE_PARAM */ |
| 2780 | #if defined (__STDC__) || defined (__cplusplus) |
| 2781 | int |
| 2782 | yyparse (void) |
| 2783 | #else |
| 2784 | int |
| 2785 | yyparse () |
| 2786 | |
| 2787 | #endif |
| 2788 | #endif |
| 2789 | { |
| 2790 | |
| 2791 | int yystate; |
| 2792 | int yyn; |
| 2793 | int yyresult; |
| 2794 | /* Number of tokens to shift before error messages enabled. */ |
| 2795 | int yyerrstatus; |
| 2796 | /* Look-ahead token as an internal (translated) token number. */ |
| 2797 | int yytoken = 0; |
| 2798 | |
| 2799 | /* Three stacks and their tools: |
| 2800 | `yyss': related to states, |
| 2801 | `yyvs': related to semantic values, |
| 2802 | `yyls': related to locations. |
| 2803 | |
| 2804 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2805 | to reallocate them elsewhere. */ |
| 2806 | |
| 2807 | /* The state stack. */ |
| 2808 | short int yyssa[YYINITDEPTH]; |
| 2809 | short int *yyss = yyssa; |
| 2810 | short int *yyssp; |
| 2811 | |
| 2812 | /* The semantic value stack. */ |
| 2813 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2814 | YYSTYPE *yyvs = yyvsa; |
| 2815 | YYSTYPE *yyvsp; |
| 2816 | |
| 2817 | |
| 2818 | |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2819 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2820 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2821 | YYSIZE_T yystacksize = YYINITDEPTH; |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2822 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2823 | /* The variables used to return semantic value and location from the |
| 2824 | action routines. */ |
| 2825 | YYSTYPE yyval; |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2826 | |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2827 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2828 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2829 | rule. */ |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2830 | int yylen; |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2831 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2832 | YYDPRINTF ((stderr, "Starting parse\n")); |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2833 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2834 | yystate = 0; |
| 2835 | yyerrstatus = 0; |
| 2836 | yynerrs = 0; |
| 2837 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2838 | |
| 2839 | /* Initialize stack pointers. |
| 2840 | Waste one element of value and location stack |
| 2841 | so that they stay on the same level as the state stack. |
| 2842 | The wasted elements are never initialized. */ |
| 2843 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2844 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2845 | yyvsp = yyvs; |
| 2846 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2847 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2848 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2849 | /*------------------------------------------------------------. |
| 2850 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2851 | `------------------------------------------------------------*/ |
| 2852 | yynewstate: |
| 2853 | /* In all cases, when you get here, the value and location stacks |
| 2854 | have just been pushed. so pushing a state here evens the stacks. |
| 2855 | */ |
| 2856 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2857 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2858 | yysetstate: |
| 2859 | *yyssp = yystate; |
| 2860 | |
| 2861 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2862 | { |
| 2863 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2864 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2865 | |
| 2866 | #ifdef yyoverflow |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2867 | { |
| 2868 | /* Give user a chance to reallocate the stack. Use copies of |
| 2869 | these so that the &'s don't force the real ones into |
| 2870 | memory. */ |
| 2871 | YYSTYPE *yyvs1 = yyvs; |
| 2872 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2873 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2874 | |
| 2875 | /* Each stack pointer address is followed by the size of the |
| 2876 | data in use in that stack, in bytes. This used to be a |
| 2877 | conditional around just the two extra args, but that might |
| 2878 | be undefined if yyoverflow is a macro. */ |
| 2879 | yyoverflow (YY_("memory exhausted"), |
| 2880 | &yyss1, yysize * sizeof (*yyssp), |
| 2881 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2882 | |
| 2883 | &yystacksize); |
| 2884 | |
| 2885 | yyss = yyss1; |
| 2886 | yyvs = yyvs1; |
| 2887 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2888 | #else /* no yyoverflow */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2889 | # ifndef YYSTACK_RELOCATE |
| 2890 | goto yyexhaustedlab; |
| 2891 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2892 | /* Extend the stack our own way. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2893 | if (YYMAXDEPTH <= yystacksize) |
| 2894 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2895 | yystacksize *= 2; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2896 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2897 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2898 | |
| 2899 | { |
| 2900 | short int *yyss1 = yyss; |
| 2901 | union yyalloc *yyptr = |
| 2902 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2903 | if (! yyptr) |
| 2904 | goto yyexhaustedlab; |
| 2905 | YYSTACK_RELOCATE (yyss); |
| 2906 | YYSTACK_RELOCATE (yyvs); |
| 2907 | |
| 2908 | # undef YYSTACK_RELOCATE |
| 2909 | if (yyss1 != yyssa) |
| 2910 | YYSTACK_FREE (yyss1); |
| 2911 | } |
| 2912 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2913 | #endif /* no yyoverflow */ |
| 2914 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2915 | yyssp = yyss + yysize - 1; |
| 2916 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2917 | |
| 2918 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2919 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2920 | (unsigned long int) yystacksize)); |
| 2921 | |
| 2922 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2923 | YYABORT; |
| 2924 | } |
| 2925 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2926 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2927 | |
| 2928 | goto yybackup; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2929 | |
| 2930 | /*-----------. |
| 2931 | | yybackup. | |
| 2932 | `-----------*/ |
| 2933 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2934 | |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2935 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2936 | /* 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] | 2937 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2938 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2939 | /* 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] | 2940 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2941 | yyn = yypact[yystate]; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2942 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2943 | goto yydefault; |
| 2944 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2945 | /* 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] | 2946 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2947 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2948 | if (yychar == YYEMPTY) |
| 2949 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2950 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2951 | yychar = YYLEX; |
| 2952 | } |
| 2953 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2954 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2955 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2956 | yychar = yytoken = YYEOF; |
| 2957 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2958 | } |
| 2959 | else |
| 2960 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2961 | yytoken = YYTRANSLATE (yychar); |
| 2962 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2963 | } |
| 2964 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2965 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 2966 | detect an error, take that action. */ |
| 2967 | yyn += yytoken; |
| 2968 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2969 | goto yydefault; |
| 2970 | yyn = yytable[yyn]; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2971 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2972 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2973 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2974 | goto yyerrlab; |
| 2975 | yyn = -yyn; |
| 2976 | goto yyreduce; |
| 2977 | } |
| 2978 | |
| 2979 | if (yyn == YYFINAL) |
| 2980 | YYACCEPT; |
| 2981 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2982 | /* Shift the look-ahead token. */ |
| 2983 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2984 | |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2985 | /* Discard the token being shifted unless it is eof. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2986 | if (yychar != YYEOF) |
| 2987 | yychar = YYEMPTY; |
| 2988 | |
Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2989 | *++yyvsp = yylval; |
| 2990 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2991 | |
| 2992 | /* Count tokens shifted since error; after three, turn off error |
| 2993 | status. */ |
| 2994 | if (yyerrstatus) |
| 2995 | yyerrstatus--; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2996 | |
| 2997 | yystate = yyn; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2998 | goto yynewstate; |
| 2999 | |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3000 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3001 | /*-----------------------------------------------------------. |
| 3002 | | yydefault -- do the default action for the current state. | |
| 3003 | `-----------------------------------------------------------*/ |
| 3004 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3005 | yyn = yydefact[yystate]; |
| 3006 | if (yyn == 0) |
| 3007 | goto yyerrlab; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3008 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3009 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3010 | |
| 3011 | /*-----------------------------. |
| 3012 | | yyreduce -- Do a reduction. | |
| 3013 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3014 | yyreduce: |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3015 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3016 | yylen = yyr2[yyn]; |
| 3017 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3018 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3019 | `$$ = $1'. |
| 3020 | |
| 3021 | Otherwise, the following line sets YYVAL to garbage. |
| 3022 | This behavior is undocumented and Bison |
| 3023 | users should not rely upon it. Assigning to YYVAL |
| 3024 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3025 | GCC warning that YYVAL may be used uninitialized. */ |
| 3026 | yyval = yyvsp[1-yylen]; |
| 3027 | |
| 3028 | |
| 3029 | YY_REDUCE_PRINT (yyn); |
| 3030 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3031 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3032 | case 29: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3033 | #line 1092 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3034 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3035 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3036 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3037 | case 30: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3038 | #line 1092 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3039 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3040 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3041 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3042 | case 31: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3043 | #line 1093 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3044 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3045 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3046 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3047 | case 32: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3048 | #line 1093 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3049 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3050 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3051 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3052 | case 33: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3053 | #line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3054 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3055 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3056 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3057 | case 34: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3058 | #line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3059 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3060 | break; |
| 3061 | |
| 3062 | case 35: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3063 | #line 1095 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3064 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3065 | break; |
| 3066 | |
| 3067 | case 36: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3068 | #line 1095 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3069 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3070 | break; |
| 3071 | |
| 3072 | case 37: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3073 | #line 1096 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3074 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3075 | break; |
| 3076 | |
| 3077 | case 38: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3078 | #line 1096 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3079 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3080 | break; |
| 3081 | |
| 3082 | case 39: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3083 | #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3084 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3085 | break; |
| 3086 | |
| 3087 | case 40: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3088 | #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3089 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3090 | break; |
| 3091 | |
| 3092 | case 41: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3093 | #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3094 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3095 | break; |
| 3096 | |
| 3097 | case 42: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3098 | #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3099 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3100 | break; |
| 3101 | |
| 3102 | case 43: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3103 | #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3104 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3105 | break; |
| 3106 | |
| 3107 | case 44: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3108 | #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3109 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3110 | break; |
| 3111 | |
| 3112 | case 45: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3113 | #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3114 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3115 | break; |
| 3116 | |
| 3117 | case 46: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3118 | #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3119 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3120 | break; |
| 3121 | |
| 3122 | case 47: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3123 | #line 1104 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3124 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3125 | break; |
| 3126 | |
| 3127 | case 48: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3128 | #line 1104 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3129 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3130 | break; |
| 3131 | |
| 3132 | case 49: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3133 | #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3134 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3135 | break; |
| 3136 | |
| 3137 | case 50: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3138 | #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3139 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3140 | break; |
| 3141 | |
| 3142 | case 51: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3143 | #line 1106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3144 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3145 | break; |
| 3146 | |
| 3147 | case 52: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3148 | #line 1106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3149 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3150 | break; |
| 3151 | |
| 3152 | case 53: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3153 | #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3154 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3155 | break; |
| 3156 | |
| 3157 | case 54: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3158 | #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3159 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3160 | break; |
| 3161 | |
| 3162 | case 61: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3163 | #line 1117 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3164 | { (yyval.StrVal) = 0; ;} |
| 3165 | break; |
| 3166 | |
| 3167 | case 62: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3168 | #line 1121 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3169 | { |
| 3170 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3171 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3172 | ;} |
| 3173 | break; |
| 3174 | |
| 3175 | case 63: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3176 | #line 1125 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3177 | { |
| 3178 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3179 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3180 | ;} |
| 3181 | break; |
| 3182 | |
| 3183 | case 66: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3184 | #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3185 | { |
| 3186 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3187 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3188 | ;} |
| 3189 | break; |
| 3190 | |
| 3191 | case 67: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3192 | #line 1136 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3193 | { |
| 3194 | (yyval.StrVal) = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3195 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3196 | ;} |
| 3197 | break; |
| 3198 | |
| 3199 | case 68: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3200 | #line 1142 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3201 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3202 | break; |
| 3203 | |
| 3204 | case 69: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3205 | #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3206 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3207 | break; |
| 3208 | |
| 3209 | case 70: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3210 | #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3211 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3212 | break; |
| 3213 | |
| 3214 | case 71: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3215 | #line 1145 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3216 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3217 | break; |
| 3218 | |
| 3219 | case 72: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3220 | #line 1146 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3221 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3222 | break; |
| 3223 | |
| 3224 | case 73: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3225 | #line 1150 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3226 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3227 | break; |
| 3228 | |
| 3229 | case 74: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3230 | #line 1151 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3231 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3232 | break; |
| 3233 | |
| 3234 | case 75: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3235 | #line 1152 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3236 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3237 | break; |
| 3238 | |
| 3239 | case 76: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3240 | #line 1156 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3241 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3242 | break; |
| 3243 | |
| 3244 | case 77: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3245 | #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3246 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3247 | break; |
| 3248 | |
| 3249 | case 78: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3250 | #line 1161 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3251 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3252 | break; |
| 3253 | |
| 3254 | case 79: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3255 | #line 1162 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3256 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3257 | break; |
| 3258 | |
| 3259 | case 80: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3260 | #line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3261 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3262 | break; |
| 3263 | |
| 3264 | case 81: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3265 | #line 1167 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3266 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3267 | break; |
| 3268 | |
| 3269 | case 82: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3270 | #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3271 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3272 | break; |
| 3273 | |
| 3274 | case 83: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3275 | #line 1169 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3276 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3277 | break; |
| 3278 | |
| 3279 | case 84: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3280 | #line 1170 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3281 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3282 | break; |
| 3283 | |
| 3284 | case 85: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3285 | #line 1171 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3286 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3287 | break; |
| 3288 | |
| 3289 | case 86: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3290 | #line 1174 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3291 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3292 | break; |
| 3293 | |
| 3294 | case 87: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3295 | #line 1175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3296 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3297 | break; |
| 3298 | |
| 3299 | case 88: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3300 | #line 1176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3301 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3302 | break; |
| 3303 | |
| 3304 | case 89: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3305 | #line 1177 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3306 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3307 | break; |
| 3308 | |
| 3309 | case 90: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3310 | #line 1178 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3311 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3312 | break; |
| 3313 | |
| 3314 | case 91: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3315 | #line 1179 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3316 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3317 | break; |
| 3318 | |
| 3319 | case 92: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3320 | #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3321 | { |
| 3322 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3323 | GEN_ERROR("Calling conv too large"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3324 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3325 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3326 | ;} |
| 3327 | break; |
| 3328 | |
| 3329 | case 93: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3330 | #line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3331 | { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;} |
| 3332 | break; |
| 3333 | |
| 3334 | case 94: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3335 | #line 1188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3336 | { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;} |
| 3337 | break; |
| 3338 | |
| 3339 | case 95: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3340 | #line 1189 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3341 | { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;} |
| 3342 | break; |
| 3343 | |
| 3344 | case 96: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3345 | #line 1190 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3346 | { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;} |
| 3347 | break; |
| 3348 | |
| 3349 | case 97: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3350 | #line 1193 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3351 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
| 3352 | break; |
| 3353 | |
| 3354 | case 98: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3355 | #line 1194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3356 | { |
| 3357 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3358 | ;} |
| 3359 | break; |
| 3360 | |
| 3361 | case 99: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3362 | #line 1199 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3363 | { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;} |
| 3364 | break; |
| 3365 | |
| 3366 | case 101: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3367 | #line 1203 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3368 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
| 3369 | break; |
| 3370 | |
| 3371 | case 102: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3372 | #line 1204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3373 | { |
| 3374 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3375 | ;} |
| 3376 | break; |
| 3377 | |
| 3378 | case 103: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +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 | { (yyval.UIntVal) = 0; ;} |
| 3381 | break; |
| 3382 | |
| 3383 | case 104: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3384 | #line 1212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3385 | { |
| 3386 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3387 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3388 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3389 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3390 | ;} |
| 3391 | break; |
| 3392 | |
| 3393 | case 105: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3394 | #line 1218 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3395 | { (yyval.UIntVal) = 0; ;} |
| 3396 | break; |
| 3397 | |
| 3398 | case 106: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3399 | #line 1219 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3400 | { |
| 3401 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3402 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3403 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3404 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3405 | ;} |
| 3406 | break; |
| 3407 | |
| 3408 | case 107: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3409 | #line 1227 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3410 | { |
| 3411 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3412 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3413 | GEN_ERROR("Invalid character in section name"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3414 | (yyval.StrVal) = (yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3415 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3416 | ;} |
| 3417 | break; |
| 3418 | |
| 3419 | case 108: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3420 | #line 1235 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3421 | { (yyval.StrVal) = 0; ;} |
| 3422 | break; |
| 3423 | |
| 3424 | case 109: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3425 | #line 1236 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3426 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3427 | break; |
| 3428 | |
| 3429 | case 110: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3430 | #line 1241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3431 | {;} |
| 3432 | break; |
| 3433 | |
| 3434 | case 111: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3435 | #line 1242 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3436 | {;} |
| 3437 | break; |
| 3438 | |
| 3439 | case 112: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3440 | #line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3441 | { |
| 3442 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3443 | free((yyvsp[0].StrVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3444 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3445 | ;} |
| 3446 | break; |
| 3447 | |
| 3448 | case 113: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3449 | #line 1248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3450 | { |
| 3451 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3452 | GEN_ERROR("Alignment must be a power of two"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3453 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3454 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3455 | ;} |
| 3456 | break; |
| 3457 | |
| 3458 | case 118: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3459 | #line 1264 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3460 | { |
| 3461 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3462 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3463 | ;} |
| 3464 | break; |
| 3465 | |
| 3466 | case 119: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3467 | #line 1268 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3468 | { |
| 3469 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3470 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3471 | ;} |
| 3472 | break; |
| 3473 | |
| 3474 | case 120: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3475 | #line 1272 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3476 | { // Pointer type? |
| 3477 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3478 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3479 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3480 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3481 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3482 | ;} |
| 3483 | break; |
| 3484 | |
| 3485 | case 121: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3486 | #line 1279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3487 | { // Named types are also simple types... |
| 3488 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3489 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3490 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 3491 | ;} |
| 3492 | break; |
| 3493 | |
| 3494 | case 122: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3495 | #line 1284 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3496 | { // Type UpReference |
| 3497 | 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] | 3498 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3499 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3500 | (yyval.TypeVal) = new PATypeHolder(OT); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3501 | UR_OUT("New Upreference!\n"); |
| 3502 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3503 | ;} |
| 3504 | break; |
| 3505 | |
| 3506 | case 123: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3507 | #line 1292 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3508 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3509 | std::vector<const Type*> Params; |
| 3510 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3511 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3512 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3513 | Params.push_back(I->Ty->get()); |
| 3514 | if (I->Ty->get() != Type::VoidTy) |
| 3515 | Attrs.push_back(I->Attrs); |
| 3516 | } |
| 3517 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3518 | if (isVarArg) Params.pop_back(); |
| 3519 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3520 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs); |
| 3521 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3522 | delete (yyvsp[-4].TypeVal); // Delete the return type handle |
| 3523 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3524 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3525 | ;} |
| 3526 | break; |
| 3527 | |
| 3528 | case 124: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3529 | #line 1310 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3530 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3531 | std::vector<const Type*> Params; |
| 3532 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3533 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3534 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3535 | Params.push_back(I->Ty->get()); |
| 3536 | if (I->Ty->get() != Type::VoidTy) |
| 3537 | Attrs.push_back(I->Attrs); |
| 3538 | } |
| 3539 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3540 | if (isVarArg) Params.pop_back(); |
| 3541 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3542 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs); |
| 3543 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3544 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3545 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3546 | ;} |
| 3547 | break; |
| 3548 | |
| 3549 | case 125: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3550 | #line 1328 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3551 | { // Sized array type? |
| 3552 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3553 | delete (yyvsp[-1].TypeVal); |
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 126: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3559 | #line 1333 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3560 | { // Vector type? |
| 3561 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3562 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3563 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3564 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 3565 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3566 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3567 | GEN_ERROR("Vector length should be a power of 2"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3568 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3569 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3570 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3571 | ;} |
| 3572 | break; |
| 3573 | |
| 3574 | case 127: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3575 | #line 1345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3576 | { // Structure type? |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3577 | std::vector<const Type*> Elements; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3578 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3579 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3580 | Elements.push_back(*I); |
| 3581 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3582 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3583 | delete (yyvsp[-1].TypeList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3584 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3585 | ;} |
| 3586 | break; |
| 3587 | |
| 3588 | case 128: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3589 | #line 1355 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3590 | { // Empty structure type? |
| 3591 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3592 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3593 | ;} |
| 3594 | break; |
| 3595 | |
| 3596 | case 129: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3597 | #line 1359 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3598 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3599 | std::vector<const Type*> Elements; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3600 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 3601 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3602 | Elements.push_back(*I); |
| 3603 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3604 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3605 | delete (yyvsp[-2].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3606 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3607 | ;} |
| 3608 | break; |
| 3609 | |
| 3610 | case 130: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3611 | #line 1369 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3612 | { // Empty structure type? |
| 3613 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3614 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3615 | ;} |
| 3616 | break; |
| 3617 | |
| 3618 | case 131: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3619 | #line 1376 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3620 | { |
| 3621 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3622 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3623 | ;} |
| 3624 | break; |
| 3625 | |
| 3626 | case 132: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3627 | #line 1383 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3628 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3629 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3630 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 3631 | if (!(*(yyvsp[0].TypeVal))->isFirstClassType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3632 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3633 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
| 3634 | ;} |
| 3635 | break; |
| 3636 | |
| 3637 | case 133: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3638 | #line 1390 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3639 | { |
| 3640 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 3641 | ;} |
| 3642 | break; |
| 3643 | |
| 3644 | case 134: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3645 | #line 1395 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3646 | { |
| 3647 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3648 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3649 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3650 | ;} |
| 3651 | break; |
| 3652 | |
| 3653 | case 135: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3654 | #line 1400 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3655 | { |
| 3656 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3657 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3658 | ;} |
| 3659 | break; |
| 3660 | |
| 3661 | case 137: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3662 | #line 1408 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3663 | { |
| 3664 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3665 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3666 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3667 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3668 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3669 | ;} |
| 3670 | break; |
| 3671 | |
| 3672 | case 138: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3673 | #line 1415 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3674 | { |
| 3675 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3676 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3677 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3678 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3679 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3680 | ;} |
| 3681 | break; |
| 3682 | |
| 3683 | case 139: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3684 | #line 1422 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3685 | { |
| 3686 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3687 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3688 | ;} |
| 3689 | break; |
| 3690 | |
| 3691 | case 140: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3692 | #line 1430 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3693 | { |
| 3694 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 3695 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
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 141: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3701 | #line 1435 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3702 | { |
| 3703 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3704 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3705 | ;} |
| 3706 | break; |
| 3707 | |
| 3708 | case 142: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3709 | #line 1446 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3710 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3711 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3712 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3713 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3714 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3715 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3716 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3717 | const Type *ETy = ATy->getElementType(); |
| 3718 | int NumElements = ATy->getNumElements(); |
| 3719 | |
| 3720 | // Verify that we have the correct size... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3721 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3722 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3723 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3724 | itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3725 | |
| 3726 | // Verify all elements are correct type! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3727 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3728 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3729 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3730 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3731 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3732 | } |
| 3733 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3734 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3735 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3736 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3737 | ;} |
| 3738 | break; |
| 3739 | |
| 3740 | case 143: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3741 | #line 1474 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3742 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3743 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3744 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3745 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3746 | if (ATy == 0) |
| 3747 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3748 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3749 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3750 | int NumElements = ATy->getNumElements(); |
| 3751 | if (NumElements != -1 && NumElements != 0) |
| 3752 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3753 | " arguments, but has size of " + itostr(NumElements) +""); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3754 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3755 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3756 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3757 | ;} |
| 3758 | break; |
| 3759 | |
| 3760 | case 144: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3761 | #line 1490 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3762 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3763 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3764 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3765 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3766 | if (ATy == 0) |
| 3767 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3768 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3769 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3770 | int NumElements = ATy->getNumElements(); |
| 3771 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3772 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 3773 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3774 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3775 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3776 | " when array has size " + itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3777 | std::vector<Constant*> Vals; |
| 3778 | if (ETy == Type::Int8Ty) { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3779 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3780 | C != (unsigned char*)EndStr; ++C) |
| 3781 | Vals.push_back(ConstantInt::get(ETy, *C)); |
| 3782 | } else { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3783 | free((yyvsp[0].StrVal)); |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3784 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3785 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3786 | free((yyvsp[0].StrVal)); |
| 3787 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3788 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3789 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3790 | ;} |
| 3791 | break; |
| 3792 | |
| 3793 | case 145: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3794 | #line 1519 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3795 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3796 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3797 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3798 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3799 | if (PTy == 0) |
| 3800 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3801 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3802 | const Type *ETy = PTy->getElementType(); |
| 3803 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3804 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3805 | // Verify that we have the correct size... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3806 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3807 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3808 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3809 | itostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3810 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3811 | // Verify all elements are correct type! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3812 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3813 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3814 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3815 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3816 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3817 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3818 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3819 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector)); |
| 3820 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3821 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3822 | ;} |
| 3823 | break; |
| 3824 | |
| 3825 | case 146: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3826 | #line 1547 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3827 | { |
| 3828 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3829 | if (STy == 0) |
| 3830 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3831 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3832 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3833 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3834 | GEN_ERROR("Illegal number of initializers for structure type"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3835 | |
| 3836 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3837 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
| 3838 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3839 | GEN_ERROR("Expected type '" + |
| 3840 | STy->getElementType(i)->getDescription() + |
| 3841 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3842 | " of structure initializer"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3843 | |
| 3844 | // Check to ensure that Type is not packed |
| 3845 | if (STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3846 | GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3847 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3848 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 3849 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3850 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3851 | ;} |
| 3852 | break; |
| 3853 | |
| 3854 | case 147: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3855 | #line 1572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3856 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3857 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3858 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3859 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3860 | if (STy == 0) |
| 3861 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3862 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3863 | |
| 3864 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3865 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3866 | |
| 3867 | // Check to ensure that Type is not packed |
| 3868 | if (STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3869 | GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3870 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3871 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3872 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3873 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3874 | ;} |
| 3875 | break; |
| 3876 | |
| 3877 | case 148: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3878 | #line 1591 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3879 | { |
| 3880 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3881 | if (STy == 0) |
| 3882 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3883 | (*(yyvsp[-5].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3884 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3885 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3886 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3887 | |
| 3888 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3889 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) |
| 3890 | if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3891 | GEN_ERROR("Expected type '" + |
| 3892 | STy->getElementType(i)->getDescription() + |
| 3893 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3894 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3895 | |
| 3896 | // Check to ensure that Type is packed |
| 3897 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3898 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 3899 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3900 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3901 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector)); |
| 3902 | delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3903 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3904 | ;} |
| 3905 | break; |
| 3906 | |
| 3907 | case 149: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3908 | #line 1617 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3909 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3910 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3911 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 3912 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3913 | if (STy == 0) |
| 3914 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3915 | (*(yyvsp[-4].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3916 | |
| 3917 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3918 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3919 | |
| 3920 | // Check to ensure that Type is packed |
| 3921 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3922 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 3923 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3924 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3925 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3926 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3927 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3928 | ;} |
| 3929 | break; |
| 3930 | |
| 3931 | case 150: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3932 | #line 1637 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3933 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3934 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3935 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3936 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3937 | if (PTy == 0) |
| 3938 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3939 | (*(yyvsp[-1].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3940 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3941 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 3942 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3943 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3944 | ;} |
| 3945 | break; |
| 3946 | |
| 3947 | case 151: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3948 | #line 1649 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3949 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3950 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3951 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3952 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 3953 | delete (yyvsp[-1].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +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 152: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3959 | #line 1656 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3960 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +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 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3964 | if (Ty == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3965 | GEN_ERROR("Global const reference must be a pointer type"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3966 | |
| 3967 | // ConstExprs can exist in the body of a function, thus creating |
| 3968 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3969 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3970 | // symbol table instead of the module symbol table for the global symbol, |
| 3971 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3972 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3973 | // |
| 3974 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3975 | CurFun.CurrentFunction = 0; |
| 3976 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 3977 | Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3978 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3979 | |
| 3980 | CurFun.CurrentFunction = SavedCurFn; |
| 3981 | |
| 3982 | // If this is an initializer for a constant pointer, which is referencing a |
| 3983 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3984 | // in the future with the right type of variable. |
| 3985 | // |
| 3986 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 3987 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3988 | const PointerType *PT = cast<PointerType>(Ty); |
| 3989 | |
| 3990 | // First check to see if the forward references value is already created! |
| 3991 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3992 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3993 | |
| 3994 | if (I != CurModule.GlobalRefs.end()) { |
| 3995 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3996 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3997 | } else { |
| 3998 | std::string Name; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3999 | if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName) |
| 4000 | Name = (yyvsp[0].ValIDVal).Name; |
| 4001 | else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4002 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4003 | |
| 4004 | // Create the forward referenced global. |
| 4005 | GlobalValue *GV; |
| 4006 | if (const FunctionType *FTy = |
| 4007 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 4008 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 4009 | CurModule.CurrentModule); |
| 4010 | } else { |
| 4011 | GV = new GlobalVariable(PT->getElementType(), false, |
| 4012 | GlobalValue::ExternalLinkage, 0, |
| 4013 | Name, CurModule.CurrentModule); |
| 4014 | } |
| 4015 | |
| 4016 | // 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] | 4017 | 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] | 4018 | V = GV; |
| 4019 | } |
| 4020 | } |
| 4021 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4022 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4023 | delete (yyvsp[-1].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4024 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4025 | ;} |
| 4026 | break; |
| 4027 | |
| 4028 | case 153: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4029 | #line 1722 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4030 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4031 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4032 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4033 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4034 | GEN_ERROR("Mismatched types for constant expression: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4035 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); |
| 4036 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 4037 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4038 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4039 | ;} |
| 4040 | break; |
| 4041 | |
| 4042 | case 154: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4043 | #line 1732 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4044 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4045 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4046 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4047 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4048 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4049 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4050 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4051 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4052 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4053 | ;} |
| 4054 | break; |
| 4055 | |
| 4056 | case 155: |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4057 | #line 1742 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4058 | { // integral constants |
| 4059 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4060 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4061 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4062 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4063 | ;} |
| 4064 | break; |
| 4065 | |
| 4066 | case 156: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4067 | #line 1748 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4068 | { // arbitrary precision integer constants |
| 4069 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4070 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
| 4071 | GEN_ERROR("Constant value does not fit in type"); |
Reid Spencer | 1079427 | 2007-03-01 19:41:47 +0000 | [diff] [blame] | 4072 | } |
| 4073 | (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth); |
| 4074 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4075 | delete (yyvsp[0].APIntVal); |
| 4076 | CHECK_FOR_ERROR |
| 4077 | ;} |
| 4078 | break; |
| 4079 | |
| 4080 | case 157: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4081 | #line 1758 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4082 | { // integral constants |
| 4083 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4084 | GEN_ERROR("Constant value doesn't fit in type"); |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4085 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4086 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4087 | ;} |
| 4088 | break; |
| 4089 | |
| 4090 | case 158: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4091 | #line 1764 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4092 | { // arbitrary precision integer constants |
| 4093 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); |
| 4094 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { |
| 4095 | GEN_ERROR("Constant value does not fit in type"); |
Reid Spencer | 1079427 | 2007-03-01 19:41:47 +0000 | [diff] [blame] | 4096 | } |
| 4097 | (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth); |
| 4098 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal)); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4099 | delete (yyvsp[0].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4100 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4101 | ;} |
| 4102 | break; |
| 4103 | |
| 4104 | case 159: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4105 | #line 1774 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4106 | { // Boolean constants |
| 4107 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4108 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4109 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4110 | ;} |
| 4111 | break; |
| 4112 | |
| 4113 | case 160: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4114 | #line 1779 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4115 | { // Boolean constants |
| 4116 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4117 | (yyval.ConstVal) = ConstantInt::getFalse(); |
| 4118 | CHECK_FOR_ERROR |
| 4119 | ;} |
| 4120 | break; |
| 4121 | |
| 4122 | case 161: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4123 | #line 1784 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4124 | { // Float & Double constants |
| 4125 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4126 | GEN_ERROR("Floating point constant invalid for type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4127 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4128 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4129 | ;} |
| 4130 | break; |
| 4131 | |
| 4132 | case 162: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4133 | #line 1792 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4134 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4135 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4136 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4137 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4138 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4139 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4140 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4141 | Val->getType()->getDescription() + "' to '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4142 | DestTy->getDescription() + "'"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4143 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
| 4144 | delete (yyvsp[-1].TypeVal); |
| 4145 | ;} |
| 4146 | break; |
| 4147 | |
| 4148 | case 163: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4149 | #line 1804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4150 | { |
| 4151 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4152 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4153 | |
| 4154 | const Type *IdxTy = |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4155 | 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] | 4156 | true); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4157 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4158 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4159 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4160 | SmallVector<Constant*, 8> IdxVec; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4161 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 4162 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4163 | IdxVec.push_back(C); |
| 4164 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4165 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4166 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4167 | delete (yyvsp[-1].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4168 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4169 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4170 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4171 | ;} |
| 4172 | break; |
| 4173 | |
| 4174 | case 164: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4175 | #line 1826 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4176 | { |
| 4177 | if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4178 | GEN_ERROR("Select condition must be of boolean type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4179 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4180 | GEN_ERROR("Select operand types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4181 | (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] | 4182 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4183 | ;} |
| 4184 | break; |
| 4185 | |
| 4186 | case 165: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4187 | #line 1834 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4188 | { |
| 4189 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4190 | GEN_ERROR("Binary operator types must match"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4191 | CHECK_FOR_ERROR; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4192 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4193 | ;} |
| 4194 | break; |
| 4195 | |
| 4196 | case 166: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4197 | #line 1840 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4198 | { |
| 4199 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4200 | GEN_ERROR("Logical operator types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4201 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) { |
| 4202 | if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) || |
| 4203 | !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4204 | GEN_ERROR("Logical operator requires integral operands"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4205 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4206 | (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] | 4207 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4208 | ;} |
| 4209 | break; |
| 4210 | |
| 4211 | case 167: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4212 | #line 1851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4213 | { |
| 4214 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4215 | GEN_ERROR("icmp operand types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4216 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4217 | ;} |
| 4218 | break; |
| 4219 | |
| 4220 | case 168: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4221 | #line 1856 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4222 | { |
| 4223 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4224 | GEN_ERROR("fcmp operand types must match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4225 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4226 | ;} |
| 4227 | break; |
| 4228 | |
| 4229 | case 169: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4230 | #line 1861 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4231 | { |
| 4232 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4233 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4234 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4235 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4236 | ;} |
| 4237 | break; |
| 4238 | |
| 4239 | case 170: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4240 | #line 1867 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4241 | { |
| 4242 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4243 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4244 | (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] | 4245 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4246 | ;} |
| 4247 | break; |
| 4248 | |
| 4249 | case 171: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4250 | #line 1873 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4251 | { |
| 4252 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4253 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4254 | (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] | 4255 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4256 | ;} |
| 4257 | break; |
| 4258 | |
| 4259 | case 172: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4260 | #line 1882 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4261 | { |
| 4262 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4263 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4264 | ;} |
| 4265 | break; |
| 4266 | |
| 4267 | case 173: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4268 | #line 1886 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4269 | { |
| 4270 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4271 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4272 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4273 | ;} |
| 4274 | break; |
| 4275 | |
| 4276 | case 174: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4277 | #line 1894 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4278 | { (yyval.BoolVal) = false; ;} |
| 4279 | break; |
| 4280 | |
| 4281 | case 175: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4282 | #line 1894 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4283 | { (yyval.BoolVal) = true; ;} |
| 4284 | break; |
| 4285 | |
| 4286 | case 176: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4287 | #line 1905 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4288 | { |
| 4289 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4290 | CurModule.ModuleDone(); |
| 4291 | CHECK_FOR_ERROR; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4292 | ;} |
| 4293 | break; |
| 4294 | |
| 4295 | case 177: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4296 | #line 1910 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4297 | { |
| 4298 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4299 | CurModule.ModuleDone(); |
| 4300 | CHECK_FOR_ERROR; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4301 | ;} |
| 4302 | break; |
| 4303 | |
| 4304 | case 180: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4305 | #line 1923 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4306 | { CurFun.isDeclare = false; ;} |
| 4307 | break; |
| 4308 | |
| 4309 | case 181: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4310 | #line 1923 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4311 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4312 | CurFun.FunctionDone(); |
| 4313 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4314 | ;} |
| 4315 | break; |
| 4316 | |
| 4317 | case 182: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4318 | #line 1927 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4319 | { CurFun.isDeclare = true; ;} |
| 4320 | break; |
| 4321 | |
| 4322 | case 183: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4323 | #line 1927 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4324 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4325 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4326 | ;} |
| 4327 | break; |
| 4328 | |
| 4329 | case 184: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4330 | #line 1930 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4331 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4332 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4333 | ;} |
| 4334 | break; |
| 4335 | |
| 4336 | case 185: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4337 | #line 1933 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4338 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4339 | // Emit an error if there are any unresolved types left. |
| 4340 | if (!CurModule.LateResolveTypes.empty()) { |
| 4341 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4342 | if (DID.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4343 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4344 | } else { |
| 4345 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4346 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4347 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4348 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4349 | ;} |
| 4350 | break; |
| 4351 | |
| 4352 | case 186: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4353 | #line 1945 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4354 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4355 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4356 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4357 | // Eagerly resolve types. This is not an optimization, this is a |
| 4358 | // requirement that is due to the fact that we could have this: |
| 4359 | // |
| 4360 | // %list = type { %list * } |
| 4361 | // %list = type { %list * } ; repeated type decl |
| 4362 | // |
| 4363 | // If types are not resolved eagerly, then the two types will not be |
| 4364 | // determined to be the same type! |
| 4365 | // |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4366 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4367 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4368 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4369 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4370 | // If this is a named type that is not a redefinition, add it to the slot |
| 4371 | // table. |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4372 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4373 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4374 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4375 | delete (yyvsp[0].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4376 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4377 | ;} |
| 4378 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4379 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4380 | case 187: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4381 | #line 1969 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4382 | { |
| 4383 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); |
| 4384 | |
| 4385 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4386 | CHECK_FOR_ERROR |
| 4387 | // If this is a named type that is not a redefinition, add it to the slot |
| 4388 | // table. |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4389 | CurModule.Types.push_back((yyvsp[0].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4390 | } |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4391 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4392 | ;} |
| 4393 | break; |
| 4394 | |
| 4395 | case 188: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4396 | #line 1980 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4397 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4398 | /* "Externally Visible" Linkage */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4399 | if ((yyvsp[0].ConstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4400 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4401 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, |
| 4402 | (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] | 4403 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4404 | ;} |
| 4405 | break; |
| 4406 | |
| 4407 | case 189: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4408 | #line 1987 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4409 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4410 | CurGV = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4411 | ;} |
| 4412 | break; |
| 4413 | |
| 4414 | case 190: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4415 | #line 1990 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4416 | { |
| 4417 | if ((yyvsp[0].ConstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4418 | GEN_ERROR("Global value initializer is not a constant"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4419 | 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] | 4420 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4421 | ;} |
| 4422 | break; |
| 4423 | |
| 4424 | case 191: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4425 | #line 1995 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4426 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4427 | CurGV = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4428 | ;} |
| 4429 | break; |
| 4430 | |
| 4431 | case 192: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4432 | #line 1998 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4433 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4434 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4435 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 4436 | 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] | 4437 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4438 | delete (yyvsp[0].TypeVal); |
| 4439 | ;} |
| 4440 | break; |
| 4441 | |
| 4442 | case 193: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4443 | #line 2004 "/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 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4446 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4447 | ;} |
| 4448 | break; |
| 4449 | |
| 4450 | case 194: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4451 | #line 2008 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4452 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4453 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4454 | ;} |
| 4455 | break; |
| 4456 | |
| 4457 | case 195: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4458 | #line 2011 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4459 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4460 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4461 | ;} |
| 4462 | break; |
| 4463 | |
| 4464 | case 196: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4465 | #line 2017 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4466 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4467 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4468 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4469 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4470 | free((yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4471 | |
| 4472 | if (AsmSoFar.empty()) |
| 4473 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4474 | else |
| 4475 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4476 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4477 | ;} |
| 4478 | break; |
| 4479 | |
| 4480 | case 197: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4481 | #line 2030 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4482 | { |
| 4483 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4484 | free((yyvsp[0].StrVal)); |
| 4485 | ;} |
| 4486 | break; |
| 4487 | |
| 4488 | case 198: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4489 | #line 2034 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4490 | { |
| 4491 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4492 | free((yyvsp[0].StrVal)); |
| 4493 | ;} |
| 4494 | break; |
| 4495 | |
| 4496 | case 200: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4497 | #line 2041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4498 | { |
| 4499 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4500 | free((yyvsp[0].StrVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4501 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4502 | ;} |
| 4503 | break; |
| 4504 | |
| 4505 | case 201: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4506 | #line 2046 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4507 | { |
| 4508 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4509 | free((yyvsp[0].StrVal)); |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 4510 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4511 | ;} |
| 4512 | break; |
| 4513 | |
| 4514 | case 202: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4515 | #line 2051 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4516 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4517 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4518 | ;} |
| 4519 | break; |
| 4520 | |
| 4521 | case 203: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4522 | #line 2060 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4523 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4524 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4525 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4526 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4527 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4528 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4529 | (yyval.ArgList) = (yyvsp[-4].ArgList); |
| 4530 | (yyvsp[-4].ArgList)->push_back(E); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4531 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4532 | ;} |
| 4533 | break; |
| 4534 | |
| 4535 | case 204: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4536 | #line 2070 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4537 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4538 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4539 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4540 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4541 | GEN_ERROR("void typed arguments are invalid"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4542 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4543 | (yyval.ArgList) = new ArgListType; |
| 4544 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4545 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4546 | ;} |
| 4547 | break; |
| 4548 | |
| 4549 | case 205: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4550 | #line 2081 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4551 | { |
| 4552 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4553 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4554 | ;} |
| 4555 | break; |
| 4556 | |
| 4557 | case 206: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4558 | #line 2085 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4559 | { |
| 4560 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4561 | struct ArgListEntry E; |
| 4562 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4563 | E.Name = 0; |
| 4564 | E.Attrs = FunctionType::NoAttributeSet; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4565 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4566 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4567 | ;} |
| 4568 | break; |
| 4569 | |
| 4570 | case 207: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4571 | #line 2094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4572 | { |
| 4573 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4574 | struct ArgListEntry E; |
| 4575 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4576 | E.Name = 0; |
| 4577 | E.Attrs = FunctionType::NoAttributeSet; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4578 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4579 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4580 | ;} |
| 4581 | break; |
| 4582 | |
| 4583 | case 208: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4584 | #line 2103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4585 | { |
| 4586 | (yyval.ArgList) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4587 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4588 | ;} |
| 4589 | break; |
| 4590 | |
| 4591 | case 209: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4592 | #line 2109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4593 | { |
| 4594 | UnEscapeLexed((yyvsp[-6].StrVal)); |
| 4595 | std::string FunctionName((yyvsp[-6].StrVal)); |
| 4596 | free((yyvsp[-6].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4597 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4598 | // Check the function result for abstractness if this is a define. We should |
| 4599 | // have no abstract types at this point |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4600 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal))) |
| 4601 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4602 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4603 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4604 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4605 | ParamAttrs.push_back((yyvsp[-2].ParamAttrs)); |
| 4606 | if ((yyvsp[-4].ArgList)) { // If there are arguments... |
| 4607 | 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] | 4608 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4609 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4610 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4611 | ParamTypeList.push_back(Ty); |
| 4612 | if (Ty != Type::VoidTy) |
| 4613 | ParamAttrs.push_back(I->Attrs); |
| 4614 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4615 | } |
| 4616 | |
| 4617 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4618 | if (isVarArg) ParamTypeList.pop_back(); |
| 4619 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4620 | FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4621 | ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4622 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4623 | delete (yyvsp[-7].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4624 | |
| 4625 | ValID ID; |
| 4626 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4627 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4628 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4629 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4630 | } |
| 4631 | |
| 4632 | Function *Fn = 0; |
| 4633 | // See if this function was forward referenced. If so, recycle the object. |
| 4634 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4635 | // Move the function to the end of the list, from whereever it was |
| 4636 | // previously inserted. |
| 4637 | Fn = cast<Function>(FWRef); |
| 4638 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4639 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4640 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4641 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
| 4642 | if (Fn->getFunctionType() != FT ) { |
| 4643 | // The existing function doesn't have the same type. This is an overload |
| 4644 | // error. |
| 4645 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
| 4646 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
| 4647 | // Neither the existing or the current function is a declaration and they |
| 4648 | // have the same name and same type. Clearly this is a redefinition. |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4649 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4650 | } if (Fn->isDeclaration()) { |
| 4651 | // 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] | 4652 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4653 | AI != AE; ++AI) |
| 4654 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4655 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4656 | } else { // Not already defined? |
| 4657 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4658 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4659 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4660 | InsertValue(Fn, CurModule.Values); |
| 4661 | } |
| 4662 | |
| 4663 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4664 | |
| 4665 | if (CurFun.isDeclare) { |
| 4666 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4667 | // correctly handle cases, when pointer to function is passed as argument to |
| 4668 | // another function. |
| 4669 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4670 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4671 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4672 | Fn->setCallingConv((yyvsp[-8].UIntVal)); |
| 4673 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4674 | if ((yyvsp[-1].StrVal)) { |
| 4675 | Fn->setSection((yyvsp[-1].StrVal)); |
| 4676 | free((yyvsp[-1].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4677 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4678 | |
| 4679 | // Add all of the arguments we parsed to the function... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4680 | if ((yyvsp[-4].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4681 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4682 | 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] | 4683 | "Not a varargs marker!"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4684 | delete (yyvsp[-4].ArgList)->back().Ty; |
| 4685 | (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4686 | } |
| 4687 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4688 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4689 | unsigned Idx = 1; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4690 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); |
| 4691 | I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4692 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4693 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4694 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4695 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4696 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4697 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4698 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4699 | delete (yyvsp[-4].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4700 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4701 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4702 | ;} |
| 4703 | break; |
| 4704 | |
| 4705 | case 212: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4706 | #line 2222 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4707 | { |
| 4708 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4709 | |
| 4710 | // Make sure that we keep track of the linkage type even if there was a |
| 4711 | // previous "declare". |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4712 | (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage)); |
| 4713 | (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility)); |
| 4714 | ;} |
| 4715 | break; |
| 4716 | |
| 4717 | case 215: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4718 | #line 2233 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4719 | { |
| 4720 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4721 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4722 | ;} |
| 4723 | break; |
| 4724 | |
| 4725 | case 216: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4726 | #line 2238 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4727 | { |
| 4728 | CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); |
| 4729 | CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); |
| 4730 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4731 | CurFun.FunctionDone(); |
| 4732 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4733 | ;} |
| 4734 | break; |
| 4735 | |
| 4736 | case 217: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4737 | #line 2250 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4738 | { |
| 4739 | (yyval.BoolVal) = false; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4740 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4741 | ;} |
| 4742 | break; |
| 4743 | |
| 4744 | case 218: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4745 | #line 2254 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4746 | { |
| 4747 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4748 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4749 | ;} |
| 4750 | break; |
| 4751 | |
| 4752 | case 219: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4753 | #line 2259 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4754 | { // A reference to a direct constant |
| 4755 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4756 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4757 | ;} |
| 4758 | break; |
| 4759 | |
| 4760 | case 220: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4761 | #line 2263 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4762 | { |
| 4763 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4764 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4765 | ;} |
| 4766 | break; |
| 4767 | |
| 4768 | case 221: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4769 | #line 2267 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4770 | { // Perhaps it's an FP constant? |
| 4771 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4772 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4773 | ;} |
| 4774 | break; |
| 4775 | |
| 4776 | case 222: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4777 | #line 2271 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4778 | { |
| 4779 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4780 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4781 | ;} |
| 4782 | break; |
| 4783 | |
| 4784 | case 223: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4785 | #line 2275 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4786 | { |
| 4787 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4788 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4789 | ;} |
| 4790 | break; |
| 4791 | |
| 4792 | case 224: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4793 | #line 2279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4794 | { |
| 4795 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4796 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4797 | ;} |
| 4798 | break; |
| 4799 | |
| 4800 | case 225: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4801 | #line 2283 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4802 | { |
| 4803 | (yyval.ValIDVal) = ValID::createUndef(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4804 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4805 | ;} |
| 4806 | break; |
| 4807 | |
| 4808 | case 226: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4809 | #line 2287 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4810 | { // A vector zero constant. |
| 4811 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4812 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4813 | ;} |
| 4814 | break; |
| 4815 | |
| 4816 | case 227: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4817 | #line 2291 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4818 | { // Nonempty unsized packed vector |
| 4819 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
| 4820 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4821 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 4822 | VectorType* pt = VectorType::get(ETy, NumElements); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4823 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4824 | HandleUpRefs( |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 4825 | VectorType::get( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4826 | ETy, |
| 4827 | NumElements) |
| 4828 | ) |
| 4829 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4830 | |
| 4831 | // Verify all elements are correct type! |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4832 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4833 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4834 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4835 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4836 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4837 | } |
| 4838 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4839 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector))); |
| 4840 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4841 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4842 | ;} |
| 4843 | break; |
| 4844 | |
| 4845 | case 228: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4846 | #line 2316 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4847 | { |
| 4848 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4849 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4850 | ;} |
| 4851 | break; |
| 4852 | |
| 4853 | case 229: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4854 | #line 2320 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4855 | { |
| 4856 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 4857 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 4858 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4859 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 4860 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 4861 | free((yyvsp[-2].StrVal)); |
| 4862 | free((yyvsp[0].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4863 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4864 | ;} |
| 4865 | break; |
| 4866 | |
| 4867 | case 230: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4868 | #line 2334 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4869 | { // Is it an integer reference...? |
| 4870 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4871 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4872 | ;} |
| 4873 | break; |
| 4874 | |
| 4875 | case 231: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4876 | #line 2338 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4877 | { |
| 4878 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4879 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4880 | ;} |
| 4881 | break; |
| 4882 | |
| 4883 | case 232: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4884 | #line 2342 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4885 | { // Is it a named reference...? |
| 4886 | (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4887 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4888 | ;} |
| 4889 | break; |
| 4890 | |
| 4891 | case 233: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4892 | #line 2346 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4893 | { // Is it a named reference...? |
| 4894 | (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4895 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4896 | ;} |
| 4897 | break; |
| 4898 | |
| 4899 | case 236: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4900 | #line 2358 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4901 | { |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4902 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4903 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4904 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
| 4905 | delete (yyvsp[-1].TypeVal); |
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 237: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4911 | #line 2367 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4912 | { |
| 4913 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4914 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4915 | ;} |
| 4916 | break; |
| 4917 | |
| 4918 | case 238: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4919 | #line 2371 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4920 | { // Do not allow functions with 0 basic blocks |
| 4921 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4922 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4923 | ;} |
| 4924 | break; |
| 4925 | |
| 4926 | case 239: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4927 | #line 2380 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4928 | { |
| 4929 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4930 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4931 | InsertValue((yyvsp[0].TermInstVal)); |
| 4932 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4933 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4934 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4935 | ;} |
| 4936 | break; |
| 4937 | |
| 4938 | case 240: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4939 | #line 2389 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4940 | { |
| 4941 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4942 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4943 | if (CI2->getParent() == 0) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4944 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
| 4945 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 4946 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4947 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4948 | ;} |
| 4949 | break; |
| 4950 | |
| 4951 | case 241: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4952 | #line 2398 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4953 | { // Empty space between instruction lists |
| 4954 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4955 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4956 | ;} |
| 4957 | break; |
| 4958 | |
| 4959 | case 242: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4960 | #line 2402 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4961 | { // Labelled (named) basic block |
| 4962 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal))); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4963 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4964 | ;} |
| 4965 | break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4966 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4967 | case 243: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4968 | #line 2407 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4969 | { // Return with a result... |
| 4970 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
| 4971 | CHECK_FOR_ERROR |
| 4972 | ;} |
| 4973 | break; |
| 4974 | |
| 4975 | case 244: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4976 | #line 2411 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4977 | { // Return with no result... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4978 | (yyval.TermInstVal) = new ReturnInst(); |
| 4979 | CHECK_FOR_ERROR |
| 4980 | ;} |
| 4981 | break; |
| 4982 | |
| 4983 | case 245: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4984 | #line 2415 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4985 | { // Unconditional Branch... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4986 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4987 | CHECK_FOR_ERROR |
| 4988 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 4989 | ;} |
| 4990 | break; |
| 4991 | |
| 4992 | case 246: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 4993 | #line 2420 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4994 | { |
| 4995 | assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4996 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 4997 | CHECK_FOR_ERROR |
| 4998 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4999 | CHECK_FOR_ERROR |
| 5000 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); |
| 5001 | CHECK_FOR_ERROR |
| 5002 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 5003 | ;} |
| 5004 | break; |
| 5005 | |
| 5006 | case 247: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5007 | #line 2430 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5008 | { |
| 5009 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
| 5010 | CHECK_FOR_ERROR |
| 5011 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 5012 | CHECK_FOR_ERROR |
| 5013 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 5014 | (yyval.TermInstVal) = S; |
| 5015 | |
| 5016 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 5017 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5018 | for (; I != E; ++I) { |
| 5019 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5020 | S->addCase(CI, I->second); |
| 5021 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5022 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5023 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5024 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5025 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5026 | ;} |
| 5027 | break; |
| 5028 | |
| 5029 | case 248: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5030 | #line 2449 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5031 | { |
| 5032 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5033 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5034 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5035 | CHECK_FOR_ERROR |
| 5036 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5037 | (yyval.TermInstVal) = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5038 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5039 | ;} |
| 5040 | break; |
| 5041 | |
| 5042 | case 249: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5043 | #line 2459 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5044 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5045 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5046 | // Handle the short syntax |
| 5047 | const PointerType *PFTy = 0; |
| 5048 | const FunctionType *Ty = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5049 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5050 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5051 | // Pull out the types of all of the arguments... |
| 5052 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5053 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5054 | ParamAttrs.push_back((yyvsp[-6].ParamAttrs)); |
| 5055 | 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] | 5056 | const Type *Ty = I->Val->getType(); |
| 5057 | if (Ty == Type::VoidTy) |
| 5058 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5059 | ParamTypes.push_back(Ty); |
| 5060 | ParamAttrs.push_back(I->Attrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5061 | } |
| 5062 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5063 | Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5064 | PFTy = PointerType::get(Ty); |
| 5065 | } |
| 5066 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5067 | 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] | 5068 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5069 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5070 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5071 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5072 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5073 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5074 | // Check the arguments |
| 5075 | ValueList Args; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5076 | if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5077 | // Make sure no arguments is a good thing! |
| 5078 | if (Ty->getNumParams() != 0) |
| 5079 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5080 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5081 | } else { // Has arguments? |
| 5082 | // Loop through FunctionType's arguments and ensure they are specified |
| 5083 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5084 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5085 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5086 | ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5087 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5088 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5089 | if (ArgI->Val->getType() != *I) |
| 5090 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5091 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5092 | Args.push_back(ArgI->Val); |
| 5093 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5094 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5095 | if (Ty->isVarArg()) { |
| 5096 | if (I == E) |
| 5097 | for (; ArgI != ArgE; ++ArgI) |
| 5098 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5099 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5100 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5101 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5102 | |
| 5103 | // Create the InvokeInst |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5104 | InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size()); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5105 | II->setCallingConv((yyvsp[-12].UIntVal)); |
| 5106 | (yyval.TermInstVal) = II; |
| 5107 | delete (yyvsp[-8].ValueRefList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5108 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5109 | ;} |
| 5110 | break; |
| 5111 | |
| 5112 | case 250: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5113 | #line 2525 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5114 | { |
| 5115 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5116 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5117 | ;} |
| 5118 | break; |
| 5119 | |
| 5120 | case 251: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5121 | #line 2529 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5122 | { |
| 5123 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5124 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5125 | ;} |
| 5126 | break; |
| 5127 | |
| 5128 | case 252: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5129 | #line 2536 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5130 | { |
| 5131 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5132 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5133 | CHECK_FOR_ERROR |
| 5134 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5135 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5136 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5137 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5138 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5139 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5140 | ;} |
| 5141 | break; |
| 5142 | |
| 5143 | case 253: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5144 | #line 2547 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5145 | { |
| 5146 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5147 | Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5148 | CHECK_FOR_ERROR |
| 5149 | |
| 5150 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5151 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5152 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5153 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5154 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5155 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5156 | ;} |
| 5157 | break; |
| 5158 | |
| 5159 | case 254: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5160 | #line 2560 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5161 | { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5162 | // Is this definition named?? if so, assign the name... |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5163 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5164 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5165 | InsertValue((yyvsp[0].InstVal)); |
| 5166 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5167 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5168 | ;} |
| 5169 | break; |
| 5170 | |
| 5171 | case 255: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5172 | #line 2570 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5173 | { // Used for PHI nodes |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5174 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5175 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); |
| 5176 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5177 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5178 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5179 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5180 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5181 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5182 | delete (yyvsp[-5].TypeVal); |
| 5183 | ;} |
| 5184 | break; |
| 5185 | |
| 5186 | case 256: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5187 | #line 2581 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5188 | { |
| 5189 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5190 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +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)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5193 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5194 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5195 | ;} |
| 5196 | break; |
| 5197 | |
| 5198 | case 257: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5199 | #line 2591 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5200 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5201 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5202 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5203 | // Used for call and invoke instructions |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5204 | (yyval.ValueRefList) = new ValueRefList(); |
| 5205 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5206 | (yyval.ValueRefList)->push_back(E); |
| 5207 | ;} |
| 5208 | break; |
| 5209 | |
| 5210 | case 258: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5211 | #line 2599 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5212 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5213 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5214 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5215 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); |
| 5216 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5217 | (yyval.ValueRefList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5218 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5219 | ;} |
| 5220 | break; |
| 5221 | |
| 5222 | case 259: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5223 | #line 2607 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5224 | { (yyval.ValueRefList) = new ValueRefList(); ;} |
| 5225 | break; |
| 5226 | |
| 5227 | case 260: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5228 | #line 2610 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5229 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5230 | break; |
| 5231 | |
| 5232 | case 261: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5233 | #line 2611 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5234 | { |
| 5235 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5236 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5237 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5238 | ;} |
| 5239 | break; |
| 5240 | |
| 5241 | case 262: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5242 | #line 2618 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5243 | { |
| 5244 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5245 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5246 | ;} |
| 5247 | break; |
| 5248 | |
| 5249 | case 263: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5250 | #line 2622 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5251 | { |
| 5252 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5253 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5254 | ;} |
| 5255 | break; |
| 5256 | |
| 5257 | case 264: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5258 | #line 2627 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5259 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5260 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5261 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5262 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5263 | !isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5264 | GEN_ERROR( |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5265 | "Arithmetic operator requires integer, FP, or packed operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5266 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5267 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5268 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5269 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5270 | GEN_ERROR("Remainder not supported on vector types"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5271 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5272 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5273 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5274 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5275 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
| 5276 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5277 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5278 | delete (yyvsp[-3].TypeVal); |
| 5279 | ;} |
| 5280 | break; |
| 5281 | |
| 5282 | case 265: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5283 | #line 2648 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5284 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5285 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5286 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5287 | if (!(*(yyvsp[-3].TypeVal))->isInteger()) { |
| 5288 | if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) || |
| 5289 | !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5290 | GEN_ERROR("Logical operator requires integral operands"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5291 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5292 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5293 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5294 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5295 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5296 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
| 5297 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5298 | GEN_ERROR("binary operator returned null"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5299 | delete (yyvsp[-3].TypeVal); |
| 5300 | ;} |
| 5301 | break; |
| 5302 | |
| 5303 | case 266: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5304 | #line 2665 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5305 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5306 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5307 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5308 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5309 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5310 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5311 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5312 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5313 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5314 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5315 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5316 | GEN_ERROR("icmp operator returned null"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5317 | ;} |
| 5318 | break; |
| 5319 | |
| 5320 | case 267: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5321 | #line 2678 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5322 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5323 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5324 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5325 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5326 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5327 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].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 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5330 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5331 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5332 | if ((yyval.InstVal) == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5333 | GEN_ERROR("fcmp operator returned null"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5334 | ;} |
| 5335 | break; |
| 5336 | |
| 5337 | case 268: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5338 | #line 2691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5339 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5340 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5341 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5342 | Value* Val = (yyvsp[-2].ValueVal); |
| 5343 | const Type* DestTy = (yyvsp[0].TypeVal)->get(); |
| 5344 | if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5345 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5346 | Val->getType()->getDescription() + "' to '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5347 | DestTy->getDescription() + "'"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5348 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy); |
| 5349 | delete (yyvsp[0].TypeVal); |
| 5350 | ;} |
| 5351 | break; |
| 5352 | |
| 5353 | case 269: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5354 | #line 2703 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5355 | { |
| 5356 | if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5357 | GEN_ERROR("select condition must be boolean"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5358 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5359 | GEN_ERROR("select value types should match"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5360 | (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] | 5361 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5362 | ;} |
| 5363 | break; |
| 5364 | |
| 5365 | case 270: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5366 | #line 2711 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5367 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5368 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5369 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5370 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5371 | delete (yyvsp[0].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5372 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5373 | ;} |
| 5374 | break; |
| 5375 | |
| 5376 | case 271: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5377 | #line 2718 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5378 | { |
| 5379 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5380 | GEN_ERROR("Invalid extractelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5381 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5382 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5383 | ;} |
| 5384 | break; |
| 5385 | |
| 5386 | case 272: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5387 | #line 2724 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5388 | { |
| 5389 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5390 | GEN_ERROR("Invalid insertelement operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5391 | (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] | 5392 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5393 | ;} |
| 5394 | break; |
| 5395 | |
| 5396 | case 273: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5397 | #line 2730 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5398 | { |
| 5399 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5400 | GEN_ERROR("Invalid shufflevector operands"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5401 | (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] | 5402 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5403 | ;} |
| 5404 | break; |
| 5405 | |
| 5406 | case 274: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5407 | #line 2736 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5408 | { |
| 5409 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5410 | if (!Ty->isFirstClassType()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5411 | GEN_ERROR("PHI node operands must be of first class type"); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5412 | (yyval.InstVal) = new PHINode(Ty); |
| 5413 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5414 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5415 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5416 | 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] | 5417 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5418 | (yyvsp[0].PHIList)->pop_front(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5419 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5420 | delete (yyvsp[0].PHIList); // Free the list... |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5421 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5422 | ;} |
| 5423 | break; |
| 5424 | |
| 5425 | case 275: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5426 | #line 2752 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5427 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5428 | |
| 5429 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5430 | const PointerType *PFTy = 0; |
| 5431 | const FunctionType *Ty = 0; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5432 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5433 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5434 | // Pull out the types of all of the arguments... |
| 5435 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5436 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5437 | ParamAttrs.push_back((yyvsp[0].ParamAttrs)); |
| 5438 | 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] | 5439 | const Type *Ty = I->Val->getType(); |
| 5440 | if (Ty == Type::VoidTy) |
| 5441 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5442 | ParamTypes.push_back(Ty); |
| 5443 | ParamAttrs.push_back(I->Attrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5444 | } |
| 5445 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5446 | Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5447 | PFTy = PointerType::get(Ty); |
| 5448 | } |
| 5449 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5450 | 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] | 5451 | CHECK_FOR_ERROR |
| 5452 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5453 | // Check the arguments |
| 5454 | ValueList Args; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5455 | if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5456 | // Make sure no arguments is a good thing! |
| 5457 | if (Ty->getNumParams() != 0) |
| 5458 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5459 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5460 | } else { // Has arguments? |
| 5461 | // Loop through FunctionType's arguments and ensure they are specified |
| 5462 | // correctly! |
| 5463 | // |
| 5464 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5465 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5466 | ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5467 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5468 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5469 | if (ArgI->Val->getType() != *I) |
| 5470 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5471 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5472 | Args.push_back(ArgI->Val); |
| 5473 | } |
| 5474 | if (Ty->isVarArg()) { |
| 5475 | if (I == E) |
| 5476 | for (; ArgI != ArgE; ++ArgI) |
| 5477 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5478 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5479 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5480 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5481 | // Create the call node |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5482 | CallInst *CI = new CallInst(V, &Args[0], Args.size()); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5483 | CI->setTailCall((yyvsp[-7].BoolVal)); |
| 5484 | CI->setCallingConv((yyvsp[-6].UIntVal)); |
| 5485 | (yyval.InstVal) = CI; |
| 5486 | delete (yyvsp[-2].ValueRefList); |
| 5487 | delete (yyvsp[-5].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5488 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5489 | ;} |
| 5490 | break; |
| 5491 | |
| 5492 | case 276: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5493 | #line 2815 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5494 | { |
| 5495 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5496 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5497 | ;} |
| 5498 | break; |
| 5499 | |
| 5500 | case 277: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5501 | #line 2820 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5502 | { |
| 5503 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5504 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5505 | ;} |
| 5506 | break; |
| 5507 | |
| 5508 | case 278: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5509 | #line 2824 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5510 | { |
| 5511 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5512 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5513 | ;} |
| 5514 | break; |
| 5515 | |
| 5516 | case 279: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5517 | #line 2831 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5518 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5519 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5520 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5521 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5522 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5523 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5524 | ;} |
| 5525 | break; |
| 5526 | |
| 5527 | case 280: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5528 | #line 2838 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5529 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5530 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5531 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5532 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5533 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5534 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5535 | delete (yyvsp[-4].TypeVal); |
| 5536 | ;} |
| 5537 | break; |
| 5538 | |
| 5539 | case 281: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5540 | #line 2846 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5541 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5542 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5543 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5544 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5545 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5546 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5547 | ;} |
| 5548 | break; |
| 5549 | |
| 5550 | case 282: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5551 | #line 2853 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5552 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5553 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5554 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5555 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5556 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5557 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5558 | delete (yyvsp[-4].TypeVal); |
| 5559 | ;} |
| 5560 | break; |
| 5561 | |
| 5562 | case 283: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5563 | #line 2861 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5564 | { |
| 5565 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5566 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5567 | (yyvsp[0].ValueVal)->getType()->getDescription() + ""); |
| 5568 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5569 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5570 | ;} |
| 5571 | break; |
| 5572 | |
| 5573 | case 284: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5574 | #line 2869 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5575 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5576 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5577 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5578 | if (!isa<PointerType>((yyvsp[-1].TypeVal)->get())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5579 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5580 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5581 | if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5582 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5583 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5584 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5585 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5586 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
| 5587 | delete (yyvsp[-1].TypeVal); |
| 5588 | ;} |
| 5589 | break; |
| 5590 | |
| 5591 | case 285: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5592 | #line 2883 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5593 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5594 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5595 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5596 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5597 | if (!PT) |
| 5598 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5599 | (*(yyvsp[-1].TypeVal))->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5600 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5601 | if (ElTy != (yyvsp[-3].ValueVal)->getType()) |
| 5602 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5603 | "' into space of type '" + ElTy->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5604 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5605 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5606 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5607 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); |
| 5608 | delete (yyvsp[-1].TypeVal); |
| 5609 | ;} |
| 5610 | break; |
| 5611 | |
| 5612 | case 286: |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5613 | #line 2900 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5614 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5615 | if (!UpRefs.empty()) |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5616 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5617 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5618 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5619 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5620 | 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] | 5621 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5622 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'"); |
| 5623 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5624 | CHECK_FOR_ERROR |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5625 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size()); |
| 5626 | delete (yyvsp[-2].TypeVal); |
| 5627 | delete (yyvsp[0].ValueList); |
| 5628 | ;} |
| 5629 | break; |
| 5630 | |
| 5631 | |
| 5632 | default: break; |
| 5633 | } |
| 5634 | |
| 5635 | /* Line 1126 of yacc.c. */ |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5636 | #line 5637 "llvmAsmParser.tab.c" |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5637 | |
| 5638 | yyvsp -= yylen; |
| 5639 | yyssp -= yylen; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5640 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5641 | |
| 5642 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5643 | |
| 5644 | *++yyvsp = yyval; |
| 5645 | |
| 5646 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5647 | /* Now `shift' the result of the reduction. Determine what state |
| 5648 | that goes to, based on the state we popped back to and the rule |
| 5649 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5650 | |
| 5651 | yyn = yyr1[yyn]; |
| 5652 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5653 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5654 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5655 | yystate = yytable[yystate]; |
| 5656 | else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5657 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5658 | |
| 5659 | goto yynewstate; |
| 5660 | |
| 5661 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5662 | /*------------------------------------. |
| 5663 | | yyerrlab -- here on detecting error | |
| 5664 | `------------------------------------*/ |
| 5665 | yyerrlab: |
| 5666 | /* If not already recovering from an error, report this error. */ |
| 5667 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5668 | { |
| 5669 | ++yynerrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5670 | #if YYERROR_VERBOSE |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5671 | yyn = yypact[yystate]; |
| 5672 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5673 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5674 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5675 | int yytype = YYTRANSLATE (yychar); |
| 5676 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5677 | YYSIZE_T yysize = yysize0; |
| 5678 | YYSIZE_T yysize1; |
| 5679 | int yysize_overflow = 0; |
| 5680 | char *yymsg = 0; |
| 5681 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5682 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5683 | int yyx; |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5684 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5685 | #if 0 |
| 5686 | /* This is so xgettext sees the translatable formats that are |
| 5687 | constructed on the fly. */ |
| 5688 | YY_("syntax error, unexpected %s"); |
| 5689 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5690 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5691 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5692 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5693 | #endif |
| 5694 | char *yyfmt; |
| 5695 | char const *yyf; |
| 5696 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5697 | static char const yyexpecting[] = ", expecting %s"; |
| 5698 | static char const yyor[] = " or %s"; |
| 5699 | char yyformat[sizeof yyunexpected |
| 5700 | + sizeof yyexpecting - 1 |
| 5701 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5702 | * (sizeof yyor - 1))]; |
| 5703 | char const *yyprefix = yyexpecting; |
| 5704 | |
| 5705 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5706 | YYCHECK. */ |
| 5707 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5708 | |
| 5709 | /* Stay within bounds of both yycheck and yytname. */ |
| 5710 | int yychecklim = YYLAST - yyn; |
| 5711 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5712 | int yycount = 1; |
| 5713 | |
| 5714 | yyarg[0] = yytname[yytype]; |
| 5715 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5716 | |
| 5717 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5718 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5719 | { |
| 5720 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 5721 | { |
| 5722 | yycount = 1; |
| 5723 | yysize = yysize0; |
| 5724 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 5725 | break; |
| 5726 | } |
| 5727 | yyarg[yycount++] = yytname[yyx]; |
| 5728 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5729 | yysize_overflow |= yysize1 < yysize; |
| 5730 | yysize = yysize1; |
| 5731 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5732 | yyprefix = yyor; |
| 5733 | } |
| 5734 | |
| 5735 | yyf = YY_(yyformat); |
| 5736 | yysize1 = yysize + yystrlen (yyf); |
| 5737 | yysize_overflow |= yysize1 < yysize; |
| 5738 | yysize = yysize1; |
| 5739 | |
| 5740 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5741 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5742 | if (yymsg) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5743 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5744 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5745 | Don't have undefined behavior even if the translation |
| 5746 | produced a string with the wrong number of "%s"s. */ |
| 5747 | char *yyp = yymsg; |
| 5748 | int yyi = 0; |
| 5749 | while ((*yyp = *yyf)) |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5750 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5751 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5752 | { |
| 5753 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5754 | yyf += 2; |
| 5755 | } |
| 5756 | else |
| 5757 | { |
| 5758 | yyp++; |
| 5759 | yyf++; |
| 5760 | } |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5761 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5762 | yyerror (yymsg); |
| 5763 | YYSTACK_FREE (yymsg); |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5764 | } |
| 5765 | else |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5766 | { |
| 5767 | yyerror (YY_("syntax error")); |
| 5768 | goto yyexhaustedlab; |
| 5769 | } |
Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5770 | } |
| 5771 | else |
| 5772 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5773 | yyerror (YY_("syntax error")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5774 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5775 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5776 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5777 | |
| 5778 | if (yyerrstatus == 3) |
| 5779 | { |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5780 | /* If just tried and failed to reuse look-ahead token after an |
| 5781 | error, discard it. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5782 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5783 | if (yychar <= YYEOF) |
| 5784 | { |
| 5785 | /* Return failure if at end of input. */ |
| 5786 | if (yychar == YYEOF) |
| 5787 | YYABORT; |
| 5788 | } |
| 5789 | else |
| 5790 | { |
| 5791 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 5792 | yychar = YYEMPTY; |
| 5793 | } |
| 5794 | } |
| 5795 | |
| 5796 | /* Else will try to reuse look-ahead token after shifting the error |
| 5797 | token. */ |
| 5798 | goto yyerrlab1; |
| 5799 | |
| 5800 | |
| 5801 | /*---------------------------------------------------. |
| 5802 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5803 | `---------------------------------------------------*/ |
| 5804 | yyerrorlab: |
| 5805 | |
| 5806 | /* Pacify compilers like GCC when the user code never invokes |
| 5807 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5808 | code. */ |
| 5809 | if (0) |
| 5810 | goto yyerrorlab; |
| 5811 | |
| 5812 | yyvsp -= yylen; |
| 5813 | yyssp -= yylen; |
| 5814 | yystate = *yyssp; |
| 5815 | goto yyerrlab1; |
| 5816 | |
| 5817 | |
| 5818 | /*-------------------------------------------------------------. |
| 5819 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5820 | `-------------------------------------------------------------*/ |
| 5821 | yyerrlab1: |
| 5822 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5823 | |
| 5824 | for (;;) |
| 5825 | { |
| 5826 | yyn = yypact[yystate]; |
| 5827 | if (yyn != YYPACT_NINF) |
| 5828 | { |
| 5829 | yyn += YYTERROR; |
| 5830 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5831 | { |
| 5832 | yyn = yytable[yyn]; |
| 5833 | if (0 < yyn) |
| 5834 | break; |
| 5835 | } |
| 5836 | } |
| 5837 | |
| 5838 | /* Pop the current state because it cannot handle the error token. */ |
| 5839 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5840 | YYABORT; |
| 5841 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5842 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5843 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 5844 | YYPOPSTACK; |
| 5845 | yystate = *yyssp; |
| 5846 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5847 | } |
| 5848 | |
| 5849 | if (yyn == YYFINAL) |
| 5850 | YYACCEPT; |
| 5851 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5852 | *++yyvsp = yylval; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5853 | |
| 5854 | |
| 5855 | /* Shift the error token. */ |
| 5856 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5857 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5858 | yystate = yyn; |
| 5859 | goto yynewstate; |
| 5860 | |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5861 | |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5862 | /*-------------------------------------. |
| 5863 | | yyacceptlab -- YYACCEPT comes here. | |
| 5864 | `-------------------------------------*/ |
| 5865 | yyacceptlab: |
| 5866 | yyresult = 0; |
| 5867 | goto yyreturn; |
| 5868 | |
| 5869 | /*-----------------------------------. |
| 5870 | | yyabortlab -- YYABORT comes here. | |
| 5871 | `-----------------------------------*/ |
| 5872 | yyabortlab: |
| 5873 | yyresult = 1; |
| 5874 | goto yyreturn; |
| 5875 | |
| 5876 | #ifndef yyoverflow |
| 5877 | /*-------------------------------------------------. |
| 5878 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5879 | `-------------------------------------------------*/ |
| 5880 | yyexhaustedlab: |
| 5881 | yyerror (YY_("memory exhausted")); |
| 5882 | yyresult = 2; |
| 5883 | /* Fall through. */ |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5884 | #endif |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5885 | |
| 5886 | yyreturn: |
| 5887 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5888 | yydestruct ("Cleanup: discarding lookahead", |
| 5889 | yytoken, &yylval); |
| 5890 | while (yyssp != yyss) |
| 5891 | { |
| 5892 | yydestruct ("Cleanup: popping", |
| 5893 | yystos[*yyssp], yyvsp); |
| 5894 | YYPOPSTACK; |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5895 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5896 | #ifndef yyoverflow |
| 5897 | if (yyss != yyssa) |
| 5898 | YYSTACK_FREE (yyss); |
| 5899 | #endif |
| 5900 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5901 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5902 | |
| 5903 | |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 5904 | #line 2917 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5905 | |
| 5906 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5907 | // common code from the two 'RunVMAsmParser' functions |
| 5908 | static Module* RunParser(Module * M) { |
| 5909 | |
| 5910 | llvmAsmlineno = 1; // Reset the current line number... |
| 5911 | CurModule.CurrentModule = M; |
| 5912 | #if YYDEBUG |
| 5913 | yydebug = Debug; |
| 5914 | #endif |
| 5915 | |
| 5916 | // Check to make sure the parser succeeded |
| 5917 | if (yyparse()) { |
| 5918 | if (ParserResult) |
| 5919 | delete ParserResult; |
| 5920 | return 0; |
| 5921 | } |
| 5922 | |
| 5923 | // Check to make sure that parsing produced a result |
| 5924 | if (!ParserResult) |
| 5925 | return 0; |
| 5926 | |
| 5927 | // Reset ParserResult variable while saving its value for the result. |
| 5928 | Module *Result = ParserResult; |
| 5929 | ParserResult = 0; |
| 5930 | |
| 5931 | return Result; |
| 5932 | } |
| 5933 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5934 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5935 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5936 | // TODO: column number in exception |
| 5937 | if (TheParseError) |
| 5938 | TheParseError->setError(CurFilename, message, LineNo); |
| 5939 | TriggerError = 1; |
| 5940 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5941 | |
| 5942 | int yyerror(const char *ErrorMsg) { |
| 5943 | std::string where |
| 5944 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5945 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5946 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
| 5947 | if (yychar != YYEMPTY && yychar != 0) |
| 5948 | errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ |
| 5949 | "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5950 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5951 | return 0; |
| 5952 | } |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5953 | |