Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +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 | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 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 | b0fcf8f | 2007-01-17 02:48:45 +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 | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 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. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Bison version. */ |
| 40 | #define YYBISON_VERSION "2.1" |
| 41 | |
| 42 | /* Skeleton name. */ |
| 43 | #define YYSKELETON_NAME "yacc.c" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 44 | |
| 45 | /* Pure parsers. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 46 | #define YYPURE 0 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 47 | |
| 48 | /* Using locations. */ |
| 49 | #define YYLSP_NEEDED 0 |
| 50 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 51 | /* Substitute the variable and function names. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 52 | #define yyparse llvmAsmparse |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +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 | b0fcf8f | 2007-01-17 02:48:45 +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 | b0fcf8f | 2007-01-17 02:48:45 +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, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 69 | LOCALVAL_ID = 260, |
| 70 | GLOBALVAL_ID = 261, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 71 | FPVAL = 262, |
| 72 | VOID = 263, |
| 73 | INTTYPE = 264, |
| 74 | FLOAT = 265, |
| 75 | DOUBLE = 266, |
| 76 | LABEL = 267, |
| 77 | TYPE = 268, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 78 | LOCALVAR = 269, |
| 79 | GLOBALVAR = 270, |
| 80 | LABELSTR = 271, |
| 81 | STRINGCONSTANT = 272, |
| 82 | ATSTRINGCONSTANT = 273, |
| 83 | IMPLEMENTATION = 274, |
| 84 | ZEROINITIALIZER = 275, |
| 85 | TRUETOK = 276, |
| 86 | FALSETOK = 277, |
| 87 | BEGINTOK = 278, |
| 88 | ENDTOK = 279, |
| 89 | DECLARE = 280, |
| 90 | DEFINE = 281, |
| 91 | GLOBAL = 282, |
| 92 | CONSTANT = 283, |
| 93 | SECTION = 284, |
| 94 | VOLATILE = 285, |
| 95 | TO = 286, |
| 96 | DOTDOTDOT = 287, |
| 97 | NULL_TOK = 288, |
| 98 | UNDEF = 289, |
| 99 | INTERNAL = 290, |
| 100 | LINKONCE = 291, |
| 101 | WEAK = 292, |
| 102 | APPENDING = 293, |
| 103 | DLLIMPORT = 294, |
| 104 | DLLEXPORT = 295, |
| 105 | EXTERN_WEAK = 296, |
| 106 | OPAQUE = 297, |
| 107 | EXTERNAL = 298, |
| 108 | TARGET = 299, |
| 109 | TRIPLE = 300, |
| 110 | ALIGN = 301, |
| 111 | DEPLIBS = 302, |
| 112 | CALL = 303, |
| 113 | TAIL = 304, |
| 114 | ASM_TOK = 305, |
| 115 | MODULE = 306, |
| 116 | SIDEEFFECT = 307, |
| 117 | CC_TOK = 308, |
| 118 | CCC_TOK = 309, |
| 119 | CSRETCC_TOK = 310, |
| 120 | FASTCC_TOK = 311, |
| 121 | COLDCC_TOK = 312, |
| 122 | X86_STDCALLCC_TOK = 313, |
| 123 | X86_FASTCALLCC_TOK = 314, |
| 124 | DATALAYOUT = 315, |
| 125 | RET = 316, |
| 126 | BR = 317, |
| 127 | SWITCH = 318, |
| 128 | INVOKE = 319, |
| 129 | UNWIND = 320, |
| 130 | UNREACHABLE = 321, |
| 131 | ADD = 322, |
| 132 | SUB = 323, |
| 133 | MUL = 324, |
| 134 | UDIV = 325, |
| 135 | SDIV = 326, |
| 136 | FDIV = 327, |
| 137 | UREM = 328, |
| 138 | SREM = 329, |
| 139 | FREM = 330, |
| 140 | AND = 331, |
| 141 | OR = 332, |
| 142 | XOR = 333, |
| 143 | ICMP = 334, |
| 144 | FCMP = 335, |
| 145 | EQ = 336, |
| 146 | NE = 337, |
| 147 | SLT = 338, |
| 148 | SGT = 339, |
| 149 | SLE = 340, |
| 150 | SGE = 341, |
| 151 | ULT = 342, |
| 152 | UGT = 343, |
| 153 | ULE = 344, |
| 154 | UGE = 345, |
| 155 | OEQ = 346, |
| 156 | ONE = 347, |
| 157 | OLT = 348, |
| 158 | OGT = 349, |
| 159 | OLE = 350, |
| 160 | OGE = 351, |
| 161 | ORD = 352, |
| 162 | UNO = 353, |
| 163 | UEQ = 354, |
| 164 | UNE = 355, |
| 165 | MALLOC = 356, |
| 166 | ALLOCA = 357, |
| 167 | FREE = 358, |
| 168 | LOAD = 359, |
| 169 | STORE = 360, |
| 170 | GETELEMENTPTR = 361, |
| 171 | TRUNC = 362, |
| 172 | ZEXT = 363, |
| 173 | SEXT = 364, |
| 174 | FPTRUNC = 365, |
| 175 | FPEXT = 366, |
| 176 | BITCAST = 367, |
| 177 | UITOFP = 368, |
| 178 | SITOFP = 369, |
| 179 | FPTOUI = 370, |
| 180 | FPTOSI = 371, |
| 181 | INTTOPTR = 372, |
| 182 | PTRTOINT = 373, |
| 183 | PHI_TOK = 374, |
| 184 | SELECT = 375, |
| 185 | SHL = 376, |
| 186 | LSHR = 377, |
| 187 | ASHR = 378, |
| 188 | VAARG = 379, |
| 189 | EXTRACTELEMENT = 380, |
| 190 | INSERTELEMENT = 381, |
| 191 | SHUFFLEVECTOR = 382, |
| 192 | NORETURN = 383, |
| 193 | DEFAULT = 384, |
| 194 | HIDDEN = 385 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 195 | }; |
| 196 | #endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 197 | /* Tokens. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 198 | #define ESINT64VAL 258 |
| 199 | #define EUINT64VAL 259 |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 200 | #define LOCALVAL_ID 260 |
| 201 | #define GLOBALVAL_ID 261 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 202 | #define FPVAL 262 |
| 203 | #define VOID 263 |
| 204 | #define INTTYPE 264 |
| 205 | #define FLOAT 265 |
| 206 | #define DOUBLE 266 |
| 207 | #define LABEL 267 |
| 208 | #define TYPE 268 |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 209 | #define LOCALVAR 269 |
| 210 | #define GLOBALVAR 270 |
| 211 | #define LABELSTR 271 |
| 212 | #define STRINGCONSTANT 272 |
| 213 | #define ATSTRINGCONSTANT 273 |
| 214 | #define IMPLEMENTATION 274 |
| 215 | #define ZEROINITIALIZER 275 |
| 216 | #define TRUETOK 276 |
| 217 | #define FALSETOK 277 |
| 218 | #define BEGINTOK 278 |
| 219 | #define ENDTOK 279 |
| 220 | #define DECLARE 280 |
| 221 | #define DEFINE 281 |
| 222 | #define GLOBAL 282 |
| 223 | #define CONSTANT 283 |
| 224 | #define SECTION 284 |
| 225 | #define VOLATILE 285 |
| 226 | #define TO 286 |
| 227 | #define DOTDOTDOT 287 |
| 228 | #define NULL_TOK 288 |
| 229 | #define UNDEF 289 |
| 230 | #define INTERNAL 290 |
| 231 | #define LINKONCE 291 |
| 232 | #define WEAK 292 |
| 233 | #define APPENDING 293 |
| 234 | #define DLLIMPORT 294 |
| 235 | #define DLLEXPORT 295 |
| 236 | #define EXTERN_WEAK 296 |
| 237 | #define OPAQUE 297 |
| 238 | #define EXTERNAL 298 |
| 239 | #define TARGET 299 |
| 240 | #define TRIPLE 300 |
| 241 | #define ALIGN 301 |
| 242 | #define DEPLIBS 302 |
| 243 | #define CALL 303 |
| 244 | #define TAIL 304 |
| 245 | #define ASM_TOK 305 |
| 246 | #define MODULE 306 |
| 247 | #define SIDEEFFECT 307 |
| 248 | #define CC_TOK 308 |
| 249 | #define CCC_TOK 309 |
| 250 | #define CSRETCC_TOK 310 |
| 251 | #define FASTCC_TOK 311 |
| 252 | #define COLDCC_TOK 312 |
| 253 | #define X86_STDCALLCC_TOK 313 |
| 254 | #define X86_FASTCALLCC_TOK 314 |
| 255 | #define DATALAYOUT 315 |
| 256 | #define RET 316 |
| 257 | #define BR 317 |
| 258 | #define SWITCH 318 |
| 259 | #define INVOKE 319 |
| 260 | #define UNWIND 320 |
| 261 | #define UNREACHABLE 321 |
| 262 | #define ADD 322 |
| 263 | #define SUB 323 |
| 264 | #define MUL 324 |
| 265 | #define UDIV 325 |
| 266 | #define SDIV 326 |
| 267 | #define FDIV 327 |
| 268 | #define UREM 328 |
| 269 | #define SREM 329 |
| 270 | #define FREM 330 |
| 271 | #define AND 331 |
| 272 | #define OR 332 |
| 273 | #define XOR 333 |
| 274 | #define ICMP 334 |
| 275 | #define FCMP 335 |
| 276 | #define EQ 336 |
| 277 | #define NE 337 |
| 278 | #define SLT 338 |
| 279 | #define SGT 339 |
| 280 | #define SLE 340 |
| 281 | #define SGE 341 |
| 282 | #define ULT 342 |
| 283 | #define UGT 343 |
| 284 | #define ULE 344 |
| 285 | #define UGE 345 |
| 286 | #define OEQ 346 |
| 287 | #define ONE 347 |
| 288 | #define OLT 348 |
| 289 | #define OGT 349 |
| 290 | #define OLE 350 |
| 291 | #define OGE 351 |
| 292 | #define ORD 352 |
| 293 | #define UNO 353 |
| 294 | #define UEQ 354 |
| 295 | #define UNE 355 |
| 296 | #define MALLOC 356 |
| 297 | #define ALLOCA 357 |
| 298 | #define FREE 358 |
| 299 | #define LOAD 359 |
| 300 | #define STORE 360 |
| 301 | #define GETELEMENTPTR 361 |
| 302 | #define TRUNC 362 |
| 303 | #define ZEXT 363 |
| 304 | #define SEXT 364 |
| 305 | #define FPTRUNC 365 |
| 306 | #define FPEXT 366 |
| 307 | #define BITCAST 367 |
| 308 | #define UITOFP 368 |
| 309 | #define SITOFP 369 |
| 310 | #define FPTOUI 370 |
| 311 | #define FPTOSI 371 |
| 312 | #define INTTOPTR 372 |
| 313 | #define PTRTOINT 373 |
| 314 | #define PHI_TOK 374 |
| 315 | #define SELECT 375 |
| 316 | #define SHL 376 |
| 317 | #define LSHR 377 |
| 318 | #define ASHR 378 |
| 319 | #define VAARG 379 |
| 320 | #define EXTRACTELEMENT 380 |
| 321 | #define INSERTELEMENT 381 |
| 322 | #define SHUFFLEVECTOR 382 |
| 323 | #define NORETURN 383 |
| 324 | #define DEFAULT 384 |
| 325 | #define HIDDEN 385 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | /* Copy the first part of user declarations. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 331 | #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 332 | |
| 333 | #include "ParserInternals.h" |
| 334 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 335 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 336 | #include "llvm/Instructions.h" |
| 337 | #include "llvm/Module.h" |
| 338 | #include "llvm/SymbolTable.h" |
| 339 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 340 | #include "llvm/Support/CommandLine.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 341 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 342 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 343 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 344 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 345 | #include <list> |
| 346 | #include <utility> |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 347 | #ifndef NDEBUG |
| 348 | #define YYDEBUG 1 |
| 349 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 350 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 351 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 352 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 353 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 354 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 355 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 356 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 357 | // GenerateError are made from inside productions and they must simulate the |
| 358 | // previous exception behavior by exiting the production immediately. We have |
| 359 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 360 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 361 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 362 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 363 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 364 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 365 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 366 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 367 | int yylex(); // declaration" of xxx warnings. |
| 368 | int yyparse(); |
| 369 | |
| 370 | namespace llvm { |
| 371 | std::string CurFilename; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 372 | #if YYDEBUG |
| 373 | static cl::opt<bool> |
| 374 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), |
| 375 | cl::Hidden, cl::init(false)); |
| 376 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 377 | } |
| 378 | using namespace llvm; |
| 379 | |
| 380 | static Module *ParserResult; |
| 381 | |
| 382 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 383 | // relating to upreferences in the input stream. |
| 384 | // |
| 385 | //#define DEBUG_UPREFS 1 |
| 386 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 387 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 388 | #else |
| 389 | #define UR_OUT(X) |
| 390 | #endif |
| 391 | |
| 392 | #define YYERROR_VERBOSE 1 |
| 393 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 394 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 395 | |
| 396 | |
| 397 | // This contains info used when building the body of a function. It is |
| 398 | // destroyed when the function is completed. |
| 399 | // |
| 400 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 401 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 402 | static void |
| 403 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 404 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 405 | |
| 406 | static struct PerModuleInfo { |
| 407 | Module *CurrentModule; |
| 408 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 409 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 410 | std::vector<PATypeHolder> Types; |
| 411 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 412 | |
| 413 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 414 | /// 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] | 415 | /// that we can resolve them later and print error messages as appropriate. |
| 416 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 417 | |
| 418 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 419 | // references to global values. Global values may be referenced before they |
| 420 | // are defined, and if so, the temporary object that they represent is held |
| 421 | // here. This is used for forward references of GlobalValues. |
| 422 | // |
| 423 | typedef std::map<std::pair<const PointerType *, |
| 424 | ValID>, GlobalValue*> GlobalRefsType; |
| 425 | GlobalRefsType GlobalRefs; |
| 426 | |
| 427 | void ModuleDone() { |
| 428 | // If we could not resolve some functions at function compilation time |
| 429 | // (calls to functions before they are defined), resolve them now... Types |
| 430 | // are resolved when the constant pool has been completely parsed. |
| 431 | // |
| 432 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 433 | if (TriggerError) |
| 434 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 435 | |
| 436 | // Check to make sure that all global value forward references have been |
| 437 | // resolved! |
| 438 | // |
| 439 | if (!GlobalRefs.empty()) { |
| 440 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 441 | |
| 442 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 443 | I != E; ++I) { |
| 444 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 445 | I->first.second.getName() + "\n"; |
| 446 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 447 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 448 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | Values.clear(); // Clear out function local definitions |
| 452 | Types.clear(); |
| 453 | CurrentModule = 0; |
| 454 | } |
| 455 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 456 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 457 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 458 | // If not, just return null. |
| 459 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 460 | // Check to see if there is a forward reference to this global variable... |
| 461 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 462 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 463 | GlobalValue *Ret = 0; |
| 464 | if (I != GlobalRefs.end()) { |
| 465 | Ret = I->second; |
| 466 | GlobalRefs.erase(I); |
| 467 | } |
| 468 | return Ret; |
| 469 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 470 | |
| 471 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 472 | // If it isn't abstract, its resolved |
| 473 | const Type* Ty = PATy->get(); |
| 474 | if (!Ty->isAbstract()) |
| 475 | return false; |
| 476 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 477 | // we don't need to traverse that leg of the type. |
| 478 | std::vector<const Type*> WorkList, SeenList; |
| 479 | WorkList.push_back(Ty); |
| 480 | while (!WorkList.empty()) { |
| 481 | const Type* Ty = WorkList.back(); |
| 482 | SeenList.push_back(Ty); |
| 483 | WorkList.pop_back(); |
| 484 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 485 | // Check to see if this is an unresolved type |
| 486 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 487 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 488 | for ( ; I != E; ++I) { |
| 489 | if (I->second.get() == OpTy) |
| 490 | return true; |
| 491 | } |
| 492 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 493 | const Type* TheTy = SeqTy->getElementType(); |
| 494 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 495 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 496 | E = SeenList.end(); |
| 497 | for ( ; I != E; ++I) |
| 498 | if (*I == TheTy) |
| 499 | break; |
| 500 | if (I == E) |
| 501 | WorkList.push_back(TheTy); |
| 502 | } |
| 503 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 504 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 505 | const Type* TheTy = StrTy->getElementType(i); |
| 506 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 507 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 508 | E = SeenList.end(); |
| 509 | for ( ; I != E; ++I) |
| 510 | if (*I == TheTy) |
| 511 | break; |
| 512 | if (I == E) |
| 513 | WorkList.push_back(TheTy); |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | } |
| 518 | return false; |
| 519 | } |
| 520 | |
| 521 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 522 | } CurModule; |
| 523 | |
| 524 | static struct PerFunctionInfo { |
| 525 | Function *CurrentFunction; // Pointer to current function being created |
| 526 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 527 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 528 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 529 | bool isDeclare; // Is this function a forward declararation? |
| 530 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 531 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 532 | |
| 533 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 534 | /// track of them here. |
| 535 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 536 | std::vector<BasicBlock*> NumberedBlocks; |
| 537 | unsigned NextBBNum; |
| 538 | |
| 539 | inline PerFunctionInfo() { |
| 540 | CurrentFunction = 0; |
| 541 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 542 | Linkage = GlobalValue::ExternalLinkage; |
| 543 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | inline void FunctionStart(Function *M) { |
| 547 | CurrentFunction = M; |
| 548 | NextBBNum = 0; |
| 549 | } |
| 550 | |
| 551 | void FunctionDone() { |
| 552 | NumberedBlocks.clear(); |
| 553 | |
| 554 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 555 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 556 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 557 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 558 | return; |
| 559 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 560 | |
| 561 | // Resolve all forward references now. |
| 562 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 563 | |
| 564 | Values.clear(); // Clear out function local definitions |
| 565 | CurrentFunction = 0; |
| 566 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 567 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 568 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 569 | } |
| 570 | } CurFun; // Info for the current function... |
| 571 | |
| 572 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 573 | |
| 574 | |
| 575 | //===----------------------------------------------------------------------===// |
| 576 | // Code to handle definitions of all the types |
| 577 | //===----------------------------------------------------------------------===// |
| 578 | |
| 579 | static int InsertValue(Value *V, |
| 580 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 581 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 582 | |
| 583 | // Yes, insert the value into the value table... |
| 584 | ValueList &List = ValueTab[V->getType()]; |
| 585 | List.push_back(V); |
| 586 | return List.size()-1; |
| 587 | } |
| 588 | |
| 589 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 590 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 591 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 592 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 593 | if (D.Num < CurModule.Types.size()) |
| 594 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 595 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 596 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 597 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 598 | D.destroy(); // Free old strdup'd memory... |
| 599 | return N; |
| 600 | } |
| 601 | break; |
| 602 | default: |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 603 | GenerateError("Internal parser error: Invalid symbol type reference!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 604 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | // If we reached here, we referenced either a symbol that we don't know about |
| 608 | // or an id number that hasn't been read yet. We may be referencing something |
| 609 | // forward, so just create an entry to be resolved later and get to it... |
| 610 | // |
| 611 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 612 | |
| 613 | |
| 614 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 615 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 616 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 617 | return 0; |
| 618 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 619 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 620 | return 0; |
| 621 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 622 | } |
| 623 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 624 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 625 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 626 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 627 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 628 | Type *Typ = OpaqueType::get(); |
| 629 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 630 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 631 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 632 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 633 | // getValNonImprovising - Look up the value specified by the provided type and |
| 634 | // the provided ValID. If the value exists and has already been defined, return |
| 635 | // it. Otherwise return null. |
| 636 | // |
| 637 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 638 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 639 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 640 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 641 | return 0; |
| 642 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 643 | |
| 644 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 645 | case ValID::LocalID: { // Is it a numbered definition? |
| 646 | // Module constants occupy the lowest numbered slots. |
| 647 | std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty); |
| 648 | // Make sure that our type is within bounds. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 649 | if (VI == CurFun.Values.end()) return 0; |
| 650 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 651 | // Check that the number is within bounds. |
| 652 | if (D.Num >= VI->second.size()) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 653 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 654 | return VI->second[D.Num]; |
| 655 | } |
| 656 | case ValID::GlobalID: { // Is it a numbered definition? |
| 657 | unsigned Num = D.Num; |
| 658 | |
| 659 | // Module constants occupy the lowest numbered slots... |
| 660 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 661 | if (VI == CurModule.Values.end()) return 0; |
| 662 | if (D.Num >= VI->second.size()) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 663 | return VI->second[Num]; |
| 664 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 665 | |
| 666 | case ValID::LocalName: { // Is it a named definition? |
| 667 | if (!inFunctionScope()) return 0; |
| 668 | SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
| 669 | Value *N = SymTab.lookup(Ty, D.Name); |
| 670 | if (N == 0) return 0; |
| 671 | |
| 672 | D.destroy(); // Free old strdup'd memory... |
| 673 | return N; |
| 674 | } |
| 675 | case ValID::GlobalName: { // Is it a named definition? |
| 676 | SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
| 677 | Value *N = SymTab.lookup(Ty, D.Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 678 | if (N == 0) return 0; |
| 679 | |
| 680 | D.destroy(); // Free old strdup'd memory... |
| 681 | return N; |
| 682 | } |
| 683 | |
| 684 | // Check to make sure that "Ty" is an integral type, and that our |
| 685 | // value will fit into the specified type... |
| 686 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 687 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 688 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 689 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 690 | Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 691 | return 0; |
| 692 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 693 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 694 | |
| 695 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 696 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 697 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 698 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 699 | "' is invalid or out of range!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 700 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 701 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 702 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 703 | } |
| 704 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 705 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 706 | } |
| 707 | |
| 708 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 709 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 710 | GenerateError("FP constant invalid for type!!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 711 | return 0; |
| 712 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 713 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 714 | |
| 715 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 716 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 717 | GenerateError("Cannot create a a non pointer null!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 718 | return 0; |
| 719 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 720 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 721 | |
| 722 | case ValID::ConstUndefVal: // Is it an undef value? |
| 723 | return UndefValue::get(Ty); |
| 724 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 725 | case ValID::ConstZeroVal: // Is it a zero value? |
| 726 | return Constant::getNullValue(Ty); |
| 727 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 728 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 729 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 730 | GenerateError("Constant expression type different from required type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 731 | return 0; |
| 732 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 733 | return D.ConstantValue; |
| 734 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 735 | case ValID::InlineAsmVal: { // Inline asm expression |
| 736 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 737 | const FunctionType *FTy = |
| 738 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 739 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 740 | GenerateError("Invalid type for asm constraint string!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 741 | return 0; |
| 742 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 743 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 744 | D.IAD->HasSideEffects); |
| 745 | D.destroy(); // Free InlineAsmDescriptor. |
| 746 | return IA; |
| 747 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 748 | default: |
| 749 | assert(0 && "Unhandled case!"); |
| 750 | return 0; |
| 751 | } // End of switch |
| 752 | |
| 753 | assert(0 && "Unhandled case!"); |
| 754 | return 0; |
| 755 | } |
| 756 | |
| 757 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 758 | // value is not already defined, it "improvises" by creating a placeholder var |
| 759 | // that looks and acts just like the requested variable. When the value is |
| 760 | // defined later, all uses of the placeholder variable are replaced with the |
| 761 | // real thing. |
| 762 | // |
| 763 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 764 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 765 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 766 | return 0; |
| 767 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 768 | |
| 769 | // See if the value has already been defined. |
| 770 | Value *V = getValNonImprovising(Ty, ID); |
| 771 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 772 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 773 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 774 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 775 | GenerateError("Invalid use of a composite type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 776 | return 0; |
| 777 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 778 | |
| 779 | // If we reached here, we referenced either a symbol that we don't know about |
| 780 | // or an id number that hasn't been read yet. We may be referencing something |
| 781 | // forward, so just create an entry to be resolved later and get to it... |
| 782 | // |
| 783 | V = new Argument(Ty); |
| 784 | |
| 785 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 786 | // to recycle these things?? |
| 787 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 788 | llvmAsmlineno))); |
| 789 | |
| 790 | if (inFunctionScope()) |
| 791 | InsertValue(V, CurFun.LateResolveValues); |
| 792 | else |
| 793 | InsertValue(V, CurModule.LateResolveValues); |
| 794 | return V; |
| 795 | } |
| 796 | |
| 797 | /// getBBVal - This is used for two purposes: |
| 798 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 799 | /// defined. |
| 800 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 801 | /// or may not be a forward reference. |
| 802 | /// |
| 803 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 804 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 805 | |
| 806 | std::string Name; |
| 807 | BasicBlock *BB = 0; |
| 808 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 809 | default: |
| 810 | GenerateError("Illegal label reference " + ID.getName()); |
| 811 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 812 | case ValID::LocalID: // Is it a numbered definition? |
| 813 | if (ID.Num >= CurFun.NumberedBlocks.size()) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 814 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 815 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 816 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 817 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 818 | Name = ID.Name; |
| 819 | if (Value *N = CurFun.CurrentFunction-> |
Reid Spencer | 78d033e | 2007-01-06 07:24:44 +0000 | [diff] [blame] | 820 | getValueSymbolTable().lookup(Type::LabelTy, Name)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 821 | BB = cast<BasicBlock>(N); |
| 822 | break; |
| 823 | } |
| 824 | |
| 825 | // See if the block has already been defined. |
| 826 | if (BB) { |
| 827 | // If this is the definition of the block, make sure the existing value was |
| 828 | // just a forward reference. If it was a forward reference, there will be |
| 829 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 830 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 831 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 832 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 833 | return 0; |
| 834 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 835 | |
| 836 | ID.destroy(); // Free strdup'd memory. |
| 837 | return BB; |
| 838 | } |
| 839 | |
| 840 | // Otherwise this block has not been seen before. |
| 841 | BB = new BasicBlock("", CurFun.CurrentFunction); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 842 | if (ID.Type == ValID::LocalName) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 843 | BB->setName(ID.Name); |
| 844 | } else { |
| 845 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 846 | } |
| 847 | |
| 848 | // If this is not a definition, keep track of it so we can use it as a forward |
| 849 | // reference. |
| 850 | if (!isDefinition) { |
| 851 | // Remember where this forward reference came from. |
| 852 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 853 | } else { |
| 854 | // The forward declaration could have been inserted anywhere in the |
| 855 | // function: insert it into the correct place now. |
| 856 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 857 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 858 | } |
| 859 | ID.destroy(); |
| 860 | return BB; |
| 861 | } |
| 862 | |
| 863 | |
| 864 | //===----------------------------------------------------------------------===// |
| 865 | // Code to handle forward references in instructions |
| 866 | //===----------------------------------------------------------------------===// |
| 867 | // |
| 868 | // This code handles the late binding needed with statements that reference |
| 869 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 870 | // a loop body. |
| 871 | // |
| 872 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 873 | // and back patchs after we are done. |
| 874 | // |
| 875 | |
| 876 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 877 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 878 | // defs now... |
| 879 | // |
| 880 | static void |
| 881 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 882 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 883 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 884 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 885 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 886 | ValueList &List = LRI->second; |
| 887 | while (!List.empty()) { |
| 888 | Value *V = List.back(); |
| 889 | List.pop_back(); |
| 890 | |
| 891 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 892 | CurModule.PlaceHolderInfo.find(V); |
| 893 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 894 | |
| 895 | ValID &DID = PHI->second.first; |
| 896 | |
| 897 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 898 | if (TriggerError) |
| 899 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 900 | if (TheRealValue) { |
| 901 | V->replaceAllUsesWith(TheRealValue); |
| 902 | delete V; |
| 903 | CurModule.PlaceHolderInfo.erase(PHI); |
| 904 | } else if (FutureLateResolvers) { |
| 905 | // Functions have their unresolved items forwarded to the module late |
| 906 | // resolver table |
| 907 | InsertValue(V, *FutureLateResolvers); |
| 908 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 909 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 910 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 911 | "' of type '" + V->getType()->getDescription() + "'", |
| 912 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 913 | return; |
| 914 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 915 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 916 | itostr(DID.Num) + " of type '" + |
| 917 | V->getType()->getDescription() + "'", |
| 918 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 919 | return; |
| 920 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 921 | } |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | LateResolvers.clear(); |
| 926 | } |
| 927 | |
| 928 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 929 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 930 | // refering to the number can be resolved. Do this now. |
| 931 | // |
| 932 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 933 | ValID D; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 934 | if (Name) D = ValID::createLocalName(Name); |
| 935 | else D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 936 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 937 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 938 | CurModule.LateResolveTypes.find(D); |
| 939 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 940 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 941 | CurModule.LateResolveTypes.erase(I); |
| 942 | } |
| 943 | } |
| 944 | |
| 945 | // setValueName - Set the specified value to the name given. The name may be |
| 946 | // null potentially, in which case this is a noop. The string passed in is |
| 947 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 948 | // |
| 949 | static void setValueName(Value *V, char *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 950 | if (!NameStr) return; |
| 951 | std::string Name(NameStr); // Copy string |
| 952 | free(NameStr); // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 953 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 954 | if (V->getType() == Type::VoidTy) { |
| 955 | GenerateError("Can't assign name '" + Name+"' to value with void type!"); |
| 956 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 957 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 958 | |
| 959 | assert(inFunctionScope() && "Must be in function scope!"); |
| 960 | SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 961 | if (ST.lookup(V->getType(), Name)) { |
| 962 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
| 963 | V->getType()->getDescription() + "'!"); |
| 964 | return; |
| 965 | } |
| 966 | |
| 967 | // Set the name. |
| 968 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 969 | } |
| 970 | |
| 971 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 972 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 973 | static GlobalVariable * |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 974 | ParseGlobalVariable(char *NameStr, |
| 975 | GlobalValue::LinkageTypes Linkage, |
| 976 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 977 | bool isConstantGlobal, const Type *Ty, |
| 978 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 979 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 980 | GenerateError("Cannot declare global vars of function type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 981 | return 0; |
| 982 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 983 | |
| 984 | const PointerType *PTy = PointerType::get(Ty); |
| 985 | |
| 986 | std::string Name; |
| 987 | if (NameStr) { |
| 988 | Name = NameStr; // Copy string |
| 989 | free(NameStr); // Free old string |
| 990 | } |
| 991 | |
| 992 | // See if this global value was forward referenced. If so, recycle the |
| 993 | // object. |
| 994 | ValID ID; |
| 995 | if (!Name.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 996 | ID = ValID::createGlobalName((char*)Name.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 997 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 998 | ID = ValID::createGlobalID(CurModule.Values[PTy].size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 999 | } |
| 1000 | |
| 1001 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1002 | // Move the global to the end of the list, from whereever it was |
| 1003 | // previously inserted. |
| 1004 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1005 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1006 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1007 | GV->setInitializer(Initializer); |
| 1008 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1009 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1010 | GV->setConstant(isConstantGlobal); |
| 1011 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1012 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | // If this global has a name, check to see if there is already a definition |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1016 | // of this global in the module. If so, it is an error. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1017 | if (!Name.empty()) { |
| 1018 | // We are a simple redefinition of a value, check to see if it is defined |
| 1019 | // the same as the old one. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1020 | if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1021 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1022 | "' of type '" + Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1023 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | // Otherwise there is no existing GV to use, create one now. |
| 1028 | GlobalVariable *GV = |
| 1029 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1030 | CurModule.CurrentModule); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1031 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1032 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1033 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1034 | } |
| 1035 | |
| 1036 | // setTypeName - Set the specified type to the name given. The name may be |
| 1037 | // null potentially, in which case this is a noop. The string passed in is |
| 1038 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1039 | // |
| 1040 | // This function returns true if the type has already been defined, but is |
| 1041 | // allowed to be redefined in the specified context. If the name is a new name |
| 1042 | // for the type plane, it is inserted and false is returned. |
| 1043 | static bool setTypeName(const Type *T, char *NameStr) { |
| 1044 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 1045 | if (NameStr == 0) return false; |
| 1046 | |
| 1047 | std::string Name(NameStr); // Copy string |
| 1048 | free(NameStr); // Free old string |
| 1049 | |
| 1050 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1051 | if (T == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1052 | GenerateError("Can't assign name '" + Name + "' to the void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1053 | return false; |
| 1054 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1055 | |
| 1056 | // Set the type name, checking for conflicts as we do so. |
| 1057 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1058 | |
| 1059 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1060 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1061 | assert(Existing && "Conflict but no matching type?"); |
| 1062 | |
| 1063 | // There is only one case where this is allowed: when we are refining an |
| 1064 | // opaque type. In this case, Existing will be an opaque type. |
| 1065 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1066 | // We ARE replacing an opaque type! |
| 1067 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1068 | return true; |
| 1069 | } |
| 1070 | |
| 1071 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1072 | // the redefinition is identical to the original. This will be so if |
| 1073 | // Existing and T point to the same Type object. In this one case we |
| 1074 | // allow the equivalent redefinition. |
| 1075 | if (Existing == T) return true; // Yes, it's equal. |
| 1076 | |
| 1077 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1078 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
| 1079 | T->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1080 | } |
| 1081 | |
| 1082 | return false; |
| 1083 | } |
| 1084 | |
| 1085 | //===----------------------------------------------------------------------===// |
| 1086 | // Code for handling upreferences in type names... |
| 1087 | // |
| 1088 | |
| 1089 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1090 | // |
| 1091 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1092 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1093 | E) != Ty->subtype_end(); |
| 1094 | } |
| 1095 | |
| 1096 | namespace { |
| 1097 | struct UpRefRecord { |
| 1098 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1099 | // this type is resolved. |
| 1100 | unsigned NestingLevel; |
| 1101 | |
| 1102 | // LastContainedTy - This is the type at the current binding level for the |
| 1103 | // type. Every time we reduce the nesting level, this gets updated. |
| 1104 | const Type *LastContainedTy; |
| 1105 | |
| 1106 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1107 | // represented with. |
| 1108 | OpaqueType *UpRefTy; |
| 1109 | |
| 1110 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1111 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1112 | }; |
| 1113 | } |
| 1114 | |
| 1115 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1116 | static std::vector<UpRefRecord> UpRefs; |
| 1117 | |
| 1118 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1119 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1120 | /// currently active types. For each type, if the up reference is contained in |
| 1121 | /// the newly completed type, we decrement the level count. When the level |
| 1122 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1123 | /// thus we can complete the cycle. |
| 1124 | /// |
| 1125 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1126 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1127 | // nothing to resolve here. |
| 1128 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1129 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1130 | PATypeHolder Ty(ty); |
| 1131 | UR_OUT("Type '" << Ty->getDescription() << |
| 1132 | "' newly formed. Resolving upreferences.\n" << |
| 1133 | UpRefs.size() << " upreferences active!\n"); |
| 1134 | |
| 1135 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1136 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1137 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1138 | // this variable. |
| 1139 | OpaqueType *TypeToResolve = 0; |
| 1140 | |
| 1141 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1142 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1143 | << UpRefs[i].second->getDescription() << ") = " |
| 1144 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1145 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1146 | // Decrement level of upreference |
| 1147 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1148 | UpRefs[i].LastContainedTy = Ty; |
| 1149 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1150 | if (Level == 0) { // Upreference should be resolved! |
| 1151 | if (!TypeToResolve) { |
| 1152 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1153 | } else { |
| 1154 | UR_OUT(" * Resolving upreference for " |
| 1155 | << UpRefs[i].second->getDescription() << "\n"; |
| 1156 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1157 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1158 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1159 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1160 | } |
| 1161 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1162 | --i; // Do not skip the next element... |
| 1163 | } |
| 1164 | } |
| 1165 | } |
| 1166 | |
| 1167 | if (TypeToResolve) { |
| 1168 | UR_OUT(" * Resolving upreference for " |
| 1169 | << UpRefs[i].second->getDescription() << "\n"; |
| 1170 | std::string OldName = TypeToResolve->getDescription()); |
| 1171 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1172 | } |
| 1173 | |
| 1174 | return Ty; |
| 1175 | } |
| 1176 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1177 | //===----------------------------------------------------------------------===// |
| 1178 | // RunVMAsmParser - Define an interface to this parser |
| 1179 | //===----------------------------------------------------------------------===// |
| 1180 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1181 | static Module* RunParser(Module * M); |
| 1182 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1183 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1184 | set_scan_file(F); |
| 1185 | |
| 1186 | CurFilename = Filename; |
| 1187 | return RunParser(new Module(CurFilename)); |
| 1188 | } |
| 1189 | |
| 1190 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1191 | set_scan_string(AsmString); |
| 1192 | |
| 1193 | CurFilename = "from_memory"; |
| 1194 | if (M == NULL) { |
| 1195 | return RunParser(new Module (CurFilename)); |
| 1196 | } else { |
| 1197 | return RunParser(M); |
| 1198 | } |
| 1199 | } |
| 1200 | |
| 1201 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1202 | |
| 1203 | /* Enabling traces. */ |
| 1204 | #ifndef YYDEBUG |
| 1205 | # define YYDEBUG 0 |
| 1206 | #endif |
| 1207 | |
| 1208 | /* Enabling verbose error messages. */ |
| 1209 | #ifdef YYERROR_VERBOSE |
| 1210 | # undef YYERROR_VERBOSE |
| 1211 | # define YYERROR_VERBOSE 1 |
| 1212 | #else |
| 1213 | # define YYERROR_VERBOSE 0 |
| 1214 | #endif |
| 1215 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1216 | /* Enabling the token table. */ |
| 1217 | #ifndef YYTOKEN_TABLE |
| 1218 | # define YYTOKEN_TABLE 0 |
| 1219 | #endif |
| 1220 | |
| 1221 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
| 1222 | #line 885 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 1223 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1224 | llvm::Module *ModuleVal; |
| 1225 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1226 | llvm::BasicBlock *BasicBlockVal; |
| 1227 | llvm::TerminatorInst *TermInstVal; |
| 1228 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1229 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1230 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1231 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1232 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1233 | llvm::PATypeHolder *TypeVal; |
| 1234 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1235 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1236 | llvm::ArgListType *ArgList; |
| 1237 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1238 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1239 | llvm::ValueRefList *ValueRefList; |
| 1240 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1241 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1242 | std::list<std::pair<llvm::Value*, |
| 1243 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1244 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1245 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1246 | |
| 1247 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1248 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1249 | llvm::FunctionType::ParameterAttributes ParamAttrs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1250 | int64_t SInt64Val; |
| 1251 | uint64_t UInt64Val; |
| 1252 | int SIntVal; |
| 1253 | unsigned UIntVal; |
| 1254 | double FPVal; |
| 1255 | bool BoolVal; |
| 1256 | |
| 1257 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1258 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1259 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1260 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1261 | llvm::Instruction::TermOps TermOpVal; |
| 1262 | llvm::Instruction::MemoryOps MemOpVal; |
| 1263 | llvm::Instruction::CastOps CastOpVal; |
| 1264 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1265 | llvm::ICmpInst::Predicate IPredicate; |
| 1266 | llvm::FCmpInst::Predicate FPredicate; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1267 | } YYSTYPE; |
| 1268 | /* Line 196 of yacc.c. */ |
| 1269 | #line 1270 "llvmAsmParser.tab.c" |
| 1270 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1271 | # define YYSTYPE_IS_DECLARED 1 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1272 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1273 | #endif |
| 1274 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1275 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1276 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1277 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1278 | |
| 1279 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1280 | /* Line 219 of yacc.c. */ |
| 1281 | #line 1282 "llvmAsmParser.tab.c" |
| 1282 | |
| 1283 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1284 | # define YYSIZE_T __SIZE_TYPE__ |
| 1285 | #endif |
| 1286 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1287 | # define YYSIZE_T size_t |
| 1288 | #endif |
| 1289 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1290 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1291 | # define YYSIZE_T size_t |
| 1292 | #endif |
| 1293 | #if ! defined (YYSIZE_T) |
| 1294 | # define YYSIZE_T unsigned int |
| 1295 | #endif |
| 1296 | |
| 1297 | #ifndef YY_ |
| 1298 | # if YYENABLE_NLS |
| 1299 | # if ENABLE_NLS |
| 1300 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1301 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1302 | # endif |
| 1303 | # endif |
| 1304 | # ifndef YY_ |
| 1305 | # define YY_(msgid) msgid |
| 1306 | # endif |
| 1307 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1308 | |
| 1309 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1310 | |
| 1311 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1312 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1313 | # ifdef YYSTACK_USE_ALLOCA |
| 1314 | # if YYSTACK_USE_ALLOCA |
| 1315 | # ifdef __GNUC__ |
| 1316 | # define YYSTACK_ALLOC __builtin_alloca |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1317 | # else |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1318 | # define YYSTACK_ALLOC alloca |
| 1319 | # if defined (__STDC__) || defined (__cplusplus) |
| 1320 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1321 | # define YYINCLUDED_STDLIB_H |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1322 | # endif |
| 1323 | # endif |
| 1324 | # endif |
| 1325 | # endif |
| 1326 | |
| 1327 | # ifdef YYSTACK_ALLOC |
| 1328 | /* Pacify GCC's `empty if-body' warning. */ |
| 1329 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1330 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1331 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1332 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1333 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1334 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1335 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1336 | # endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1337 | # else |
| 1338 | # define YYSTACK_ALLOC YYMALLOC |
| 1339 | # define YYSTACK_FREE YYFREE |
| 1340 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1341 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1342 | # endif |
| 1343 | # ifdef __cplusplus |
| 1344 | extern "C" { |
| 1345 | # endif |
| 1346 | # ifndef YYMALLOC |
| 1347 | # define YYMALLOC malloc |
| 1348 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1349 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1350 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1351 | # endif |
| 1352 | # endif |
| 1353 | # ifndef YYFREE |
| 1354 | # define YYFREE free |
| 1355 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1356 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1357 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1358 | # endif |
| 1359 | # endif |
| 1360 | # ifdef __cplusplus |
| 1361 | } |
| 1362 | # endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1363 | # endif |
| 1364 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1365 | |
| 1366 | |
| 1367 | #if (! defined (yyoverflow) \ |
| 1368 | && (! defined (__cplusplus) \ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1369 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1370 | |
| 1371 | /* A type that is properly aligned for any stack member. */ |
| 1372 | union yyalloc |
| 1373 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1374 | short int yyss; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1375 | YYSTYPE yyvs; |
| 1376 | }; |
| 1377 | |
| 1378 | /* The size of the maximum gap between one aligned stack and the next. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1379 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1380 | |
| 1381 | /* The size of an array large to enough to hold all stacks, each with |
| 1382 | N elements. */ |
| 1383 | # define YYSTACK_BYTES(N) \ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1384 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1385 | + YYSTACK_GAP_MAXIMUM) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1386 | |
| 1387 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1388 | not overlap. */ |
| 1389 | # ifndef YYCOPY |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1390 | # if defined (__GNUC__) && 1 < __GNUC__ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1391 | # define YYCOPY(To, From, Count) \ |
| 1392 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1393 | # else |
| 1394 | # define YYCOPY(To, From, Count) \ |
| 1395 | do \ |
| 1396 | { \ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1397 | YYSIZE_T yyi; \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1398 | for (yyi = 0; yyi < (Count); yyi++) \ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1399 | (To)[yyi] = (From)[yyi]; \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1400 | } \ |
| 1401 | while (0) |
| 1402 | # endif |
| 1403 | # endif |
| 1404 | |
| 1405 | /* Relocate STACK from its old location to the new one. The |
| 1406 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1407 | elements in the stack, and YYPTR gives the new location of the |
| 1408 | stack. Advance YYPTR to a properly aligned location for the next |
| 1409 | stack. */ |
| 1410 | # define YYSTACK_RELOCATE(Stack) \ |
| 1411 | do \ |
| 1412 | { \ |
| 1413 | YYSIZE_T yynewbytes; \ |
| 1414 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1415 | Stack = &yyptr->Stack; \ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1416 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1417 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1418 | } \ |
| 1419 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1420 | |
| 1421 | #endif |
| 1422 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1423 | #if defined (__STDC__) || defined (__cplusplus) |
| 1424 | typedef signed char yysigned_char; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 1425 | #else |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1426 | typedef short int yysigned_char; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 1427 | #endif |
| 1428 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1429 | /* YYFINAL -- State number of the termination state. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1430 | #define YYFINAL 40 |
| 1431 | /* YYLAST -- Last index in YYTABLE. */ |
| 1432 | #define YYLAST 1476 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1433 | |
| 1434 | /* YYNTOKENS -- Number of terminals. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1435 | #define YYNTOKENS 145 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1436 | /* YYNNTS -- Number of nonterminals. */ |
| 1437 | #define YYNNTS 79 |
| 1438 | /* YYNRULES -- Number of rules. */ |
| 1439 | #define YYNRULES 285 |
| 1440 | /* YYNRULES -- Number of states. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1441 | #define YYNSTATES 566 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1442 | |
| 1443 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1444 | #define YYUNDEFTOK 2 |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1445 | #define YYMAXUTOK 385 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1446 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1447 | #define YYTRANSLATE(YYX) \ |
| 1448 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1449 | |
| 1450 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1451 | static const unsigned char yytranslate[] = |
| 1452 | { |
| 1453 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1454 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1455 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1456 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1457 | 135, 136, 133, 2, 132, 2, 2, 2, 2, 2, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1458 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1459 | 140, 131, 141, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1460 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1461 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1462 | 2, 137, 134, 139, 2, 2, 2, 2, 2, 144, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1464 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1465 | 138, 2, 2, 142, 2, 143, 2, 2, 2, 2, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1466 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1467 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1468 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1469 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1470 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1471 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1475 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1478 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1479 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1480 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1481 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1482 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1483 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1484 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1485 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1486 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1487 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1488 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1489 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1490 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1491 | 125, 126, 127, 128, 129, 130 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1492 | }; |
| 1493 | |
| 1494 | #if YYDEBUG |
| 1495 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1496 | YYRHS. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1497 | static const unsigned short int yyprhs[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1498 | { |
| 1499 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1500 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1501 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1502 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1503 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1504 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1505 | 119, 121, 122, 125, 126, 128, 130, 133, 134, 136, |
| 1506 | 138, 140, 142, 144, 146, 148, 150, 151, 153, 154, |
| 1507 | 156, 158, 159, 161, 163, 165, 167, 168, 170, 172, |
| 1508 | 174, 176, 178, 180, 183, 185, 187, 188, 191, 193, |
| 1509 | 195, 196, 199, 200, 203, 204, 208, 211, 212, 214, |
| 1510 | 215, 219, 221, 224, 226, 228, 230, 232, 234, 236, |
| 1511 | 239, 241, 244, 250, 256, 262, 268, 272, 275, 281, |
| 1512 | 286, 289, 291, 293, 295, 299, 301, 305, 307, 308, |
| 1513 | 310, 314, 319, 323, 327, 332, 337, 341, 348, 354, |
| 1514 | 357, 360, 363, 366, 369, 372, 375, 378, 381, 384, |
| 1515 | 391, 397, 406, 413, 420, 428, 436, 443, 450, 459, |
| 1516 | 468, 472, 474, 476, 478, 480, 481, 483, 486, 487, |
| 1517 | 491, 492, 496, 500, 502, 506, 510, 511, 518, 519, |
| 1518 | 527, 528, 536, 539, 543, 545, 549, 553, 557, 561, |
| 1519 | 563, 564, 570, 574, 576, 580, 582, 583, 593, 595, |
| 1520 | 597, 602, 604, 606, 609, 613, 614, 616, 618, 620, |
| 1521 | 622, 624, 626, 628, 630, 632, 636, 638, 644, 646, |
| 1522 | 648, 650, 652, 654, 656, 659, 662, 665, 669, 672, |
| 1523 | 673, 675, 678, 681, 685, 695, 705, 714, 729, 731, |
| 1524 | 733, 740, 746, 749, 756, 764, 768, 774, 775, 776, |
| 1525 | 780, 783, 785, 791, 797, 804, 811, 816, 821, 828, |
| 1526 | 833, 838, 845, 852, 855, 864, 866, 868, 869, 873, |
| 1527 | 880, 884, 891, 894, 899, 906 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1528 | }; |
| 1529 | |
| 1530 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1531 | static const short int yyrhs[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1532 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1533 | 186, 0, -1, 67, -1, 68, -1, 69, -1, 70, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1534 | -1, 71, -1, 72, -1, 73, -1, 74, -1, 75, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1535 | -1, 76, -1, 77, -1, 78, -1, 107, -1, 108, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1536 | -1, 109, -1, 110, -1, 111, -1, 112, -1, 113, |
| 1537 | -1, 114, -1, 115, -1, 116, -1, 117, -1, 118, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1538 | -1, 121, -1, 122, -1, 123, -1, 81, -1, 82, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1539 | -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, |
| 1540 | -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, |
| 1541 | -1, 93, -1, 94, -1, 95, -1, 96, -1, 97, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1542 | -1, 98, -1, 99, -1, 100, -1, 87, -1, 88, |
| 1543 | -1, 89, -1, 90, -1, 21, -1, 22, -1, 9, |
| 1544 | -1, 10, -1, 11, -1, 14, -1, 17, -1, 154, |
| 1545 | -1, -1, 154, 131, -1, -1, 15, -1, 18, -1, |
| 1546 | 157, 131, -1, -1, 35, -1, 37, -1, 36, -1, |
| 1547 | 38, -1, 40, -1, 39, -1, 41, -1, 43, -1, |
| 1548 | -1, 130, -1, -1, 39, -1, 41, -1, -1, 35, |
| 1549 | -1, 36, -1, 37, -1, 40, -1, -1, 54, -1, |
| 1550 | 55, -1, 56, -1, 57, -1, 58, -1, 59, -1, |
| 1551 | 53, 4, -1, 108, -1, 109, -1, -1, 166, 165, |
| 1552 | -1, 128, -1, 165, -1, -1, 168, 167, -1, -1, |
| 1553 | 46, 4, -1, -1, 132, 46, 4, -1, 29, 17, |
| 1554 | -1, -1, 171, -1, -1, 132, 174, 173, -1, 171, |
| 1555 | -1, 46, 4, -1, 9, -1, 10, -1, 11, -1, |
| 1556 | 12, -1, 42, -1, 175, -1, 176, 133, -1, 208, |
| 1557 | -1, 134, 4, -1, 176, 135, 180, 136, 168, -1, |
| 1558 | 8, 135, 180, 136, 168, -1, 137, 4, 138, 176, |
| 1559 | 139, -1, 140, 4, 138, 176, 141, -1, 142, 181, |
| 1560 | 143, -1, 142, 143, -1, 140, 142, 181, 143, 141, |
| 1561 | -1, 140, 142, 143, 141, -1, 176, 166, -1, 176, |
| 1562 | -1, 8, -1, 177, -1, 179, 132, 177, -1, 179, |
| 1563 | -1, 179, 132, 32, -1, 32, -1, -1, 176, -1, |
| 1564 | 181, 132, 176, -1, 176, 137, 184, 139, -1, 176, |
| 1565 | 137, 139, -1, 176, 144, 17, -1, 176, 140, 184, |
| 1566 | 141, -1, 176, 142, 184, 143, -1, 176, 142, 143, |
| 1567 | -1, 176, 140, 142, 184, 143, 141, -1, 176, 140, |
| 1568 | 142, 143, 141, -1, 176, 33, -1, 176, 34, -1, |
| 1569 | 176, 208, -1, 176, 183, -1, 176, 20, -1, 152, |
| 1570 | 3, -1, 152, 4, -1, 9, 21, -1, 9, 22, |
| 1571 | -1, 153, 7, -1, 148, 135, 182, 31, 176, 136, |
| 1572 | -1, 106, 135, 182, 219, 136, -1, 120, 135, 182, |
| 1573 | 132, 182, 132, 182, 136, -1, 146, 135, 182, 132, |
| 1574 | 182, 136, -1, 147, 135, 182, 132, 182, 136, -1, |
| 1575 | 79, 150, 135, 182, 132, 182, 136, -1, 80, 151, |
| 1576 | 135, 182, 132, 182, 136, -1, 149, 135, 182, 132, |
| 1577 | 182, 136, -1, 125, 135, 182, 132, 182, 136, -1, |
| 1578 | 126, 135, 182, 132, 182, 132, 182, 136, -1, 127, |
| 1579 | 135, 182, 132, 182, 132, 182, 136, -1, 184, 132, |
| 1580 | 182, -1, 182, -1, 27, -1, 28, -1, 187, -1, |
| 1581 | -1, 188, -1, 187, 188, -1, -1, 26, 189, 204, |
| 1582 | -1, -1, 25, 190, 205, -1, 51, 50, 194, -1, |
| 1583 | 19, -1, 156, 13, 176, -1, 156, 13, 8, -1, |
| 1584 | -1, 158, 161, 185, 182, 191, 173, -1, -1, 158, |
| 1585 | 159, 161, 185, 182, 192, 173, -1, -1, 158, 160, |
| 1586 | 161, 185, 176, 193, 173, -1, 44, 195, -1, 47, |
| 1587 | 131, 196, -1, 17, -1, 45, 131, 17, -1, 60, |
| 1588 | 131, 17, -1, 137, 197, 139, -1, 197, 132, 17, |
| 1589 | -1, 17, -1, -1, 198, 132, 176, 166, 155, -1, |
| 1590 | 176, 166, 155, -1, 198, -1, 198, 132, 32, -1, |
| 1591 | 32, -1, -1, 164, 178, 157, 135, 199, 136, 168, |
| 1592 | 172, 169, -1, 23, -1, 142, -1, 163, 161, 200, |
| 1593 | 201, -1, 24, -1, 143, -1, 211, 203, -1, 162, |
| 1594 | 161, 200, -1, -1, 52, -1, 3, -1, 4, -1, |
| 1595 | 7, -1, 21, -1, 22, -1, 33, -1, 34, -1, |
| 1596 | 20, -1, 140, 184, 141, -1, 183, -1, 50, 206, |
| 1597 | 17, 132, 17, -1, 5, -1, 6, -1, 154, -1, |
| 1598 | 157, -1, 208, -1, 207, -1, 176, 209, -1, 211, |
| 1599 | 212, -1, 202, 212, -1, 213, 156, 214, -1, 213, |
| 1600 | 216, -1, -1, 16, -1, 61, 210, -1, 61, 8, |
| 1601 | -1, 62, 12, 209, -1, 62, 9, 209, 132, 12, |
| 1602 | 209, 132, 12, 209, -1, 63, 152, 209, 132, 12, |
| 1603 | 209, 137, 215, 139, -1, 63, 152, 209, 132, 12, |
| 1604 | 209, 137, 139, -1, 64, 164, 178, 209, 135, 218, |
| 1605 | 136, 168, 31, 12, 209, 65, 12, 209, -1, 65, |
| 1606 | -1, 66, -1, 215, 152, 207, 132, 12, 209, -1, |
| 1607 | 152, 207, 132, 12, 209, -1, 156, 221, -1, 176, |
| 1608 | 137, 209, 132, 209, 139, -1, 217, 132, 137, 209, |
| 1609 | 132, 209, 139, -1, 176, 209, 166, -1, 218, 132, |
| 1610 | 176, 209, 166, -1, -1, -1, 219, 132, 210, -1, |
| 1611 | 49, 48, -1, 48, -1, 146, 176, 209, 132, 209, |
| 1612 | -1, 147, 176, 209, 132, 209, -1, 79, 150, 176, |
| 1613 | 209, 132, 209, -1, 80, 151, 176, 209, 132, 209, |
| 1614 | -1, 149, 210, 132, 210, -1, 148, 210, 31, 176, |
| 1615 | -1, 120, 210, 132, 210, 132, 210, -1, 124, 210, |
| 1616 | 132, 176, -1, 125, 210, 132, 210, -1, 126, 210, |
| 1617 | 132, 210, 132, 210, -1, 127, 210, 132, 210, 132, |
| 1618 | 210, -1, 119, 217, -1, 220, 164, 178, 209, 135, |
| 1619 | 218, 136, 168, -1, 223, -1, 30, -1, -1, 101, |
| 1620 | 176, 170, -1, 101, 176, 132, 9, 209, 170, -1, |
| 1621 | 102, 176, 170, -1, 102, 176, 132, 9, 209, 170, |
| 1622 | -1, 103, 210, -1, 222, 104, 176, 209, -1, 222, |
| 1623 | 105, 210, 132, 176, 209, -1, 106, 176, 209, 219, |
| 1624 | -1 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1625 | }; |
| 1626 | |
| 1627 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1628 | static const unsigned short int yyrline[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1629 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1630 | 0, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, |
| 1631 | 1032, 1033, 1033, 1033, 1034, 1034, 1034, 1034, 1034, 1034, |
| 1632 | 1035, 1035, 1035, 1035, 1035, 1035, 1036, 1036, 1036, 1038, |
| 1633 | 1038, 1039, 1039, 1040, 1040, 1041, 1041, 1042, 1042, 1046, |
| 1634 | 1046, 1047, 1047, 1048, 1048, 1049, 1049, 1050, 1050, 1051, |
| 1635 | 1051, 1052, 1052, 1053, 1054, 1059, 1060, 1060, 1062, 1062, |
| 1636 | 1063, 1063, 1067, 1071, 1076, 1076, 1078, 1082, 1088, 1089, |
| 1637 | 1090, 1091, 1092, 1096, 1097, 1098, 1102, 1103, 1107, 1108, |
| 1638 | 1109, 1113, 1114, 1115, 1116, 1117, 1120, 1121, 1122, 1123, |
| 1639 | 1124, 1125, 1126, 1127, 1134, 1135, 1138, 1139, 1144, 1145, |
| 1640 | 1148, 1149, 1156, 1157, 1163, 1164, 1172, 1180, 1181, 1186, |
| 1641 | 1187, 1188, 1193, 1206, 1206, 1206, 1206, 1209, 1213, 1217, |
| 1642 | 1224, 1229, 1237, 1255, 1273, 1278, 1290, 1300, 1304, 1314, |
| 1643 | 1321, 1328, 1335, 1340, 1345, 1352, 1353, 1360, 1367, 1375, |
| 1644 | 1380, 1391, 1419, 1435, 1464, 1492, 1517, 1536, 1561, 1580, |
| 1645 | 1592, 1599, 1665, 1675, 1685, 1691, 1697, 1702, 1707, 1715, |
| 1646 | 1727, 1748, 1756, 1762, 1773, 1778, 1783, 1792, 1798, 1804, |
| 1647 | 1813, 1817, 1825, 1825, 1836, 1841, 1849, 1850, 1854, 1854, |
| 1648 | 1858, 1858, 1861, 1864, 1876, 1900, 1911, 1911, 1921, 1921, |
| 1649 | 1929, 1929, 1939, 1942, 1948, 1961, 1965, 1970, 1972, 1977, |
| 1650 | 1982, 1991, 2001, 2012, 2016, 2025, 2034, 2039, 2145, 2145, |
| 1651 | 2147, 2156, 2156, 2158, 2163, 2175, 2179, 2184, 2188, 2192, |
| 1652 | 2196, 2200, 2204, 2208, 2212, 2216, 2241, 2245, 2259, 2263, |
| 1653 | 2267, 2271, 2277, 2277, 2283, 2292, 2296, 2305, 2316, 2325, |
| 1654 | 2337, 2350, 2354, 2358, 2363, 2373, 2392, 2401, 2468, 2472, |
| 1655 | 2479, 2490, 2503, 2512, 2523, 2533, 2541, 2549, 2552, 2553, |
| 1656 | 2560, 2564, 2569, 2590, 2607, 2620, 2633, 2642, 2654, 2662, |
| 1657 | 2669, 2675, 2681, 2687, 2702, 2766, 2771, 2775, 2782, 2789, |
| 1658 | 2797, 2804, 2812, 2820, 2834, 2851 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1659 | }; |
| 1660 | #endif |
| 1661 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1662 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1663 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1664 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1665 | static const char *const yytname[] = |
| 1666 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1667 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", |
| 1668 | "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", "FLOAT", |
| 1669 | "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR", |
| 1670 | "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION", |
| 1671 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1672 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1673 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
| 1674 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1675 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL", |
| 1676 | "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", |
| 1677 | "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", |
| 1678 | "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", |
| 1679 | "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", |
| 1680 | "AND", "OR", "XOR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", |
| 1681 | "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", |
| 1682 | "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", |
| 1683 | "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", |
| 1684 | "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", |
| 1685 | "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR", "ASHR", "VAARG", |
| 1686 | "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", |
| 1687 | "DEFAULT", "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", |
| 1688 | "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", |
| 1689 | "ArithmeticOps", "LogicalOps", "CastOps", "ShiftOps", "IPredicates", |
| 1690 | "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName", |
| 1691 | "OptLocalAssign", "GlobalName", "OptGlobalAssign", "GVInternalLinkage", |
| 1692 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1693 | "FunctionDefineLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs", |
| 1694 | "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", |
| 1695 | "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", |
| 1696 | "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", |
| 1697 | "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType", |
| 1698 | "Module", "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", |
| 1699 | "AsmBlock", "TargetDefinition", "LibrariesDefinition", "LibList", |
| 1700 | "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", |
| 1701 | "END", "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1702 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", |
| 1703 | "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", |
| 1704 | "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal", |
| 1705 | "OptVolatile", "MemoryInst", 0 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1706 | }; |
| 1707 | #endif |
| 1708 | |
| 1709 | # ifdef YYPRINT |
| 1710 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1711 | token YYLEX-NUM. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1712 | static const unsigned short int yytoknum[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1713 | { |
| 1714 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1715 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1716 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1717 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1718 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1719 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1720 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1721 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1722 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1723 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1724 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1725 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1726 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1727 | 385, 61, 44, 42, 92, 40, 41, 91, 120, 93, |
| 1728 | 60, 62, 123, 125, 99 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1729 | }; |
| 1730 | # endif |
| 1731 | |
| 1732 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1733 | static const unsigned char yyr1[] = |
| 1734 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1735 | 0, 145, 146, 146, 146, 146, 146, 146, 146, 146, |
| 1736 | 146, 147, 147, 147, 148, 148, 148, 148, 148, 148, |
| 1737 | 148, 148, 148, 148, 148, 148, 149, 149, 149, 150, |
| 1738 | 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, |
| 1739 | 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, |
| 1740 | 151, 151, 151, 151, 151, 152, 153, 153, 154, 154, |
| 1741 | 155, 155, 156, 156, 157, 157, 158, 158, 159, 159, |
| 1742 | 159, 159, 159, 160, 160, 160, 161, 161, 162, 162, |
| 1743 | 162, 163, 163, 163, 163, 163, 164, 164, 164, 164, |
| 1744 | 164, 164, 164, 164, 165, 165, 166, 166, 167, 167, |
| 1745 | 168, 168, 169, 169, 170, 170, 171, 172, 172, 173, |
| 1746 | 173, 174, 174, 175, 175, 175, 175, 176, 176, 176, |
| 1747 | 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, |
| 1748 | 177, 178, 178, 179, 179, 180, 180, 180, 180, 181, |
| 1749 | 181, 182, 182, 182, 182, 182, 182, 182, 182, 182, |
| 1750 | 182, 182, 182, 182, 182, 182, 182, 182, 182, 183, |
| 1751 | 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, |
| 1752 | 184, 184, 185, 185, 186, 186, 187, 187, 189, 188, |
| 1753 | 190, 188, 188, 188, 188, 188, 191, 188, 192, 188, |
| 1754 | 193, 188, 188, 188, 194, 195, 195, 196, 197, 197, |
| 1755 | 197, 198, 198, 199, 199, 199, 199, 200, 201, 201, |
| 1756 | 202, 203, 203, 204, 205, 206, 206, 207, 207, 207, |
| 1757 | 207, 207, 207, 207, 207, 207, 207, 207, 208, 208, |
| 1758 | 208, 208, 209, 209, 210, 211, 211, 212, 213, 213, |
| 1759 | 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, |
| 1760 | 215, 215, 216, 217, 217, 218, 218, 218, 219, 219, |
| 1761 | 220, 220, 221, 221, 221, 221, 221, 221, 221, 221, |
| 1762 | 221, 221, 221, 221, 221, 221, 222, 222, 223, 223, |
| 1763 | 223, 223, 223, 223, 223, 223 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1764 | }; |
| 1765 | |
| 1766 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1767 | static const unsigned char yyr2[] = |
| 1768 | { |
| 1769 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1770 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1771 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1772 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1773 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1774 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1775 | 1, 0, 2, 0, 1, 1, 2, 0, 1, 1, |
| 1776 | 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, |
| 1777 | 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, |
| 1778 | 1, 1, 1, 2, 1, 1, 0, 2, 1, 1, |
| 1779 | 0, 2, 0, 2, 0, 3, 2, 0, 1, 0, |
| 1780 | 3, 1, 2, 1, 1, 1, 1, 1, 1, 2, |
| 1781 | 1, 2, 5, 5, 5, 5, 3, 2, 5, 4, |
| 1782 | 2, 1, 1, 1, 3, 1, 3, 1, 0, 1, |
| 1783 | 3, 4, 3, 3, 4, 4, 3, 6, 5, 2, |
| 1784 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, |
| 1785 | 5, 8, 6, 6, 7, 7, 6, 6, 8, 8, |
| 1786 | 3, 1, 1, 1, 1, 0, 1, 2, 0, 3, |
| 1787 | 0, 3, 3, 1, 3, 3, 0, 6, 0, 7, |
| 1788 | 0, 7, 2, 3, 1, 3, 3, 3, 3, 1, |
| 1789 | 0, 5, 3, 1, 3, 1, 0, 9, 1, 1, |
| 1790 | 4, 1, 1, 2, 3, 0, 1, 1, 1, 1, |
| 1791 | 1, 1, 1, 1, 1, 3, 1, 5, 1, 1, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1792 | 1, 1, 1, 1, 2, 2, 2, 3, 2, 0, |
| 1793 | 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, |
| 1794 | 6, 5, 2, 6, 7, 3, 5, 0, 0, 3, |
| 1795 | 2, 1, 5, 5, 6, 6, 4, 4, 6, 4, |
| 1796 | 4, 6, 6, 2, 8, 1, 1, 0, 3, 6, |
| 1797 | 3, 6, 2, 4, 6, 4 |
| 1798 | }; |
| 1799 | |
| 1800 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1801 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1802 | means the default is an error. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1803 | static const unsigned short int yydefact[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1804 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1805 | 67, 58, 64, 59, 65, 183, 180, 178, 0, 0, |
| 1806 | 0, 0, 0, 0, 76, 0, 67, 176, 78, 81, |
| 1807 | 0, 0, 192, 0, 0, 62, 0, 66, 68, 70, |
| 1808 | 69, 71, 73, 72, 74, 75, 77, 76, 76, 0, |
| 1809 | 1, 177, 79, 80, 76, 181, 82, 83, 84, 85, |
| 1810 | 76, 239, 179, 239, 0, 0, 200, 193, 194, 182, |
| 1811 | 228, 229, 185, 113, 114, 115, 116, 117, 0, 0, |
| 1812 | 0, 0, 230, 231, 118, 184, 120, 0, 0, 172, |
| 1813 | 173, 0, 86, 86, 240, 236, 63, 211, 212, 213, |
| 1814 | 235, 195, 196, 199, 0, 138, 121, 0, 0, 0, |
| 1815 | 0, 127, 139, 0, 119, 138, 0, 0, 113, 114, |
| 1816 | 115, 0, 0, 0, 186, 0, 87, 88, 89, 90, |
| 1817 | 91, 92, 0, 214, 0, 277, 238, 0, 197, 137, |
| 1818 | 96, 133, 135, 0, 0, 0, 0, 0, 0, 126, |
| 1819 | 0, 188, 190, 156, 157, 154, 155, 158, 153, 149, |
| 1820 | 150, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| 1821 | 11, 12, 13, 0, 0, 0, 14, 15, 16, 17, |
| 1822 | 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, |
| 1823 | 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1824 | 0, 0, 0, 152, 151, 109, 93, 132, 131, 0, |
| 1825 | 208, 209, 210, 276, 261, 0, 0, 0, 0, 86, |
| 1826 | 248, 249, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1827 | 0, 0, 0, 0, 0, 0, 0, 0, 237, 86, |
| 1828 | 252, 0, 275, 198, 130, 0, 100, 0, 0, 129, |
| 1829 | 0, 140, 100, 109, 109, 29, 30, 31, 32, 33, |
| 1830 | 34, 35, 36, 37, 38, 0, 53, 54, 49, 50, |
| 1831 | 51, 52, 39, 40, 41, 42, 43, 44, 45, 46, |
| 1832 | 47, 48, 0, 0, 0, 0, 0, 0, 142, 171, |
| 1833 | 0, 0, 0, 146, 0, 143, 0, 0, 0, 0, |
| 1834 | 0, 187, 0, 260, 242, 0, 241, 0, 0, 55, |
| 1835 | 0, 0, 0, 0, 104, 104, 282, 0, 0, 273, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1836 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1837 | 0, 0, 94, 95, 97, 136, 134, 123, 124, 125, |
| 1838 | 128, 122, 189, 191, 0, 0, 258, 0, 0, 0, |
| 1839 | 0, 0, 141, 127, 139, 0, 144, 145, 0, 0, |
| 1840 | 0, 0, 0, 0, 111, 109, 206, 217, 218, 219, |
| 1841 | 224, 220, 221, 222, 223, 215, 0, 226, 233, 232, |
| 1842 | 234, 0, 243, 0, 0, 0, 0, 0, 278, 0, |
| 1843 | 280, 258, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1844 | 0, 0, 0, 0, 0, 0, 98, 99, 101, 0, |
| 1845 | 0, 0, 0, 0, 0, 0, 170, 148, 0, 0, |
| 1846 | 0, 0, 0, 106, 112, 110, 205, 96, 203, 0, |
| 1847 | 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1848 | 0, 285, 0, 0, 0, 269, 270, 0, 0, 0, |
| 1849 | 0, 267, 266, 0, 283, 0, 0, 0, 0, 160, |
| 1850 | 0, 0, 0, 0, 147, 0, 0, 0, 0, 61, |
| 1851 | 0, 100, 0, 225, 0, 0, 257, 0, 0, 104, |
| 1852 | 105, 104, 0, 0, 0, 0, 0, 262, 263, 257, |
| 1853 | 0, 0, 0, 259, 0, 167, 0, 0, 162, 163, |
| 1854 | 159, 166, 60, 202, 204, 96, 107, 0, 0, 0, |
| 1855 | 0, 0, 264, 265, 0, 279, 281, 0, 0, 268, |
| 1856 | 271, 272, 0, 284, 164, 165, 0, 0, 0, 61, |
| 1857 | 108, 102, 227, 0, 0, 96, 0, 100, 253, 0, |
| 1858 | 100, 161, 168, 169, 201, 0, 207, 0, 246, 0, |
| 1859 | 0, 255, 0, 0, 254, 274, 103, 244, 0, 245, |
| 1860 | 0, 96, 0, 0, 0, 256, 0, 0, 0, 0, |
| 1861 | 251, 0, 0, 250, 0, 247 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1862 | }; |
| 1863 | |
| 1864 | /* YYDEFGOTO[NTERM-NUM]. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1865 | static const short int yydefgoto[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1866 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1867 | -1, 189, 190, 191, 192, 255, 272, 111, 112, 72, |
| 1868 | 493, 12, 73, 14, 37, 38, 39, 44, 50, 122, |
| 1869 | 324, 234, 398, 327, 536, 378, 354, 521, 291, 355, |
| 1870 | 74, 113, 131, 199, 132, 133, 103, 279, 367, 280, |
| 1871 | 81, 15, 16, 17, 19, 18, 195, 243, 244, 59, |
| 1872 | 22, 57, 94, 418, 419, 123, 202, 51, 89, 52, |
| 1873 | 45, 421, 368, 76, 370, 296, 53, 85, 86, 228, |
| 1874 | 540, 126, 309, 501, 401, 229, 230, 231, 232 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1875 | }; |
| 1876 | |
| 1877 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1878 | STATE-NUM. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1879 | #define YYPACT_NINF -440 |
| 1880 | static const short int yypact[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1881 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1882 | 298, -440, -440, -440, -440, -440, -440, -440, 7, -91, |
| 1883 | 83, 26, 134, 37, 52, 152, 776, -440, 178, 108, |
| 1884 | 49, 56, -440, 107, 233, -440, 945, -440, -440, -440, |
| 1885 | -440, -440, -440, -440, -440, -440, -440, 123, 123, 76, |
| 1886 | -440, -440, -440, -440, 123, -440, -440, -440, -440, -440, |
| 1887 | 123, 238, -440, 27, 240, 241, 242, -440, -440, -440, |
| 1888 | -440, -440, 125, -440, -440, -440, -440, -440, 257, 258, |
| 1889 | 4, 24, -440, -440, -440, 103, -440, 76, 76, -440, |
| 1890 | -440, 1189, 175, 175, -440, -440, 171, -440, -440, -440, |
| 1891 | -440, -440, -440, -440, -34, 851, -440, 126, 130, 109, |
| 1892 | 125, -440, 103, -78, -440, 851, 1189, 1205, 55, 256, |
| 1893 | 262, 200, 263, 622, -440, 267, -440, -440, -440, -440, |
| 1894 | -440, -440, 1224, -440, -8, 1349, -440, 255, -440, -440, |
| 1895 | 103, -440, 141, 138, 1205, 1205, 140, -64, 1205, -440, |
| 1896 | 143, -440, 103, -440, -440, -440, -440, -440, -440, -440, |
| 1897 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1898 | -440, -440, -440, 450, 481, 145, -440, -440, -440, -440, |
| 1899 | -440, -440, -440, -440, -440, -440, -440, -440, 147, -440, |
| 1900 | -440, -440, 148, 149, 154, 807, 1253, 387, 273, 157, |
| 1901 | 162, 164, 165, -440, -440, 169, -440, 125, 103, 198, |
| 1902 | -440, -440, -440, -440, -440, 227, 1267, 228, 293, 175, |
| 1903 | -440, -440, 450, 481, 1205, 1205, 1205, 1205, 1205, 1205, |
| 1904 | 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, -440, 175, |
| 1905 | -440, 120, -440, -440, 133, 1114, -440, 21, -72, -440, |
| 1906 | 166, 103, -440, 169, 169, -440, -440, -440, -440, -440, |
| 1907 | -440, -440, -440, -440, -440, 168, -440, -440, -440, -440, |
| 1908 | -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, |
| 1909 | -440, -440, 173, 1189, 1189, 1189, 1189, 1189, -440, -440, |
| 1910 | -31, 473, -68, -440, -49, -440, 1189, 1189, 1189, 1189, |
| 1911 | 16, -440, 174, -440, 125, 764, -440, 902, 902, -440, |
| 1912 | 902, 1224, 1205, 1205, 3, 30, -440, 764, 36, 182, |
| 1913 | 187, 188, 189, 190, 193, 764, 764, 275, 194, 1224, |
| 1914 | 1205, 1205, -440, -440, -440, -440, -440, -53, -440, -440, |
| 1915 | -440, -53, -440, -440, 1189, 1189, -440, 195, 196, 197, |
| 1916 | 201, 1189, -440, 191, 622, -36, -440, -440, 203, 204, |
| 1917 | 279, 205, 313, 334, -440, 169, 1154, -440, -440, -440, |
| 1918 | -440, -440, -440, -440, -440, 288, 1189, -440, -440, -440, |
| 1919 | -440, 211, -440, 214, 902, 764, 764, 35, -440, 39, |
| 1920 | -440, -440, 902, 210, 1205, 1205, 1205, 1205, 1205, 216, |
| 1921 | 220, 1205, 1205, 902, 764, 221, -440, -440, -440, 222, |
| 1922 | 223, -30, 1189, 1189, 1189, 1189, -440, -440, 215, 1189, |
| 1923 | 1189, 1205, 1189, -440, -440, -440, -440, 103, 225, 229, |
| 1924 | -440, 341, -16, 352, 356, 234, 239, 245, 902, 366, |
| 1925 | 902, 248, 249, 902, 250, 103, -440, 252, 253, 902, |
| 1926 | 902, 103, -440, 237, -440, 1205, 1189, 1189, 1205, -440, |
| 1927 | 268, 251, 271, 274, -440, 254, 272, 79, 281, 33, |
| 1928 | 1170, -440, 277, -440, 902, 902, 1205, 902, 902, 278, |
| 1929 | -440, 278, 902, 286, 1205, 1205, 1205, -440, -440, 1205, |
| 1930 | 764, 294, 296, -440, 1189, -440, 1189, 1189, -440, -440, |
| 1931 | -440, -440, -440, -440, -440, 103, 31, 357, 301, 236, |
| 1932 | 764, -4, -440, -440, 342, -440, -440, 295, 902, -440, |
| 1933 | -440, -440, 40, -440, -440, -440, 300, 302, 306, 33, |
| 1934 | -440, 343, -440, 382, 10, -440, 1205, -440, -440, 304, |
| 1935 | -440, -440, -440, -440, -440, 403, -440, 902, -440, 1027, |
| 1936 | 14, 133, 764, 22, -440, -53, -440, -440, 305, -440, |
| 1937 | 1027, -440, 432, 433, 314, 133, 902, 902, 435, 390, |
| 1938 | -440, 902, 440, -440, 902, -440 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1939 | }; |
| 1940 | |
| 1941 | /* YYPGOTO[NTERM-NUM]. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1942 | static const short int yypgoto[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1943 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1944 | -440, 331, 332, 333, 335, 259, 264, -206, -440, 0, |
| 1945 | -58, 376, 6, -440, -440, -440, 34, -440, -440, -172, |
| 1946 | -322, -396, -440, -239, -440, -285, -33, -440, -218, -440, |
| 1947 | -440, -25, 230, -270, -440, 359, 367, 139, -109, -159, |
| 1948 | 170, -440, -440, 453, -440, -440, -440, -440, -440, -440, |
| 1949 | -440, -440, -440, -440, -440, 393, -440, -440, -440, -440, |
| 1950 | -440, -440, -439, -89, 124, -209, -440, 417, -440, -440, |
| 1951 | -440, -440, -440, 13, 105, -440, -440, -440, -440 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1952 | }; |
| 1953 | |
| 1954 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 1955 | positive, shift that token. If negative, reduce the rule which |
| 1956 | number is the opposite. If zero, do what YYDEFACT says. |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1957 | If YYTABLE_NINF, syntax error. */ |
| 1958 | #define YYTABLE_NINF -176 |
| 1959 | static const short int yytable[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1960 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 1961 | 11, 75, 300, 331, 193, 397, 13, 306, 98, 397, |
| 1962 | 310, 311, 312, 313, 314, 200, 11, 317, 318, 299, |
| 1963 | 380, 459, 13, 299, 194, 332, 333, 282, 284, 60, |
| 1964 | 61, 374, 100, 63, 64, 65, 66, 301, 1, 2, |
| 1965 | 23, 3, 4, 84, 428, 352, 102, 1, 430, 393, |
| 1966 | 3, 87, 20, 552, 138, 322, 323, 319, -55, -55, |
| 1967 | 352, 104, 353, 105, 341, 139, 67, 21, 138, 329, |
| 1968 | 130, 77, 78, 346, 102, 396, 143, 144, 82, 240, |
| 1969 | 130, 429, 142, 341, 83, 429, 11, 28, 29, 30, |
| 1970 | 31, 32, 33, 34, 347, 35, 341, 198, 127, 519, |
| 1971 | 548, 341, 448, 79, 80, 128, 449, 408, 342, 237, |
| 1972 | 238, 554, 395, 241, 60, 61, 341, 100, 63, 64, |
| 1973 | 65, 66, 345, 1, 2, 463, 3, 4, 526, 541, |
| 1974 | 322, 323, 527, 24, 201, 377, 104, 415, 105, 322, |
| 1975 | 323, 322, 323, 46, 47, 48, 99, 26, 49, 538, |
| 1976 | 396, 67, 40, 549, 104, 555, 105, 25, 68, 396, |
| 1977 | 328, 69, 379, 104, 70, 105, 71, 101, 27, 104, |
| 1978 | 88, 105, 526, 382, 397, 434, 530, 436, 437, 438, |
| 1979 | 54, 295, 36, 442, 505, 1, 506, 55, 3, 304, |
| 1980 | 305, 295, 307, 308, 295, 295, 295, 295, 295, 315, |
| 1981 | 316, 295, 295, 145, 146, 292, 369, 422, 369, 369, |
| 1982 | 130, 369, 104, 2, 105, 490, 4, 42, 369, 43, |
| 1983 | 114, 397, 496, 397, 320, 321, 369, 369, 115, 116, |
| 1984 | 117, 118, 119, 120, 121, 193, 104, 297, 105, 483, |
| 1985 | 298, 322, 323, 68, 56, 141, 69, 106, 107, 70, |
| 1986 | 58, 71, 136, 36, 84, 194, 344, 91, 92, 93, |
| 1987 | 95, 96, 97, -56, 134, 509, 510, 511, 135, -57, |
| 1988 | 147, 196, 233, 235, 236, 293, 198, 375, 376, 242, |
| 1989 | 273, 239, 274, 275, 276, 369, 369, 369, 543, 277, |
| 1990 | 285, 545, 286, 369, 198, 394, 295, 287, -175, 288, |
| 1991 | 289, 290, 299, 334, 369, 369, 391, 330, 335, 356, |
| 1992 | 411, -63, 1, 2, 383, 3, 4, 5, 539, 384, |
| 1993 | 385, 386, 387, 6, 7, 388, 392, 402, 403, 404, |
| 1994 | 413, 417, 407, 405, 550, 409, 410, 412, 414, 369, |
| 1995 | 420, 369, 8, 423, 369, 9, 424, 433, 439, 10, |
| 1996 | 369, 369, 440, 445, 446, 447, 454, 460, 462, 295, |
| 1997 | 435, 295, 295, 295, 464, 461, 441, 295, 465, 466, |
| 1998 | 470, 467, 479, 524, 522, 369, 369, 468, 369, 369, |
| 1999 | 448, 472, 474, 369, 475, 476, 457, 485, 429, 535, |
| 2000 | 488, 369, 60, 61, 537, 100, 108, 109, 110, 66, |
| 2001 | 484, 1, 2, 486, 3, 4, 487, 546, 489, 497, |
| 2002 | 504, 369, 336, 337, 338, 339, 340, 491, 508, 369, |
| 2003 | 480, 371, 372, 295, 373, 348, 349, 350, 351, 67, |
| 2004 | 514, 381, 515, 523, 528, 495, 531, 553, 532, 389, |
| 2005 | 390, 500, 533, 544, 556, 557, 558, 561, 369, 295, |
| 2006 | 295, 295, 564, 369, 500, 562, 224, 225, 226, 492, |
| 2007 | 227, 534, 125, 520, 140, 326, 137, 369, 369, 41, |
| 2008 | 90, 302, 369, 399, 400, 369, 124, 303, 60, 61, |
| 2009 | 406, 100, 108, 109, 110, 66, 431, 1, 2, 0, |
| 2010 | 3, 4, 512, 0, 0, 0, 0, 0, 425, 426, |
| 2011 | 427, 542, 256, 257, 0, 0, 432, 0, 0, 0, |
| 2012 | 0, 0, 0, 0, 0, 67, 0, 443, 444, 492, |
| 2013 | 0, 68, 0, 0, 69, 0, 0, 70, 0, 71, |
| 2014 | 283, 245, 246, 247, 248, 249, 250, 251, 252, 253, |
| 2015 | 254, 450, 451, 452, 453, 0, 0, 0, 455, 456, |
| 2016 | 0, 458, 469, 0, 471, 0, 0, 473, 0, 0, |
| 2017 | 0, 0, 0, 477, 478, 0, 0, 0, 258, 259, |
| 2018 | 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, |
| 2019 | 270, 271, 0, 0, 0, 481, 482, 0, 498, 499, |
| 2020 | 0, 502, 503, 0, 0, 0, 507, 0, 0, 0, |
| 2021 | 0, 0, 0, 0, 513, 0, 0, 68, 0, 0, |
| 2022 | 69, 0, 0, 70, 0, 71, 343, 0, 0, 0, |
| 2023 | 0, 0, 0, 516, 525, 517, 518, 60, 61, 0, |
| 2024 | 0, 0, 529, 0, 0, 0, 1, 2, 0, 3, |
| 2025 | 4, 0, 148, 0, 0, 0, 0, 0, 0, 0, |
| 2026 | 0, 0, 0, 0, 0, 149, 150, 0, 0, 0, |
| 2027 | 0, 547, 0, 0, 0, 0, 551, 0, 0, 0, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2028 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2029 | 559, 560, 0, 0, 0, 563, 0, 0, 565, 151, |
| 2030 | 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, |
| 2031 | 162, 163, 164, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2032 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2033 | 0, 0, 0, 0, 0, 0, 0, 0, 165, 166, |
| 2034 | 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, |
| 2035 | 177, 0, 178, 179, 180, 181, 0, 182, 183, 184, |
| 2036 | 0, 0, 0, 0, 0, 104, 0, 105, 0, 185, |
| 2037 | 0, 0, 186, 0, 187, 0, 188, 357, 358, 60, |
| 2038 | 61, 359, 0, 0, 0, 0, -174, 0, 1, 2, |
| 2039 | 0, 3, 4, 0, 360, 361, 362, 0, 0, -63, |
| 2040 | 1, 2, 0, 3, 4, 5, 0, 363, 364, 0, |
| 2041 | 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, |
| 2042 | 0, 0, 60, 61, 365, 100, 108, 109, 110, 66, |
| 2043 | 8, 1, 2, 9, 3, 4, 0, 10, 0, 0, |
| 2044 | 0, 151, 152, 153, 154, 155, 156, 157, 158, 159, |
| 2045 | 160, 161, 162, 163, 164, 0, 0, 0, 0, 67, |
| 2046 | 0, 0, 0, 0, 0, 0, 60, 61, 0, 100, |
| 2047 | 63, 64, 65, 66, 0, 1, 2, 0, 3, 4, |
| 2048 | 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, |
| 2049 | 175, 176, 177, 129, 178, 179, 180, 181, 0, 182, |
| 2050 | 183, 184, 0, 67, 0, 0, 0, 104, 0, 105, |
| 2051 | 0, 0, 0, 0, 366, 357, 358, 60, 61, 359, |
| 2052 | 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, |
| 2053 | 4, 0, 360, 361, 362, 0, 0, 0, 0, 0, |
| 2054 | 0, 0, 0, 0, 0, 363, 364, 0, 0, 0, |
| 2055 | 0, 68, 0, 0, 69, 0, 278, 70, 0, 71, |
| 2056 | 60, 61, 365, 62, 63, 64, 65, 66, 0, 1, |
| 2057 | 2, 0, 3, 4, 0, 0, 0, 0, 0, 151, |
| 2058 | 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, |
| 2059 | 162, 163, 164, 0, 0, 68, 0, 67, 69, 0, |
| 2060 | 0, 70, 0, 71, 0, 0, 0, 0, 0, 0, |
| 2061 | 0, 0, 0, 0, 0, 0, 0, 0, 165, 166, |
| 2062 | 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, |
| 2063 | 177, 0, 178, 179, 180, 181, 0, 182, 183, 184, |
| 2064 | 357, 358, 0, 0, 359, 0, 0, 0, 0, 0, |
| 2065 | 0, 0, 366, 0, 0, 0, 0, 360, 361, 362, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2066 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2067 | 363, 364, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2068 | 0, 0, 0, 0, 0, 0, 0, 365, 0, 68, |
| 2069 | 0, 0, 69, 0, 0, 70, 0, 71, 0, 0, |
| 2070 | 0, 0, 0, 0, 151, 152, 153, 154, 155, 156, |
| 2071 | 157, 158, 159, 160, 161, 162, 163, 164, 0, 0, |
| 2072 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, |
| 2073 | 61, 0, 100, 63, 64, 65, 66, 0, 1, 2, |
| 2074 | 0, 3, 4, 165, 166, 167, 168, 169, 170, 171, |
| 2075 | 172, 173, 174, 175, 176, 177, 325, 178, 179, 180, |
| 2076 | 181, 0, 182, 183, 184, 0, 67, 0, 0, 60, |
| 2077 | 61, 0, 100, 63, 64, 65, 66, 366, 1, 2, |
| 2078 | 0, 3, 4, 0, 0, 60, 61, 0, 100, 63, |
| 2079 | 64, 65, 66, 0, 1, 2, 416, 3, 4, 0, |
| 2080 | 0, 0, 0, 0, 60, 61, 67, 100, 108, 109, |
| 2081 | 110, 66, 494, 1, 2, 0, 3, 4, 0, 0, |
| 2082 | 60, 61, 67, 100, 63, 64, 65, 66, 0, 1, |
| 2083 | 2, 0, 3, 4, 0, 0, 0, 0, 0, 60, |
| 2084 | 61, 67, 197, 63, 64, 65, 66, 0, 1, 2, |
| 2085 | 0, 3, 4, 0, 0, 0, 0, 67, 68, 0, |
| 2086 | 0, 69, 0, 0, 70, 0, 71, 0, 60, 61, |
| 2087 | 0, 100, 108, 109, 110, 66, 67, 1, 2, 0, |
| 2088 | 3, 4, 60, 61, 0, 294, 63, 64, 65, 66, |
| 2089 | 0, 1, 2, 0, 3, 4, 0, 0, 68, 0, |
| 2090 | 0, 69, 0, 0, 70, 67, 71, 0, 0, 0, |
| 2091 | 0, 0, 0, 0, 68, 0, 0, 69, 0, 67, |
| 2092 | 70, 0, 71, 0, 0, 0, 0, 0, 0, 0, |
| 2093 | 0, 0, 0, 68, 0, 0, 69, 0, 0, 70, |
| 2094 | 0, 71, 0, 0, 0, 0, 0, 0, 0, 68, |
| 2095 | 0, 0, 69, 0, 0, 70, 0, 71, 0, 0, |
| 2096 | 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, |
| 2097 | 0, 69, 0, 0, 70, 0, 71, 0, 0, 0, |
| 2098 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, |
| 2099 | 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, |
| 2100 | 69, 0, 0, 70, 0, 281, 0, 204, 205, 0, |
| 2101 | 0, 68, 0, 0, 69, 0, 0, 70, 0, 71, |
| 2102 | 206, 207, 208, 209, 210, 211, 151, 152, 153, 154, |
| 2103 | 155, 156, 157, 158, 159, 160, 161, 162, 212, 213, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2104 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2105 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2106 | 214, 215, 216, 0, 0, 217, 166, 167, 168, 169, |
| 2107 | 170, 171, 172, 173, 174, 175, 176, 177, 218, 219, |
| 2108 | 179, 180, 181, 220, 221, 222, 223 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2109 | }; |
| 2110 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2111 | static const short int yycheck[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2112 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2113 | 0, 26, 208, 242, 113, 327, 0, 216, 4, 331, |
| 2114 | 219, 220, 221, 222, 223, 23, 16, 226, 227, 9, |
| 2115 | 305, 417, 16, 9, 113, 243, 244, 186, 187, 5, |
| 2116 | 6, 301, 8, 9, 10, 11, 12, 209, 14, 15, |
| 2117 | 131, 17, 18, 16, 9, 29, 71, 14, 9, 319, |
| 2118 | 17, 24, 45, 31, 132, 108, 109, 229, 3, 4, |
| 2119 | 29, 133, 46, 135, 132, 143, 42, 60, 132, 141, |
| 2120 | 95, 37, 38, 141, 99, 128, 21, 22, 44, 143, |
| 2121 | 105, 46, 107, 132, 50, 46, 86, 35, 36, 37, |
| 2122 | 38, 39, 40, 41, 143, 43, 132, 122, 132, 495, |
| 2123 | 539, 132, 132, 27, 28, 139, 136, 143, 139, 134, |
| 2124 | 135, 550, 321, 138, 5, 6, 132, 8, 9, 10, |
| 2125 | 11, 12, 281, 14, 15, 141, 17, 18, 132, 525, |
| 2126 | 108, 109, 136, 50, 142, 132, 133, 355, 135, 108, |
| 2127 | 109, 108, 109, 35, 36, 37, 142, 13, 40, 139, |
| 2128 | 128, 42, 0, 139, 133, 551, 135, 131, 134, 128, |
| 2129 | 139, 137, 132, 133, 140, 135, 142, 143, 131, 133, |
| 2130 | 143, 135, 132, 137, 496, 384, 136, 386, 387, 388, |
| 2131 | 131, 206, 130, 392, 469, 14, 471, 131, 17, 214, |
| 2132 | 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
| 2133 | 225, 226, 227, 3, 4, 199, 295, 366, 297, 298, |
| 2134 | 235, 300, 133, 15, 135, 136, 18, 39, 307, 41, |
| 2135 | 81, 543, 461, 545, 104, 105, 315, 316, 53, 54, |
| 2136 | 55, 56, 57, 58, 59, 344, 133, 9, 135, 448, |
| 2137 | 12, 108, 109, 134, 137, 106, 137, 77, 78, 140, |
| 2138 | 17, 142, 143, 130, 16, 344, 281, 17, 17, 17, |
| 2139 | 135, 4, 4, 7, 138, 474, 475, 476, 138, 7, |
| 2140 | 7, 4, 17, 132, 136, 48, 301, 302, 303, 136, |
| 2141 | 135, 141, 135, 135, 135, 374, 375, 376, 527, 135, |
| 2142 | 17, 530, 135, 382, 319, 320, 321, 135, 0, 135, |
| 2143 | 135, 132, 9, 135, 393, 394, 31, 141, 135, 135, |
| 2144 | 31, 13, 14, 15, 132, 17, 18, 19, 524, 132, |
| 2145 | 132, 132, 132, 25, 26, 132, 132, 132, 132, 132, |
| 2146 | 17, 356, 141, 132, 540, 132, 132, 132, 4, 428, |
| 2147 | 52, 430, 44, 132, 433, 47, 132, 137, 132, 51, |
| 2148 | 439, 440, 132, 132, 132, 132, 141, 132, 17, 384, |
| 2149 | 385, 386, 387, 388, 12, 136, 391, 392, 12, 135, |
| 2150 | 4, 132, 135, 137, 17, 464, 465, 132, 467, 468, |
| 2151 | 132, 132, 132, 472, 132, 132, 411, 136, 46, 46, |
| 2152 | 136, 480, 5, 6, 12, 8, 9, 10, 11, 12, |
| 2153 | 132, 14, 15, 132, 17, 18, 132, 4, 136, 132, |
| 2154 | 132, 500, 273, 274, 275, 276, 277, 136, 132, 508, |
| 2155 | 445, 297, 298, 448, 300, 286, 287, 288, 289, 42, |
| 2156 | 136, 307, 136, 132, 139, 460, 136, 132, 136, 315, |
| 2157 | 316, 466, 136, 139, 12, 12, 132, 12, 537, 474, |
| 2158 | 475, 476, 12, 542, 479, 65, 125, 125, 125, 459, |
| 2159 | 125, 519, 86, 496, 105, 235, 99, 556, 557, 16, |
| 2160 | 53, 212, 561, 334, 335, 564, 83, 213, 5, 6, |
| 2161 | 341, 8, 9, 10, 11, 12, 381, 14, 15, -1, |
| 2162 | 17, 18, 479, -1, -1, -1, -1, -1, 374, 375, |
| 2163 | 376, 526, 21, 22, -1, -1, 382, -1, -1, -1, |
| 2164 | -1, -1, -1, -1, -1, 42, -1, 393, 394, 519, |
| 2165 | -1, 134, -1, -1, 137, -1, -1, 140, -1, 142, |
| 2166 | 143, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2167 | 90, 402, 403, 404, 405, -1, -1, -1, 409, 410, |
| 2168 | -1, 412, 428, -1, 430, -1, -1, 433, -1, -1, |
| 2169 | -1, -1, -1, 439, 440, -1, -1, -1, 87, 88, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2170 | 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2171 | 99, 100, -1, -1, -1, 446, 447, -1, 464, 465, |
| 2172 | -1, 467, 468, -1, -1, -1, 472, -1, -1, -1, |
| 2173 | -1, -1, -1, -1, 480, -1, -1, 134, -1, -1, |
| 2174 | 137, -1, -1, 140, -1, 142, 143, -1, -1, -1, |
| 2175 | -1, -1, -1, 484, 500, 486, 487, 5, 6, -1, |
| 2176 | -1, -1, 508, -1, -1, -1, 14, 15, -1, 17, |
| 2177 | 18, -1, 20, -1, -1, -1, -1, -1, -1, -1, |
| 2178 | -1, -1, -1, -1, -1, 33, 34, -1, -1, -1, |
| 2179 | -1, 537, -1, -1, -1, -1, 542, -1, -1, -1, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2180 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2181 | 556, 557, -1, -1, -1, 561, -1, -1, 564, 67, |
| 2182 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2183 | 78, 79, 80, -1, -1, -1, -1, -1, -1, -1, |
| 2184 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2185 | -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2186 | 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2187 | 118, -1, 120, 121, 122, 123, -1, 125, 126, 127, |
| 2188 | -1, -1, -1, -1, -1, 133, -1, 135, -1, 137, |
| 2189 | -1, -1, 140, -1, 142, -1, 144, 3, 4, 5, |
| 2190 | 6, 7, -1, -1, -1, -1, 0, -1, 14, 15, |
| 2191 | -1, 17, 18, -1, 20, 21, 22, -1, -1, 13, |
| 2192 | 14, 15, -1, 17, 18, 19, -1, 33, 34, -1, |
| 2193 | -1, 25, 26, -1, -1, -1, -1, -1, -1, -1, |
| 2194 | -1, -1, 5, 6, 50, 8, 9, 10, 11, 12, |
| 2195 | 44, 14, 15, 47, 17, 18, -1, 51, -1, -1, |
| 2196 | -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, |
| 2197 | 76, 77, 78, 79, 80, -1, -1, -1, -1, 42, |
| 2198 | -1, -1, -1, -1, -1, -1, 5, 6, -1, 8, |
| 2199 | 9, 10, 11, 12, -1, 14, 15, -1, 17, 18, |
| 2200 | 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, |
| 2201 | 116, 117, 118, 32, 120, 121, 122, 123, -1, 125, |
| 2202 | 126, 127, -1, 42, -1, -1, -1, 133, -1, 135, |
| 2203 | -1, -1, -1, -1, 140, 3, 4, 5, 6, 7, |
| 2204 | -1, -1, -1, -1, -1, -1, 14, 15, -1, 17, |
| 2205 | 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, |
| 2206 | -1, -1, -1, -1, -1, 33, 34, -1, -1, -1, |
| 2207 | -1, 134, -1, -1, 137, -1, 139, 140, -1, 142, |
| 2208 | 5, 6, 50, 8, 9, 10, 11, 12, -1, 14, |
| 2209 | 15, -1, 17, 18, -1, -1, -1, -1, -1, 67, |
| 2210 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2211 | 78, 79, 80, -1, -1, 134, -1, 42, 137, -1, |
| 2212 | -1, 140, -1, 142, -1, -1, -1, -1, -1, -1, |
| 2213 | -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, |
| 2214 | 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, |
| 2215 | 118, -1, 120, 121, 122, 123, -1, 125, 126, 127, |
| 2216 | 3, 4, -1, -1, 7, -1, -1, -1, -1, -1, |
| 2217 | -1, -1, 140, -1, -1, -1, -1, 20, 21, 22, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2218 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2219 | 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2220 | -1, -1, -1, -1, -1, -1, -1, 50, -1, 134, |
| 2221 | -1, -1, 137, -1, -1, 140, -1, 142, -1, -1, |
| 2222 | -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, |
| 2223 | 73, 74, 75, 76, 77, 78, 79, 80, -1, -1, |
| 2224 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, |
| 2225 | 6, -1, 8, 9, 10, 11, 12, -1, 14, 15, |
| 2226 | -1, 17, 18, 106, 107, 108, 109, 110, 111, 112, |
| 2227 | 113, 114, 115, 116, 117, 118, 32, 120, 121, 122, |
| 2228 | 123, -1, 125, 126, 127, -1, 42, -1, -1, 5, |
| 2229 | 6, -1, 8, 9, 10, 11, 12, 140, 14, 15, |
| 2230 | -1, 17, 18, -1, -1, 5, 6, -1, 8, 9, |
| 2231 | 10, 11, 12, -1, 14, 15, 32, 17, 18, -1, |
| 2232 | -1, -1, -1, -1, 5, 6, 42, 8, 9, 10, |
| 2233 | 11, 12, 32, 14, 15, -1, 17, 18, -1, -1, |
| 2234 | 5, 6, 42, 8, 9, 10, 11, 12, -1, 14, |
| 2235 | 15, -1, 17, 18, -1, -1, -1, -1, -1, 5, |
| 2236 | 6, 42, 8, 9, 10, 11, 12, -1, 14, 15, |
| 2237 | -1, 17, 18, -1, -1, -1, -1, 42, 134, -1, |
| 2238 | -1, 137, -1, -1, 140, -1, 142, -1, 5, 6, |
| 2239 | -1, 8, 9, 10, 11, 12, 42, 14, 15, -1, |
| 2240 | 17, 18, 5, 6, -1, 8, 9, 10, 11, 12, |
| 2241 | -1, 14, 15, -1, 17, 18, -1, -1, 134, -1, |
| 2242 | -1, 137, -1, -1, 140, 42, 142, -1, -1, -1, |
| 2243 | -1, -1, -1, -1, 134, -1, -1, 137, -1, 42, |
| 2244 | 140, -1, 142, -1, -1, -1, -1, -1, -1, -1, |
| 2245 | -1, -1, -1, 134, -1, -1, 137, -1, -1, 140, |
| 2246 | -1, 142, -1, -1, -1, -1, -1, -1, -1, 134, |
| 2247 | -1, -1, 137, -1, -1, 140, -1, 142, -1, -1, |
| 2248 | -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, |
| 2249 | -1, 137, -1, -1, 140, -1, 142, -1, -1, -1, |
| 2250 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, |
| 2251 | -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, |
| 2252 | 137, -1, -1, 140, -1, 142, -1, 48, 49, -1, |
| 2253 | -1, 134, -1, -1, 137, -1, -1, 140, -1, 142, |
| 2254 | 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, |
| 2255 | 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2256 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2257 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2258 | 101, 102, 103, -1, -1, 106, 107, 108, 109, 110, |
| 2259 | 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 2260 | 121, 122, 123, 124, 125, 126, 127 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2261 | }; |
| 2262 | |
| 2263 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2264 | symbol of state STATE-NUM. */ |
| 2265 | static const unsigned char yystos[] = |
| 2266 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2267 | 0, 14, 15, 17, 18, 19, 25, 26, 44, 47, |
| 2268 | 51, 154, 156, 157, 158, 186, 187, 188, 190, 189, |
| 2269 | 45, 60, 195, 131, 50, 131, 13, 131, 35, 36, |
| 2270 | 37, 38, 39, 40, 41, 43, 130, 159, 160, 161, |
| 2271 | 0, 188, 39, 41, 162, 205, 35, 36, 37, 40, |
| 2272 | 163, 202, 204, 211, 131, 131, 137, 196, 17, 194, |
| 2273 | 5, 6, 8, 9, 10, 11, 12, 42, 134, 137, |
| 2274 | 140, 142, 154, 157, 175, 176, 208, 161, 161, 27, |
| 2275 | 28, 185, 161, 161, 16, 212, 213, 24, 143, 203, |
| 2276 | 212, 17, 17, 17, 197, 135, 4, 4, 4, 142, |
| 2277 | 8, 143, 176, 181, 133, 135, 185, 185, 9, 10, |
| 2278 | 11, 152, 153, 176, 182, 53, 54, 55, 56, 57, |
| 2279 | 58, 59, 164, 200, 200, 156, 216, 132, 139, 32, |
| 2280 | 176, 177, 179, 180, 138, 138, 143, 181, 132, 143, |
| 2281 | 180, 182, 176, 21, 22, 3, 4, 7, 20, 33, |
| 2282 | 34, 67, 68, 69, 70, 71, 72, 73, 74, 75, |
| 2283 | 76, 77, 78, 79, 80, 106, 107, 108, 109, 110, |
| 2284 | 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, |
| 2285 | 122, 123, 125, 126, 127, 137, 140, 142, 144, 146, |
| 2286 | 147, 148, 149, 183, 208, 191, 4, 8, 176, 178, |
| 2287 | 23, 142, 201, 30, 48, 49, 61, 62, 63, 64, |
| 2288 | 65, 66, 79, 80, 101, 102, 103, 106, 119, 120, |
| 2289 | 124, 125, 126, 127, 146, 147, 148, 149, 214, 220, |
| 2290 | 221, 222, 223, 17, 166, 132, 136, 176, 176, 141, |
| 2291 | 143, 176, 136, 192, 193, 81, 82, 83, 84, 85, |
| 2292 | 86, 87, 88, 89, 90, 150, 21, 22, 87, 88, |
| 2293 | 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, |
| 2294 | 99, 100, 151, 135, 135, 135, 135, 135, 139, 182, |
| 2295 | 184, 142, 184, 143, 184, 17, 135, 135, 135, 135, |
| 2296 | 132, 173, 157, 48, 8, 176, 210, 9, 12, 9, |
| 2297 | 152, 164, 150, 151, 176, 176, 210, 176, 176, 217, |
| 2298 | 210, 210, 210, 210, 210, 176, 176, 210, 210, 164, |
| 2299 | 104, 105, 108, 109, 165, 32, 177, 168, 139, 141, |
| 2300 | 141, 168, 173, 173, 135, 135, 182, 182, 182, 182, |
| 2301 | 182, 132, 139, 143, 176, 184, 141, 143, 182, 182, |
| 2302 | 182, 182, 29, 46, 171, 174, 135, 3, 4, 7, |
| 2303 | 20, 21, 22, 33, 34, 50, 140, 183, 207, 208, |
| 2304 | 209, 209, 209, 209, 178, 176, 176, 132, 170, 132, |
| 2305 | 170, 209, 137, 132, 132, 132, 132, 132, 132, 209, |
| 2306 | 209, 31, 132, 178, 176, 210, 128, 165, 167, 182, |
| 2307 | 182, 219, 132, 132, 132, 132, 182, 141, 143, 132, |
| 2308 | 132, 31, 132, 17, 4, 173, 32, 176, 198, 199, |
| 2309 | 52, 206, 184, 132, 132, 209, 209, 209, 9, 46, |
| 2310 | 9, 219, 209, 137, 210, 176, 210, 210, 210, 132, |
| 2311 | 132, 176, 210, 209, 209, 132, 132, 132, 132, 136, |
| 2312 | 182, 182, 182, 182, 141, 182, 182, 176, 182, 166, |
| 2313 | 132, 136, 17, 141, 12, 12, 135, 132, 132, 209, |
| 2314 | 4, 209, 132, 209, 132, 132, 132, 209, 209, 135, |
| 2315 | 176, 182, 182, 210, 132, 136, 132, 132, 136, 136, |
| 2316 | 136, 136, 154, 155, 32, 176, 168, 132, 209, 209, |
| 2317 | 176, 218, 209, 209, 132, 170, 170, 209, 132, 210, |
| 2318 | 210, 210, 218, 209, 136, 136, 182, 182, 182, 166, |
| 2319 | 171, 172, 17, 132, 137, 209, 132, 136, 139, 209, |
| 2320 | 136, 136, 136, 136, 155, 46, 169, 12, 139, 152, |
| 2321 | 215, 166, 176, 168, 139, 168, 4, 209, 207, 139, |
| 2322 | 152, 209, 31, 132, 207, 166, 12, 12, 132, 209, |
| 2323 | 209, 12, 65, 209, 12, 209 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2324 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2325 | |
| 2326 | #define yyerrok (yyerrstatus = 0) |
| 2327 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2328 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2329 | #define YYEOF 0 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2330 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2331 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2332 | #define YYABORT goto yyabortlab |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2333 | #define YYERROR goto yyerrorlab |
| 2334 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2335 | |
| 2336 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2337 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2338 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2339 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2340 | #define YYFAIL goto yyerrlab |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2341 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2342 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2343 | |
| 2344 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2345 | do \ |
| 2346 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2347 | { \ |
| 2348 | yychar = (Token); \ |
| 2349 | yylval = (Value); \ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2350 | yytoken = YYTRANSLATE (yychar); \ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2351 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2352 | goto yybackup; \ |
| 2353 | } \ |
| 2354 | else \ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2355 | { \ |
| 2356 | yyerror (YY_("syntax error: cannot back up")); \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2357 | YYERROR; \ |
| 2358 | } \ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2359 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2360 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2361 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2362 | #define YYTERROR 1 |
| 2363 | #define YYERRCODE 256 |
| 2364 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2365 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2366 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2367 | If N is 0, then set CURRENT to the empty location which ends |
| 2368 | the previous symbol: RHS[0] (always defined). */ |
| 2369 | |
| 2370 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2371 | #ifndef YYLLOC_DEFAULT |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2372 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2373 | do \ |
| 2374 | if (N) \ |
| 2375 | { \ |
| 2376 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2377 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2378 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2379 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2380 | } \ |
| 2381 | else \ |
| 2382 | { \ |
| 2383 | (Current).first_line = (Current).last_line = \ |
| 2384 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2385 | (Current).first_column = (Current).last_column = \ |
| 2386 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2387 | } \ |
| 2388 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2389 | #endif |
| 2390 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2391 | |
| 2392 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2393 | This macro was not mandated originally: define only if we know |
| 2394 | we won't break user code: when these are the locations we know. */ |
| 2395 | |
| 2396 | #ifndef YY_LOCATION_PRINT |
| 2397 | # if YYLTYPE_IS_TRIVIAL |
| 2398 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2399 | fprintf (File, "%d.%d-%d.%d", \ |
| 2400 | (Loc).first_line, (Loc).first_column, \ |
| 2401 | (Loc).last_line, (Loc).last_column) |
| 2402 | # else |
| 2403 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2404 | # endif |
| 2405 | #endif |
| 2406 | |
| 2407 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2408 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2409 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2410 | #ifdef YYLEX_PARAM |
| 2411 | # define YYLEX yylex (YYLEX_PARAM) |
| 2412 | #else |
| 2413 | # define YYLEX yylex () |
| 2414 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2415 | |
| 2416 | /* Enable debugging if requested. */ |
| 2417 | #if YYDEBUG |
| 2418 | |
| 2419 | # ifndef YYFPRINTF |
| 2420 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2421 | # define YYFPRINTF fprintf |
| 2422 | # endif |
| 2423 | |
| 2424 | # define YYDPRINTF(Args) \ |
| 2425 | do { \ |
| 2426 | if (yydebug) \ |
| 2427 | YYFPRINTF Args; \ |
| 2428 | } while (0) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2429 | |
| 2430 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2431 | do { \ |
| 2432 | if (yydebug) \ |
| 2433 | { \ |
| 2434 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2435 | yysymprint (stderr, \ |
| 2436 | Type, Value); \ |
| 2437 | YYFPRINTF (stderr, "\n"); \ |
| 2438 | } \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2439 | } while (0) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2440 | |
| 2441 | /*------------------------------------------------------------------. |
| 2442 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2443 | | TOP (included). | |
| 2444 | `------------------------------------------------------------------*/ |
| 2445 | |
| 2446 | #if defined (__STDC__) || defined (__cplusplus) |
| 2447 | static void |
| 2448 | yy_stack_print (short int *bottom, short int *top) |
| 2449 | #else |
| 2450 | static void |
| 2451 | yy_stack_print (bottom, top) |
| 2452 | short int *bottom; |
| 2453 | short int *top; |
| 2454 | #endif |
| 2455 | { |
| 2456 | YYFPRINTF (stderr, "Stack now"); |
| 2457 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2458 | YYFPRINTF (stderr, " %d", *bottom); |
| 2459 | YYFPRINTF (stderr, "\n"); |
| 2460 | } |
| 2461 | |
| 2462 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2463 | do { \ |
| 2464 | if (yydebug) \ |
| 2465 | yy_stack_print ((Bottom), (Top)); \ |
| 2466 | } while (0) |
| 2467 | |
| 2468 | |
| 2469 | /*------------------------------------------------. |
| 2470 | | Report that the YYRULE is going to be reduced. | |
| 2471 | `------------------------------------------------*/ |
| 2472 | |
| 2473 | #if defined (__STDC__) || defined (__cplusplus) |
| 2474 | static void |
| 2475 | yy_reduce_print (int yyrule) |
| 2476 | #else |
| 2477 | static void |
| 2478 | yy_reduce_print (yyrule) |
| 2479 | int yyrule; |
| 2480 | #endif |
| 2481 | { |
| 2482 | int yyi; |
| 2483 | unsigned long int yylno = yyrline[yyrule]; |
| 2484 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2485 | yyrule - 1, yylno); |
| 2486 | /* Print the symbols being reduced, and their result. */ |
| 2487 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2488 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2489 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2490 | } |
| 2491 | |
| 2492 | # define YY_REDUCE_PRINT(Rule) \ |
| 2493 | do { \ |
| 2494 | if (yydebug) \ |
| 2495 | yy_reduce_print (Rule); \ |
| 2496 | } while (0) |
| 2497 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2498 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2499 | multiple parsers can coexist. */ |
| 2500 | int yydebug; |
| 2501 | #else /* !YYDEBUG */ |
| 2502 | # define YYDPRINTF(Args) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2503 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2504 | # define YY_STACK_PRINT(Bottom, Top) |
| 2505 | # define YY_REDUCE_PRINT(Rule) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2506 | #endif /* !YYDEBUG */ |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2507 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2508 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2509 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2510 | #ifndef YYINITDEPTH |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2511 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2512 | #endif |
| 2513 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2514 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2515 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2516 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2517 | Do not make this value too large; the results are undefined if |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2518 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2519 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2520 | |
| 2521 | #ifndef YYMAXDEPTH |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2522 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2523 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2524 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2525 | |
| 2526 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2527 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2528 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2529 | # ifndef yystrlen |
| 2530 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2531 | # define yystrlen strlen |
| 2532 | # else |
| 2533 | /* Return the length of YYSTR. */ |
| 2534 | static YYSIZE_T |
| 2535 | # if defined (__STDC__) || defined (__cplusplus) |
| 2536 | yystrlen (const char *yystr) |
| 2537 | # else |
| 2538 | yystrlen (yystr) |
| 2539 | const char *yystr; |
| 2540 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2541 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2542 | const char *yys = yystr; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2543 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2544 | while (*yys++ != '\0') |
| 2545 | continue; |
| 2546 | |
| 2547 | return yys - yystr - 1; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2548 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2549 | # endif |
| 2550 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2551 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2552 | # ifndef yystpcpy |
| 2553 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2554 | # define yystpcpy stpcpy |
| 2555 | # else |
| 2556 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2557 | YYDEST. */ |
| 2558 | static char * |
| 2559 | # if defined (__STDC__) || defined (__cplusplus) |
| 2560 | yystpcpy (char *yydest, const char *yysrc) |
| 2561 | # else |
| 2562 | yystpcpy (yydest, yysrc) |
| 2563 | char *yydest; |
| 2564 | const char *yysrc; |
| 2565 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2566 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2567 | char *yyd = yydest; |
| 2568 | const char *yys = yysrc; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2569 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2570 | while ((*yyd++ = *yys++) != '\0') |
| 2571 | continue; |
| 2572 | |
| 2573 | return yyd - 1; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2574 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2575 | # endif |
| 2576 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2577 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2578 | # ifndef yytnamerr |
| 2579 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2580 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2581 | heuristic is that double-quoting is unnecessary unless the string |
| 2582 | contains an apostrophe, a comma, or backslash (other than |
| 2583 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2584 | null, do not copy; instead, return the length of what the result |
| 2585 | would have been. */ |
| 2586 | static YYSIZE_T |
| 2587 | yytnamerr (char *yyres, const char *yystr) |
| 2588 | { |
| 2589 | if (*yystr == '"') |
| 2590 | { |
| 2591 | size_t yyn = 0; |
| 2592 | char const *yyp = yystr; |
| 2593 | |
| 2594 | for (;;) |
| 2595 | switch (*++yyp) |
| 2596 | { |
| 2597 | case '\'': |
| 2598 | case ',': |
| 2599 | goto do_not_strip_quotes; |
| 2600 | |
| 2601 | case '\\': |
| 2602 | if (*++yyp != '\\') |
| 2603 | goto do_not_strip_quotes; |
| 2604 | /* Fall through. */ |
| 2605 | default: |
| 2606 | if (yyres) |
| 2607 | yyres[yyn] = *yyp; |
| 2608 | yyn++; |
| 2609 | break; |
| 2610 | |
| 2611 | case '"': |
| 2612 | if (yyres) |
| 2613 | yyres[yyn] = '\0'; |
| 2614 | return yyn; |
| 2615 | } |
| 2616 | do_not_strip_quotes: ; |
| 2617 | } |
| 2618 | |
| 2619 | if (! yyres) |
| 2620 | return yystrlen (yystr); |
| 2621 | |
| 2622 | return yystpcpy (yyres, yystr) - yyres; |
| 2623 | } |
| 2624 | # endif |
| 2625 | |
| 2626 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2627 | |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2628 | |
| 2629 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2630 | #if YYDEBUG |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2631 | /*--------------------------------. |
| 2632 | | Print this symbol on YYOUTPUT. | |
| 2633 | `--------------------------------*/ |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2634 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2635 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2636 | static void |
| 2637 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2638 | #else |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2639 | static void |
| 2640 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2641 | FILE *yyoutput; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2642 | int yytype; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2643 | YYSTYPE *yyvaluep; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2644 | #endif |
| 2645 | { |
| 2646 | /* Pacify ``unused variable'' warnings. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2647 | (void) yyvaluep; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2648 | |
| 2649 | if (yytype < YYNTOKENS) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2650 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2651 | else |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2652 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2653 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2654 | |
| 2655 | # ifdef YYPRINT |
| 2656 | if (yytype < YYNTOKENS) |
| 2657 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2658 | # endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2659 | switch (yytype) |
| 2660 | { |
| 2661 | default: |
| 2662 | break; |
| 2663 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2664 | YYFPRINTF (yyoutput, ")"); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2665 | } |
| 2666 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2667 | #endif /* ! YYDEBUG */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2668 | /*-----------------------------------------------. |
| 2669 | | Release the memory associated to this symbol. | |
| 2670 | `-----------------------------------------------*/ |
| 2671 | |
| 2672 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2673 | static void |
| 2674 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2675 | #else |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2676 | static void |
| 2677 | yydestruct (yymsg, yytype, yyvaluep) |
| 2678 | const char *yymsg; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2679 | int yytype; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2680 | YYSTYPE *yyvaluep; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2681 | #endif |
| 2682 | { |
| 2683 | /* Pacify ``unused variable'' warnings. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2684 | (void) yyvaluep; |
| 2685 | |
| 2686 | if (!yymsg) |
| 2687 | yymsg = "Deleting"; |
| 2688 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2689 | |
| 2690 | switch (yytype) |
| 2691 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2692 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2693 | default: |
| 2694 | break; |
| 2695 | } |
| 2696 | } |
| 2697 | |
| 2698 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2699 | /* Prevent warnings from -Wmissing-prototypes. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2700 | |
| 2701 | #ifdef YYPARSE_PARAM |
| 2702 | # if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2703 | int yyparse (void *YYPARSE_PARAM); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2704 | # else |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2705 | int yyparse (); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2706 | # endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2707 | #else /* ! YYPARSE_PARAM */ |
| 2708 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2709 | int yyparse (void); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2710 | #else |
| 2711 | int yyparse (); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2712 | #endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2713 | #endif /* ! YYPARSE_PARAM */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2714 | |
| 2715 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2716 | |
| 2717 | /* The look-ahead symbol. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2718 | int yychar; |
| 2719 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2720 | /* The semantic value of the look-ahead symbol. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2721 | YYSTYPE yylval; |
| 2722 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2723 | /* Number of syntax errors so far. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2724 | int yynerrs; |
| 2725 | |
| 2726 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2727 | |
| 2728 | /*----------. |
| 2729 | | yyparse. | |
| 2730 | `----------*/ |
| 2731 | |
| 2732 | #ifdef YYPARSE_PARAM |
| 2733 | # if defined (__STDC__) || defined (__cplusplus) |
| 2734 | int yyparse (void *YYPARSE_PARAM) |
| 2735 | # else |
| 2736 | int yyparse (YYPARSE_PARAM) |
| 2737 | void *YYPARSE_PARAM; |
| 2738 | # endif |
| 2739 | #else /* ! YYPARSE_PARAM */ |
| 2740 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2741 | int |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2742 | yyparse (void) |
| 2743 | #else |
| 2744 | int |
| 2745 | yyparse () |
| 2746 | |
| 2747 | #endif |
| 2748 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2749 | { |
| 2750 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2751 | int yystate; |
| 2752 | int yyn; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2753 | int yyresult; |
| 2754 | /* Number of tokens to shift before error messages enabled. */ |
| 2755 | int yyerrstatus; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2756 | /* Look-ahead token as an internal (translated) token number. */ |
| 2757 | int yytoken = 0; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2758 | |
| 2759 | /* Three stacks and their tools: |
| 2760 | `yyss': related to states, |
| 2761 | `yyvs': related to semantic values, |
| 2762 | `yyls': related to locations. |
| 2763 | |
| 2764 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2765 | to reallocate them elsewhere. */ |
| 2766 | |
| 2767 | /* The state stack. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2768 | short int yyssa[YYINITDEPTH]; |
| 2769 | short int *yyss = yyssa; |
| 2770 | short int *yyssp; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2771 | |
| 2772 | /* The semantic value stack. */ |
| 2773 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2774 | YYSTYPE *yyvs = yyvsa; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2775 | YYSTYPE *yyvsp; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2776 | |
| 2777 | |
| 2778 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2779 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2780 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2781 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2782 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2783 | /* The variables used to return semantic value and location from the |
| 2784 | action routines. */ |
| 2785 | YYSTYPE yyval; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2786 | |
| 2787 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2788 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2789 | rule. */ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2790 | int yylen; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2791 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2792 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2793 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2794 | yystate = 0; |
| 2795 | yyerrstatus = 0; |
| 2796 | yynerrs = 0; |
| 2797 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2798 | |
| 2799 | /* Initialize stack pointers. |
| 2800 | Waste one element of value and location stack |
| 2801 | so that they stay on the same level as the state stack. |
| 2802 | The wasted elements are never initialized. */ |
| 2803 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2804 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2805 | yyvsp = yyvs; |
| 2806 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2807 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2808 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2809 | /*------------------------------------------------------------. |
| 2810 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2811 | `------------------------------------------------------------*/ |
| 2812 | yynewstate: |
| 2813 | /* In all cases, when you get here, the value and location stacks |
| 2814 | have just been pushed. so pushing a state here evens the stacks. |
| 2815 | */ |
| 2816 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2817 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2818 | yysetstate: |
| 2819 | *yyssp = yystate; |
| 2820 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2821 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2822 | { |
| 2823 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2824 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2825 | |
| 2826 | #ifdef yyoverflow |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2827 | { |
| 2828 | /* Give user a chance to reallocate the stack. Use copies of |
| 2829 | these so that the &'s don't force the real ones into |
| 2830 | memory. */ |
| 2831 | YYSTYPE *yyvs1 = yyvs; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2832 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2833 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2834 | |
| 2835 | /* Each stack pointer address is followed by the size of the |
| 2836 | data in use in that stack, in bytes. This used to be a |
| 2837 | conditional around just the two extra args, but that might |
| 2838 | be undefined if yyoverflow is a macro. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2839 | yyoverflow (YY_("memory exhausted"), |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2840 | &yyss1, yysize * sizeof (*yyssp), |
| 2841 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2842 | |
| 2843 | &yystacksize); |
| 2844 | |
| 2845 | yyss = yyss1; |
| 2846 | yyvs = yyvs1; |
| 2847 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2848 | #else /* no yyoverflow */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2849 | # ifndef YYSTACK_RELOCATE |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2850 | goto yyexhaustedlab; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2851 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2852 | /* Extend the stack our own way. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2853 | if (YYMAXDEPTH <= yystacksize) |
| 2854 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2855 | yystacksize *= 2; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2856 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2857 | yystacksize = YYMAXDEPTH; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2858 | |
| 2859 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2860 | short int *yyss1 = yyss; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2861 | union yyalloc *yyptr = |
| 2862 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2863 | if (! yyptr) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2864 | goto yyexhaustedlab; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2865 | YYSTACK_RELOCATE (yyss); |
| 2866 | YYSTACK_RELOCATE (yyvs); |
| 2867 | |
| 2868 | # undef YYSTACK_RELOCATE |
| 2869 | if (yyss1 != yyssa) |
| 2870 | YYSTACK_FREE (yyss1); |
| 2871 | } |
| 2872 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2873 | #endif /* no yyoverflow */ |
| 2874 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2875 | yyssp = yyss + yysize - 1; |
| 2876 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2877 | |
| 2878 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2879 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2880 | (unsigned long int) yystacksize)); |
| 2881 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2882 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2883 | YYABORT; |
| 2884 | } |
| 2885 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2886 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2887 | |
| 2888 | goto yybackup; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2889 | |
| 2890 | /*-----------. |
| 2891 | | yybackup. | |
| 2892 | `-----------*/ |
| 2893 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2894 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2895 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2896 | /* Read a look-ahead token if we need one and don't already have one. */ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2897 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2898 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2899 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2900 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2901 | yyn = yypact[yystate]; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2902 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2903 | goto yydefault; |
| 2904 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2905 | /* 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] | 2906 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2907 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2908 | if (yychar == YYEMPTY) |
| 2909 | { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2910 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2911 | yychar = YYLEX; |
| 2912 | } |
| 2913 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2914 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2915 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2916 | yychar = yytoken = YYEOF; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2917 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2918 | } |
| 2919 | else |
| 2920 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2921 | yytoken = YYTRANSLATE (yychar); |
| 2922 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2923 | } |
| 2924 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2925 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2926 | detect an error, take that action. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2927 | yyn += yytoken; |
| 2928 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2929 | goto yydefault; |
| 2930 | yyn = yytable[yyn]; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2931 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2932 | { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2933 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2934 | goto yyerrlab; |
| 2935 | yyn = -yyn; |
| 2936 | goto yyreduce; |
| 2937 | } |
| 2938 | |
| 2939 | if (yyn == YYFINAL) |
| 2940 | YYACCEPT; |
| 2941 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2942 | /* Shift the look-ahead token. */ |
| 2943 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2944 | |
| 2945 | /* Discard the token being shifted unless it is eof. */ |
| 2946 | if (yychar != YYEOF) |
| 2947 | yychar = YYEMPTY; |
| 2948 | |
| 2949 | *++yyvsp = yylval; |
| 2950 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2951 | |
| 2952 | /* Count tokens shifted since error; after three, turn off error |
| 2953 | status. */ |
| 2954 | if (yyerrstatus) |
| 2955 | yyerrstatus--; |
Chris Lattner | 0fab59c | 2007-01-12 18:33:30 +0000 | [diff] [blame] | 2956 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2957 | yystate = yyn; |
| 2958 | goto yynewstate; |
| 2959 | |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2960 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2961 | /*-----------------------------------------------------------. |
| 2962 | | yydefault -- do the default action for the current state. | |
| 2963 | `-----------------------------------------------------------*/ |
| 2964 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2965 | yyn = yydefact[yystate]; |
| 2966 | if (yyn == 0) |
| 2967 | goto yyerrlab; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2968 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2969 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2970 | |
| 2971 | /*-----------------------------. |
| 2972 | | yyreduce -- Do a reduction. | |
| 2973 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2974 | yyreduce: |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2975 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2976 | yylen = yyr2[yyn]; |
| 2977 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2978 | /* If YYLEN is nonzero, implement the default value of the action: |
| 2979 | `$$ = $1'. |
| 2980 | |
| 2981 | Otherwise, the following line sets YYVAL to garbage. |
| 2982 | This behavior is undocumented and Bison |
| 2983 | users should not rely upon it. Assigning to YYVAL |
| 2984 | unconditionally makes the parser a bit smaller, and it avoids a |
| 2985 | GCC warning that YYVAL may be used uninitialized. */ |
| 2986 | yyval = yyvsp[1-yylen]; |
| 2987 | |
| 2988 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2989 | YY_REDUCE_PRINT (yyn); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2990 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2991 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 2992 | case 29: |
| 2993 | #line 1038 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 2994 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 2995 | break; |
| 2996 | |
| 2997 | case 30: |
| 2998 | #line 1038 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 2999 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3000 | break; |
| 3001 | |
| 3002 | case 31: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3003 | #line 1039 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3004 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3005 | break; |
| 3006 | |
| 3007 | case 32: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3008 | #line 1039 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3009 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3010 | break; |
| 3011 | |
| 3012 | case 33: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3013 | #line 1040 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3014 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3015 | break; |
| 3016 | |
| 3017 | case 34: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3018 | #line 1040 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3019 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3020 | break; |
| 3021 | |
| 3022 | case 35: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3023 | #line 1041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3024 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3025 | break; |
| 3026 | |
| 3027 | case 36: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3028 | #line 1041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3029 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3030 | break; |
| 3031 | |
| 3032 | case 37: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3033 | #line 1042 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3034 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3035 | break; |
| 3036 | |
| 3037 | case 38: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3038 | #line 1042 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3039 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3040 | break; |
| 3041 | |
| 3042 | case 39: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3043 | #line 1046 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3044 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3045 | break; |
| 3046 | |
| 3047 | case 40: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3048 | #line 1046 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3049 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3050 | break; |
| 3051 | |
| 3052 | case 41: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3053 | #line 1047 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3054 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3055 | break; |
| 3056 | |
| 3057 | case 42: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3058 | #line 1047 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3059 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3060 | break; |
| 3061 | |
| 3062 | case 43: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3063 | #line 1048 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3064 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3065 | break; |
| 3066 | |
| 3067 | case 44: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3068 | #line 1048 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3069 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3070 | break; |
| 3071 | |
| 3072 | case 45: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3073 | #line 1049 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3074 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3075 | break; |
| 3076 | |
| 3077 | case 46: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3078 | #line 1049 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3079 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3080 | break; |
| 3081 | |
| 3082 | case 47: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3083 | #line 1050 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3084 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3085 | break; |
| 3086 | |
| 3087 | case 48: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3088 | #line 1050 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3089 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3090 | break; |
| 3091 | |
| 3092 | case 49: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3093 | #line 1051 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3094 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3095 | break; |
| 3096 | |
| 3097 | case 50: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3098 | #line 1051 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3099 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3100 | break; |
| 3101 | |
| 3102 | case 51: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3103 | #line 1052 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3104 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3105 | break; |
| 3106 | |
| 3107 | case 52: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3108 | #line 1052 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3109 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3110 | break; |
| 3111 | |
| 3112 | case 53: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3113 | #line 1053 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3114 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3115 | break; |
| 3116 | |
| 3117 | case 54: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3118 | #line 1054 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3119 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3120 | break; |
| 3121 | |
| 3122 | case 61: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3123 | #line 1063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3124 | { (yyval.StrVal) = 0; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3125 | break; |
| 3126 | |
| 3127 | case 62: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3128 | #line 1067 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3129 | { |
| 3130 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
| 3131 | CHECK_FOR_ERROR |
| 3132 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3133 | break; |
| 3134 | |
| 3135 | case 63: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3136 | #line 1071 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3137 | { |
| 3138 | (yyval.StrVal) = 0; |
| 3139 | CHECK_FOR_ERROR |
| 3140 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3141 | break; |
| 3142 | |
| 3143 | case 66: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3144 | #line 1078 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3145 | { |
| 3146 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
| 3147 | CHECK_FOR_ERROR |
| 3148 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3149 | break; |
| 3150 | |
| 3151 | case 67: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3152 | #line 1082 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3153 | { |
| 3154 | (yyval.StrVal) = 0; |
| 3155 | CHECK_FOR_ERROR |
| 3156 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3157 | break; |
| 3158 | |
| 3159 | case 68: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3160 | #line 1088 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3161 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3162 | break; |
| 3163 | |
| 3164 | case 69: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3165 | #line 1089 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3166 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3167 | break; |
| 3168 | |
| 3169 | case 70: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3170 | #line 1090 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3171 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3172 | break; |
| 3173 | |
| 3174 | case 71: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3175 | #line 1091 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3176 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3177 | break; |
| 3178 | |
| 3179 | case 72: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3180 | #line 1092 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3181 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3182 | break; |
| 3183 | |
| 3184 | case 73: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3185 | #line 1096 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3186 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3187 | break; |
| 3188 | |
| 3189 | case 74: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3190 | #line 1097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3191 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3192 | break; |
| 3193 | |
| 3194 | case 75: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3195 | #line 1098 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3196 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3197 | break; |
| 3198 | |
| 3199 | case 76: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3200 | #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3201 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3202 | break; |
| 3203 | |
| 3204 | case 77: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3205 | #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3206 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3207 | break; |
| 3208 | |
| 3209 | case 78: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3210 | #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3211 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3212 | break; |
| 3213 | |
| 3214 | case 79: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3215 | #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3216 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3217 | break; |
| 3218 | |
| 3219 | case 80: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3220 | #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3221 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3222 | break; |
| 3223 | |
| 3224 | case 81: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3225 | #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3226 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3227 | break; |
| 3228 | |
| 3229 | case 82: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3230 | #line 1114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3231 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3232 | break; |
| 3233 | |
| 3234 | case 83: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3235 | #line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3236 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3237 | break; |
| 3238 | |
| 3239 | case 84: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3240 | #line 1116 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3241 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3242 | break; |
| 3243 | |
| 3244 | case 85: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3245 | #line 1117 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3246 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3247 | break; |
| 3248 | |
| 3249 | case 86: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3250 | #line 1120 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3251 | { (yyval.UIntVal) = CallingConv::C; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3252 | break; |
| 3253 | |
| 3254 | case 87: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3255 | #line 1121 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3256 | { (yyval.UIntVal) = CallingConv::C; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3257 | break; |
| 3258 | |
| 3259 | case 88: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3260 | #line 1122 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3261 | { (yyval.UIntVal) = CallingConv::CSRet; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3262 | break; |
| 3263 | |
| 3264 | case 89: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3265 | #line 1123 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3266 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3267 | break; |
| 3268 | |
| 3269 | case 90: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3270 | #line 1124 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3271 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3272 | break; |
| 3273 | |
| 3274 | case 91: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3275 | #line 1125 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3276 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3277 | break; |
| 3278 | |
| 3279 | case 92: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3280 | #line 1126 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3281 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3282 | break; |
| 3283 | |
| 3284 | case 93: |
| 3285 | #line 1127 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3286 | { |
| 3287 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
| 3288 | GEN_ERROR("Calling conv too large!"); |
| 3289 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3290 | CHECK_FOR_ERROR |
| 3291 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3292 | break; |
| 3293 | |
| 3294 | case 94: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3295 | #line 1134 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3296 | { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3297 | break; |
| 3298 | |
| 3299 | case 95: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3300 | #line 1135 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3301 | { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3302 | break; |
| 3303 | |
| 3304 | case 96: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3305 | #line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3306 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3307 | break; |
| 3308 | |
| 3309 | case 97: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3310 | #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3311 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3312 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3313 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3314 | break; |
| 3315 | |
| 3316 | case 98: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3317 | #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3318 | { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3319 | break; |
| 3320 | |
| 3321 | case 100: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3322 | #line 1148 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3323 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3324 | break; |
| 3325 | |
| 3326 | case 101: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3327 | #line 1149 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3328 | { |
| 3329 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); |
| 3330 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3331 | break; |
| 3332 | |
| 3333 | case 102: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3334 | #line 1156 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3335 | { (yyval.UIntVal) = 0; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3336 | break; |
| 3337 | |
| 3338 | case 103: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3339 | #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3340 | { |
| 3341 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3342 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3343 | GEN_ERROR("Alignment must be a power of two!"); |
| 3344 | CHECK_FOR_ERROR |
| 3345 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3346 | break; |
| 3347 | |
| 3348 | case 104: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3349 | #line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3350 | { (yyval.UIntVal) = 0; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3351 | break; |
| 3352 | |
| 3353 | case 105: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3354 | #line 1164 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3355 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3356 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3357 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3358 | GEN_ERROR("Alignment must be a power of two!"); |
| 3359 | CHECK_FOR_ERROR |
| 3360 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3361 | break; |
| 3362 | |
| 3363 | case 106: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3364 | #line 1172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3365 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3366 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3367 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
| 3368 | GEN_ERROR("Invalid character in section name!"); |
| 3369 | (yyval.StrVal) = (yyvsp[0].StrVal); |
| 3370 | CHECK_FOR_ERROR |
| 3371 | ;} |
| 3372 | break; |
| 3373 | |
| 3374 | case 107: |
| 3375 | #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3376 | { (yyval.StrVal) = 0; ;} |
| 3377 | break; |
| 3378 | |
| 3379 | case 108: |
| 3380 | #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3381 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3382 | break; |
| 3383 | |
| 3384 | case 109: |
| 3385 | #line 1186 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3386 | {;} |
| 3387 | break; |
| 3388 | |
| 3389 | case 110: |
| 3390 | #line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3391 | {;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3392 | break; |
| 3393 | |
| 3394 | case 111: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3395 | #line 1188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3396 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3397 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3398 | free((yyvsp[0].StrVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3399 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3400 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3401 | break; |
| 3402 | |
| 3403 | case 112: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3404 | #line 1193 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3405 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3406 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
| 3407 | GEN_ERROR("Alignment must be a power of two!"); |
| 3408 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3409 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3410 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3411 | break; |
| 3412 | |
| 3413 | case 117: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3414 | #line 1209 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3415 | { |
| 3416 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
| 3417 | CHECK_FOR_ERROR |
| 3418 | ;} |
| 3419 | break; |
| 3420 | |
| 3421 | case 118: |
| 3422 | #line 1213 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3423 | { |
| 3424 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
| 3425 | CHECK_FOR_ERROR |
| 3426 | ;} |
| 3427 | break; |
| 3428 | |
| 3429 | case 119: |
| 3430 | #line 1217 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3431 | { // Pointer type? |
| 3432 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
| 3433 | GEN_ERROR("Cannot form a pointer to a basic block"); |
| 3434 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3435 | delete (yyvsp[-1].TypeVal); |
| 3436 | CHECK_FOR_ERROR |
| 3437 | ;} |
| 3438 | break; |
| 3439 | |
| 3440 | case 120: |
| 3441 | #line 1224 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3442 | { // Named types are also simple types... |
| 3443 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
| 3444 | CHECK_FOR_ERROR |
| 3445 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 3446 | ;} |
| 3447 | break; |
| 3448 | |
| 3449 | case 121: |
| 3450 | #line 1229 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3451 | { // Type UpReference |
| 3452 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); |
| 3453 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
| 3454 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3455 | (yyval.TypeVal) = new PATypeHolder(OT); |
| 3456 | UR_OUT("New Upreference!\n"); |
| 3457 | CHECK_FOR_ERROR |
| 3458 | ;} |
| 3459 | break; |
| 3460 | |
| 3461 | case 122: |
| 3462 | #line 1237 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3463 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3464 | std::vector<const Type*> Params; |
| 3465 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3466 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3467 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3468 | Params.push_back(I->Ty->get()); |
| 3469 | if (I->Ty->get() != Type::VoidTy) |
| 3470 | Attrs.push_back(I->Attrs); |
| 3471 | } |
| 3472 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3473 | if (isVarArg) Params.pop_back(); |
| 3474 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3475 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs); |
| 3476 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3477 | delete (yyvsp[-4].TypeVal); // Delete the return type handle |
| 3478 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3479 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3480 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3481 | break; |
| 3482 | |
| 3483 | case 123: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3484 | #line 1255 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3485 | { |
| 3486 | std::vector<const Type*> Params; |
| 3487 | std::vector<FunctionType::ParameterAttributes> Attrs; |
| 3488 | Attrs.push_back((yyvsp[0].ParamAttrs)); |
| 3489 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { |
| 3490 | Params.push_back(I->Ty->get()); |
| 3491 | if (I->Ty->get() != Type::VoidTy) |
| 3492 | Attrs.push_back(I->Attrs); |
| 3493 | } |
| 3494 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3495 | if (isVarArg) Params.pop_back(); |
| 3496 | |
| 3497 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs); |
| 3498 | delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list |
| 3499 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3500 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3501 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3502 | break; |
| 3503 | |
| 3504 | case 124: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3505 | #line 1273 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3506 | { // Sized array type? |
| 3507 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3508 | delete (yyvsp[-1].TypeVal); |
| 3509 | CHECK_FOR_ERROR |
| 3510 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3511 | break; |
| 3512 | |
| 3513 | case 125: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3514 | #line 1278 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3515 | { // Packed array type? |
| 3516 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3517 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
| 3518 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3519 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 3520 | GEN_ERROR("Element type of a PackedType must be primitive"); |
| 3521 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
| 3522 | GEN_ERROR("Vector length should be a power of 2!"); |
| 3523 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3524 | delete (yyvsp[-1].TypeVal); |
| 3525 | CHECK_FOR_ERROR |
| 3526 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3527 | break; |
| 3528 | |
| 3529 | case 126: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3530 | #line 1290 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3531 | { // Structure type? |
| 3532 | std::vector<const Type*> Elements; |
| 3533 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3534 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
| 3535 | Elements.push_back(*I); |
| 3536 | |
| 3537 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3538 | delete (yyvsp[-1].TypeList); |
| 3539 | CHECK_FOR_ERROR |
| 3540 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3541 | break; |
| 3542 | |
| 3543 | case 127: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3544 | #line 1300 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3545 | { // Empty structure type? |
| 3546 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3547 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3548 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3549 | break; |
| 3550 | |
| 3551 | case 128: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3552 | #line 1304 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3553 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3554 | std::vector<const Type*> Elements; |
| 3555 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 3556 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) |
| 3557 | Elements.push_back(*I); |
| 3558 | |
| 3559 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3560 | delete (yyvsp[-2].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3561 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3562 | ;} |
| 3563 | break; |
| 3564 | |
| 3565 | case 129: |
| 3566 | #line 1314 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3567 | { // Empty structure type? |
| 3568 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
| 3569 | CHECK_FOR_ERROR |
| 3570 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3571 | break; |
| 3572 | |
| 3573 | case 130: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3574 | #line 1321 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3575 | { |
| 3576 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); |
| 3577 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); |
| 3578 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3579 | break; |
| 3580 | |
| 3581 | case 131: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3582 | #line 1328 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3583 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3584 | if (!UpRefs.empty()) |
| 3585 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 3586 | if (!(*(yyvsp[0].TypeVal))->isFirstClassType()) |
| 3587 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
| 3588 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
| 3589 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3590 | break; |
| 3591 | |
| 3592 | case 132: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3593 | #line 1335 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3594 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3595 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 3596 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3597 | break; |
| 3598 | |
| 3599 | case 133: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3600 | #line 1340 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3601 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3602 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3603 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3604 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3605 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3606 | break; |
| 3607 | |
| 3608 | case 134: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3609 | #line 1345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3610 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3611 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3612 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3613 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3614 | break; |
| 3615 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3616 | case 136: |
| 3617 | #line 1353 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3618 | { |
| 3619 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); |
| 3620 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3621 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
| 3622 | (yyval.TypeWithAttrsList)->push_back(TWA); |
| 3623 | CHECK_FOR_ERROR |
| 3624 | ;} |
| 3625 | break; |
| 3626 | |
| 3627 | case 137: |
| 3628 | #line 1360 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3629 | { |
| 3630 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
| 3631 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3632 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
| 3633 | (yyval.TypeWithAttrsList)->push_back(TWA); |
| 3634 | CHECK_FOR_ERROR |
| 3635 | ;} |
| 3636 | break; |
| 3637 | |
| 3638 | case 138: |
| 3639 | #line 1367 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3640 | { |
| 3641 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 3642 | CHECK_FOR_ERROR |
| 3643 | ;} |
| 3644 | break; |
| 3645 | |
| 3646 | case 139: |
| 3647 | #line 1375 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3648 | { |
| 3649 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 3650 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
| 3651 | CHECK_FOR_ERROR |
| 3652 | ;} |
| 3653 | break; |
| 3654 | |
| 3655 | case 140: |
| 3656 | #line 1380 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3657 | { |
| 3658 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
| 3659 | CHECK_FOR_ERROR |
| 3660 | ;} |
| 3661 | break; |
| 3662 | |
| 3663 | case 141: |
| 3664 | #line 1391 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3665 | { // Nonempty unsized arr |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3666 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3667 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3668 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3669 | if (ATy == 0) |
| 3670 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3671 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3672 | const Type *ETy = ATy->getElementType(); |
| 3673 | int NumElements = ATy->getNumElements(); |
| 3674 | |
| 3675 | // Verify that we have the correct size... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3676 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3677 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3678 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3679 | itostr(NumElements) + "!"); |
| 3680 | |
| 3681 | // Verify all elements are correct type! |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3682 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3683 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3684 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3685 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3686 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3687 | } |
| 3688 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3689 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3690 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3691 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3692 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3693 | break; |
| 3694 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3695 | case 142: |
| 3696 | #line 1419 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3697 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3698 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3699 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3700 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3701 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3702 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3703 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3704 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3705 | int NumElements = ATy->getNumElements(); |
| 3706 | if (NumElements != -1 && NumElements != 0) |
| 3707 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
| 3708 | " arguments, but has size of " + itostr(NumElements) +"!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3709 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3710 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3711 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3712 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3713 | break; |
| 3714 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3715 | case 143: |
| 3716 | #line 1435 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3717 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3718 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3719 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3720 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3721 | if (ATy == 0) |
| 3722 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3723 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3724 | |
| 3725 | int NumElements = ATy->getNumElements(); |
| 3726 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3727 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 3728 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3729 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3730 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3731 | " when array has size " + itostr(NumElements) + "!"); |
| 3732 | std::vector<Constant*> Vals; |
| 3733 | if (ETy == Type::Int8Ty) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3734 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3735 | C != (unsigned char*)EndStr; ++C) |
| 3736 | Vals.push_back(ConstantInt::get(ETy, *C)); |
| 3737 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3738 | free((yyvsp[0].StrVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3739 | GEN_ERROR("Cannot build string arrays of non byte sized elements!"); |
| 3740 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3741 | free((yyvsp[0].StrVal)); |
| 3742 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3743 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3744 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3745 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3746 | break; |
| 3747 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3748 | case 144: |
| 3749 | #line 1464 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3750 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3751 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3752 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 3753 | const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3754 | if (PTy == 0) |
| 3755 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3756 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3757 | const Type *ETy = PTy->getElementType(); |
| 3758 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3759 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3760 | // Verify that we have the correct size... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3761 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3762 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3763 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3764 | itostr(NumElements) + "!"); |
| 3765 | |
| 3766 | // Verify all elements are correct type! |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3767 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 3768 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3769 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3770 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3771 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3772 | } |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3773 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3774 | (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); |
| 3775 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3776 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3777 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3778 | break; |
| 3779 | |
| 3780 | case 145: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3781 | #line 1492 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3782 | { |
| 3783 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
| 3784 | if (STy == 0) |
| 3785 | GEN_ERROR("Cannot make struct constant with type: '" + |
| 3786 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
| 3787 | |
| 3788 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
| 3789 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3790 | |
| 3791 | // Check to ensure that constants are compatible with the type initializer! |
| 3792 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
| 3793 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
| 3794 | GEN_ERROR("Expected type '" + |
| 3795 | STy->getElementType(i)->getDescription() + |
| 3796 | "' for element #" + utostr(i) + |
| 3797 | " of structure initializer!"); |
| 3798 | |
| 3799 | // Check to ensure that Type is not packed |
| 3800 | if (STy->isPacked()) |
| 3801 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3802 | |
| 3803 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 3804 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
| 3805 | CHECK_FOR_ERROR |
| 3806 | ;} |
| 3807 | break; |
| 3808 | |
| 3809 | case 146: |
| 3810 | #line 1517 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3811 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3812 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3813 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 3814 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
| 3815 | if (STy == 0) |
| 3816 | GEN_ERROR("Cannot make struct constant with type: '" + |
| 3817 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
| 3818 | |
| 3819 | if (STy->getNumContainedTypes() != 0) |
| 3820 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3821 | |
| 3822 | // Check to ensure that Type is not packed |
| 3823 | if (STy->isPacked()) |
| 3824 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3825 | |
| 3826 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3827 | delete (yyvsp[-2].TypeVal); |
| 3828 | CHECK_FOR_ERROR |
| 3829 | ;} |
| 3830 | break; |
| 3831 | |
| 3832 | case 147: |
| 3833 | #line 1536 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3834 | { |
| 3835 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get()); |
| 3836 | if (STy == 0) |
| 3837 | GEN_ERROR("Cannot make struct constant with type: '" + |
| 3838 | (*(yyvsp[-5].TypeVal))->getDescription() + "'!"); |
| 3839 | |
| 3840 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) |
| 3841 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3842 | |
| 3843 | // Check to ensure that constants are compatible with the type initializer! |
| 3844 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) |
| 3845 | if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i)) |
| 3846 | GEN_ERROR("Expected type '" + |
| 3847 | STy->getElementType(i)->getDescription() + |
| 3848 | "' for element #" + utostr(i) + |
| 3849 | " of structure initializer!"); |
| 3850 | |
| 3851 | // Check to ensure that Type is packed |
| 3852 | if (!STy->isPacked()) |
| 3853 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3854 | |
| 3855 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector)); |
| 3856 | delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector); |
| 3857 | CHECK_FOR_ERROR |
| 3858 | ;} |
| 3859 | break; |
| 3860 | |
| 3861 | case 148: |
| 3862 | #line 1561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3863 | { |
| 3864 | if (!UpRefs.empty()) |
| 3865 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 3866 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get()); |
| 3867 | if (STy == 0) |
| 3868 | GEN_ERROR("Cannot make struct constant with type: '" + |
| 3869 | (*(yyvsp[-4].TypeVal))->getDescription() + "'!"); |
| 3870 | |
| 3871 | if (STy->getNumContainedTypes() != 0) |
| 3872 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3873 | |
| 3874 | // Check to ensure that Type is packed |
| 3875 | if (!STy->isPacked()) |
| 3876 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3877 | |
| 3878 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3879 | delete (yyvsp[-4].TypeVal); |
| 3880 | CHECK_FOR_ERROR |
| 3881 | ;} |
| 3882 | break; |
| 3883 | |
| 3884 | case 149: |
| 3885 | #line 1580 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3886 | { |
| 3887 | if (!UpRefs.empty()) |
| 3888 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3889 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
| 3890 | if (PTy == 0) |
| 3891 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
| 3892 | (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); |
| 3893 | |
| 3894 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 3895 | delete (yyvsp[-1].TypeVal); |
| 3896 | CHECK_FOR_ERROR |
| 3897 | ;} |
| 3898 | break; |
| 3899 | |
| 3900 | case 150: |
| 3901 | #line 1592 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3902 | { |
| 3903 | if (!UpRefs.empty()) |
| 3904 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3905 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 3906 | delete (yyvsp[-1].TypeVal); |
| 3907 | CHECK_FOR_ERROR |
| 3908 | ;} |
| 3909 | break; |
| 3910 | |
| 3911 | case 151: |
| 3912 | #line 1599 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3913 | { |
| 3914 | if (!UpRefs.empty()) |
| 3915 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3916 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3917 | if (Ty == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3918 | GEN_ERROR("Global const reference must be a pointer type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3919 | |
| 3920 | // ConstExprs can exist in the body of a function, thus creating |
| 3921 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3922 | // the context of a function, getValNonImprovising will search the functions |
| 3923 | // symbol table instead of the module symbol table for the global symbol, |
| 3924 | // which throws things all off. To get around this, we just tell |
| 3925 | // getValNonImprovising that we are at global scope here. |
| 3926 | // |
| 3927 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3928 | CurFun.CurrentFunction = 0; |
| 3929 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3930 | Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3931 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3932 | |
| 3933 | CurFun.CurrentFunction = SavedCurFn; |
| 3934 | |
| 3935 | // If this is an initializer for a constant pointer, which is referencing a |
| 3936 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3937 | // in the future with the right type of variable. |
| 3938 | // |
| 3939 | if (V == 0) { |
| 3940 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 3941 | const PointerType *PT = cast<PointerType>(Ty); |
| 3942 | |
| 3943 | // First check to see if the forward references value is already created! |
| 3944 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3945 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3946 | |
| 3947 | if (I != CurModule.GlobalRefs.end()) { |
| 3948 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3949 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3950 | } else { |
| 3951 | std::string Name; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3952 | if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName) |
| 3953 | Name = (yyvsp[0].ValIDVal).Name; |
| 3954 | else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID) |
| 3955 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3956 | |
| 3957 | // Create the forward referenced global. |
| 3958 | GlobalValue *GV; |
| 3959 | if (const FunctionType *FTy = |
| 3960 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3961 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3962 | CurModule.CurrentModule); |
| 3963 | } else { |
| 3964 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3965 | GlobalValue::ExternalLinkage, 0, |
| 3966 | Name, CurModule.CurrentModule); |
| 3967 | } |
| 3968 | |
| 3969 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3970 | 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] | 3971 | V = GV; |
| 3972 | } |
| 3973 | } |
| 3974 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3975 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 3976 | delete (yyvsp[-1].TypeVal); // Free the type handle |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3977 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3978 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3979 | break; |
| 3980 | |
| 3981 | case 152: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3982 | #line 1665 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 3983 | { |
| 3984 | if (!UpRefs.empty()) |
| 3985 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 3986 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
| 3987 | GEN_ERROR("Mismatched types for constant expression: " + |
| 3988 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); |
| 3989 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 3990 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3991 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3992 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3993 | break; |
| 3994 | |
| 3995 | case 153: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3996 | #line 1675 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3997 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3998 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 3999 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4000 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
| 4001 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4002 | GEN_ERROR("Cannot create a null initialized value of this type!"); |
| 4003 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4004 | delete (yyvsp[-1].TypeVal); |
| 4005 | CHECK_FOR_ERROR |
| 4006 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4007 | break; |
| 4008 | |
| 4009 | case 154: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4010 | #line 1685 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4011 | { // integral constants |
| 4012 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
| 4013 | GEN_ERROR("Constant value doesn't fit in type!"); |
| 4014 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); |
| 4015 | CHECK_FOR_ERROR |
| 4016 | ;} |
| 4017 | break; |
| 4018 | |
| 4019 | case 155: |
| 4020 | #line 1691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4021 | { // integral constants |
| 4022 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
| 4023 | GEN_ERROR("Constant value doesn't fit in type!"); |
| 4024 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); |
| 4025 | CHECK_FOR_ERROR |
| 4026 | ;} |
| 4027 | break; |
| 4028 | |
| 4029 | case 156: |
| 4030 | #line 1697 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4031 | { // Boolean constants |
| 4032 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4033 | (yyval.ConstVal) = ConstantInt::getTrue(); |
| 4034 | CHECK_FOR_ERROR |
| 4035 | ;} |
| 4036 | break; |
| 4037 | |
| 4038 | case 157: |
| 4039 | #line 1702 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4040 | { // Boolean constants |
| 4041 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4042 | (yyval.ConstVal) = ConstantInt::getFalse(); |
| 4043 | CHECK_FOR_ERROR |
| 4044 | ;} |
| 4045 | break; |
| 4046 | |
| 4047 | case 158: |
| 4048 | #line 1707 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4049 | { // Float & Double constants |
| 4050 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
| 4051 | GEN_ERROR("Floating point constant invalid for type!!"); |
| 4052 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
| 4053 | CHECK_FOR_ERROR |
| 4054 | ;} |
| 4055 | break; |
| 4056 | |
| 4057 | case 159: |
| 4058 | #line 1715 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4059 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4060 | if (!UpRefs.empty()) |
| 4061 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4062 | Constant *Val = (yyvsp[-3].ConstVal); |
| 4063 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); |
| 4064 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) |
| 4065 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4066 | Val->getType()->getDescription() + "' to '" + |
| 4067 | DestTy->getDescription() + "'!"); |
| 4068 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); |
| 4069 | delete (yyvsp[-1].TypeVal); |
| 4070 | ;} |
| 4071 | break; |
| 4072 | |
| 4073 | case 160: |
| 4074 | #line 1727 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4075 | { |
| 4076 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4077 | GEN_ERROR("GetElementPtr requires a pointer operand!"); |
| 4078 | |
| 4079 | const Type *IdxTy = |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4080 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4081 | if (!IdxTy) |
| 4082 | GEN_ERROR("Index list invalid for constant getelementptr!"); |
| 4083 | |
| 4084 | std::vector<Constant*> IdxVec; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4085 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 4086 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4087 | IdxVec.push_back(C); |
| 4088 | else |
| 4089 | GEN_ERROR("Indices to constant getelementptr must be constants!"); |
| 4090 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4091 | delete (yyvsp[-1].ValueList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4092 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4093 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4094 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4095 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4096 | break; |
| 4097 | |
| 4098 | case 161: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4099 | #line 1748 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4100 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4101 | if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) |
| 4102 | GEN_ERROR("Select condition must be of boolean type!"); |
| 4103 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4104 | GEN_ERROR("Select operand types must match!"); |
| 4105 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4106 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4107 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4108 | break; |
| 4109 | |
| 4110 | case 162: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4111 | #line 1756 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4112 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4113 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4114 | GEN_ERROR("Binary operator types must match!"); |
| 4115 | CHECK_FOR_ERROR; |
| 4116 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4117 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4118 | break; |
| 4119 | |
| 4120 | case 163: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4121 | #line 1762 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4122 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4123 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4124 | GEN_ERROR("Logical operator types must match!"); |
| 4125 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) { |
| 4126 | if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) || |
| 4127 | !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger()) |
| 4128 | GEN_ERROR("Logical operator requires integral operands!"); |
| 4129 | } |
| 4130 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4131 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4132 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4133 | break; |
| 4134 | |
| 4135 | case 164: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4136 | #line 1773 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4137 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4138 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4139 | GEN_ERROR("icmp operand types must match!"); |
| 4140 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4141 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4142 | break; |
| 4143 | |
| 4144 | case 165: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4145 | #line 1778 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4146 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4147 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 4148 | GEN_ERROR("fcmp operand types must match!"); |
| 4149 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4150 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4151 | break; |
| 4152 | |
| 4153 | case 166: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4154 | #line 1783 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4155 | { |
| 4156 | if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty) |
| 4157 | GEN_ERROR("Shift count for shift constant must be i8 type!"); |
| 4158 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) |
| 4159 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 4160 | CHECK_FOR_ERROR; |
| 4161 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4162 | CHECK_FOR_ERROR |
| 4163 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4164 | break; |
| 4165 | |
| 4166 | case 167: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4167 | #line 1792 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4168 | { |
| 4169 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
| 4170 | GEN_ERROR("Invalid extractelement operands!"); |
| 4171 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4172 | CHECK_FOR_ERROR |
| 4173 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4174 | break; |
| 4175 | |
| 4176 | case 168: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4177 | #line 1798 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4178 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4179 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
| 4180 | GEN_ERROR("Invalid insertelement operands!"); |
| 4181 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4182 | CHECK_FOR_ERROR |
| 4183 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4184 | break; |
| 4185 | |
| 4186 | case 169: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4187 | #line 1804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4188 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4189 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
| 4190 | GEN_ERROR("Invalid shufflevector operands!"); |
| 4191 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 4192 | CHECK_FOR_ERROR |
| 4193 | ;} |
| 4194 | break; |
| 4195 | |
| 4196 | case 170: |
| 4197 | #line 1813 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4198 | { |
| 4199 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
| 4200 | CHECK_FOR_ERROR |
| 4201 | ;} |
| 4202 | break; |
| 4203 | |
| 4204 | case 171: |
| 4205 | #line 1817 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4206 | { |
| 4207 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4208 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
| 4209 | CHECK_FOR_ERROR |
| 4210 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4211 | break; |
| 4212 | |
| 4213 | case 172: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4214 | #line 1825 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4215 | { (yyval.BoolVal) = false; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4216 | break; |
| 4217 | |
| 4218 | case 173: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4219 | #line 1825 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4220 | { (yyval.BoolVal) = true; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4221 | break; |
| 4222 | |
| 4223 | case 174: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4224 | #line 1836 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4225 | { |
| 4226 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 4227 | CurModule.ModuleDone(); |
| 4228 | CHECK_FOR_ERROR; |
| 4229 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4230 | break; |
| 4231 | |
| 4232 | case 175: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4233 | #line 1841 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4234 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4235 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 4236 | CurModule.ModuleDone(); |
| 4237 | CHECK_FOR_ERROR; |
| 4238 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4239 | break; |
| 4240 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4241 | case 178: |
| 4242 | #line 1854 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4243 | { CurFun.isDeclare = false; ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4244 | break; |
| 4245 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4246 | case 179: |
| 4247 | #line 1854 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4248 | { |
| 4249 | CurFun.FunctionDone(); |
| 4250 | CHECK_FOR_ERROR |
| 4251 | ;} |
| 4252 | break; |
| 4253 | |
| 4254 | case 180: |
| 4255 | #line 1858 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4256 | { CurFun.isDeclare = true; ;} |
| 4257 | break; |
| 4258 | |
| 4259 | case 181: |
| 4260 | #line 1858 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4261 | { |
| 4262 | CHECK_FOR_ERROR |
| 4263 | ;} |
| 4264 | break; |
| 4265 | |
| 4266 | case 182: |
| 4267 | #line 1861 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4268 | { |
| 4269 | CHECK_FOR_ERROR |
| 4270 | ;} |
| 4271 | break; |
| 4272 | |
| 4273 | case 183: |
| 4274 | #line 1864 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4275 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4276 | // Emit an error if there are any unresolved types left. |
| 4277 | if (!CurModule.LateResolveTypes.empty()) { |
| 4278 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4279 | if (DID.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4280 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4281 | } else { |
| 4282 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4283 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4284 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4285 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4286 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4287 | break; |
| 4288 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4289 | case 184: |
| 4290 | #line 1876 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4291 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4292 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4293 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4294 | // Eagerly resolve types. This is not an optimization, this is a |
| 4295 | // requirement that is due to the fact that we could have this: |
| 4296 | // |
| 4297 | // %list = type { %list * } |
| 4298 | // %list = type { %list * } ; repeated type decl |
| 4299 | // |
| 4300 | // If types are not resolved eagerly, then the two types will not be |
| 4301 | // determined to be the same type! |
| 4302 | // |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4303 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4304 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4305 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4306 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4307 | // If this is a named type that is not a redefinition, add it to the slot |
| 4308 | // table. |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4309 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4310 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4311 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4312 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4313 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4314 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4315 | break; |
| 4316 | |
| 4317 | case 185: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4318 | #line 1900 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4319 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4320 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); |
| 4321 | |
| 4322 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
| 4323 | CHECK_FOR_ERROR |
| 4324 | // If this is a named type that is not a redefinition, add it to the slot |
| 4325 | // table. |
| 4326 | CurModule.Types.push_back((yyvsp[0].PrimType)); |
| 4327 | } |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4328 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4329 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4330 | break; |
| 4331 | |
| 4332 | case 186: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4333 | #line 1911 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4334 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4335 | /* "Externally Visible" Linkage */ |
| 4336 | if ((yyvsp[0].ConstVal) == 0) |
| 4337 | GEN_ERROR("Global value initializer is not a constant!"); |
| 4338 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, |
| 4339 | (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4340 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4341 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4342 | break; |
| 4343 | |
| 4344 | case 187: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4345 | #line 1918 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4346 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4347 | CurGV = 0; |
| 4348 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4349 | break; |
| 4350 | |
| 4351 | case 188: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4352 | #line 1921 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4353 | { |
| 4354 | if ((yyvsp[0].ConstVal) == 0) |
| 4355 | GEN_ERROR("Global value initializer is not a constant!"); |
| 4356 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
| 4357 | CHECK_FOR_ERROR |
| 4358 | ;} |
| 4359 | break; |
| 4360 | |
| 4361 | case 189: |
| 4362 | #line 1926 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4363 | { |
| 4364 | CurGV = 0; |
| 4365 | ;} |
| 4366 | break; |
| 4367 | |
| 4368 | case 190: |
| 4369 | #line 1929 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4370 | { |
| 4371 | if (!UpRefs.empty()) |
| 4372 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 4373 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); |
| 4374 | CHECK_FOR_ERROR |
| 4375 | delete (yyvsp[0].TypeVal); |
| 4376 | ;} |
| 4377 | break; |
| 4378 | |
| 4379 | case 191: |
| 4380 | #line 1935 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4381 | { |
| 4382 | CurGV = 0; |
| 4383 | CHECK_FOR_ERROR |
| 4384 | ;} |
| 4385 | break; |
| 4386 | |
| 4387 | case 192: |
| 4388 | #line 1939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4389 | { |
| 4390 | CHECK_FOR_ERROR |
| 4391 | ;} |
| 4392 | break; |
| 4393 | |
| 4394 | case 193: |
| 4395 | #line 1942 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4396 | { |
| 4397 | CHECK_FOR_ERROR |
| 4398 | ;} |
| 4399 | break; |
| 4400 | |
| 4401 | case 194: |
| 4402 | #line 1948 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4403 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4404 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4405 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4406 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4407 | free((yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4408 | |
| 4409 | if (AsmSoFar.empty()) |
| 4410 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4411 | else |
| 4412 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4413 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4414 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4415 | break; |
| 4416 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4417 | case 195: |
| 4418 | #line 1961 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4419 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4420 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4421 | free((yyvsp[0].StrVal)); |
| 4422 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4423 | break; |
| 4424 | |
| 4425 | case 196: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4426 | #line 1965 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4427 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4428 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4429 | free((yyvsp[0].StrVal)); |
| 4430 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4431 | break; |
| 4432 | |
| 4433 | case 198: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4434 | #line 1972 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4435 | { |
| 4436 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4437 | free((yyvsp[0].StrVal)); |
| 4438 | CHECK_FOR_ERROR |
| 4439 | ;} |
| 4440 | break; |
| 4441 | |
| 4442 | case 199: |
| 4443 | #line 1977 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4444 | { |
| 4445 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4446 | free((yyvsp[0].StrVal)); |
| 4447 | CHECK_FOR_ERROR |
| 4448 | ;} |
| 4449 | break; |
| 4450 | |
| 4451 | case 200: |
| 4452 | #line 1982 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4453 | { |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 4454 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4455 | ;} |
| 4456 | break; |
| 4457 | |
| 4458 | case 201: |
| 4459 | #line 1991 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4460 | { |
| 4461 | if (!UpRefs.empty()) |
| 4462 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4463 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
| 4464 | GEN_ERROR("void typed arguments are invalid!"); |
| 4465 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4466 | (yyval.ArgList) = (yyvsp[-4].ArgList); |
| 4467 | (yyvsp[-4].ArgList)->push_back(E); |
| 4468 | CHECK_FOR_ERROR |
| 4469 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4470 | break; |
| 4471 | |
| 4472 | case 202: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4473 | #line 2001 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4474 | { |
| 4475 | if (!UpRefs.empty()) |
| 4476 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 4477 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) |
| 4478 | GEN_ERROR("void typed arguments are invalid!"); |
| 4479 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); |
| 4480 | (yyval.ArgList) = new ArgListType; |
| 4481 | (yyval.ArgList)->push_back(E); |
| 4482 | CHECK_FOR_ERROR |
| 4483 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4484 | break; |
| 4485 | |
| 4486 | case 203: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4487 | #line 2012 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4488 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4489 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4490 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4491 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4492 | break; |
| 4493 | |
| 4494 | case 204: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4495 | #line 2016 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4496 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4497 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
| 4498 | struct ArgListEntry E; |
| 4499 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4500 | E.Name = 0; |
| 4501 | E.Attrs = FunctionType::NoAttributeSet; |
| 4502 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4503 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4504 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4505 | break; |
| 4506 | |
| 4507 | case 205: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4508 | #line 2025 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4509 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4510 | (yyval.ArgList) = new ArgListType; |
| 4511 | struct ArgListEntry E; |
| 4512 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4513 | E.Name = 0; |
| 4514 | E.Attrs = FunctionType::NoAttributeSet; |
| 4515 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4516 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4517 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4518 | break; |
| 4519 | |
| 4520 | case 206: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4521 | #line 2034 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4522 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4523 | (yyval.ArgList) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4524 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4525 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4526 | break; |
| 4527 | |
| 4528 | case 207: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4529 | #line 2040 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4530 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4531 | UnEscapeLexed((yyvsp[-6].StrVal)); |
| 4532 | std::string FunctionName((yyvsp[-6].StrVal)); |
| 4533 | free((yyvsp[-6].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4534 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4535 | // Check the function result for abstractness if this is a define. We should |
| 4536 | // have no abstract types at this point |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4537 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal))) |
| 4538 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4539 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4540 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4541 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4542 | ParamAttrs.push_back((yyvsp[-2].ParamAttrs)); |
| 4543 | if ((yyvsp[-4].ArgList)) { // If there are arguments... |
| 4544 | 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] | 4545 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4546 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4547 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4548 | ParamTypeList.push_back(Ty); |
| 4549 | if (Ty != Type::VoidTy) |
| 4550 | ParamAttrs.push_back(I->Attrs); |
| 4551 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4552 | } |
| 4553 | |
| 4554 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4555 | if (isVarArg) ParamTypeList.pop_back(); |
| 4556 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4557 | FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4558 | ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4559 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4560 | delete (yyvsp[-7].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4561 | |
| 4562 | ValID ID; |
| 4563 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4564 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4565 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4566 | ID = ValID::createGlobalID(CurModule.Values[PFT].size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4567 | } |
| 4568 | |
| 4569 | Function *Fn = 0; |
| 4570 | // See if this function was forward referenced. If so, recycle the object. |
| 4571 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4572 | // Move the function to the end of the list, from whereever it was |
| 4573 | // previously inserted. |
| 4574 | Fn = cast<Function>(FWRef); |
| 4575 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4576 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4577 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4578 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4579 | // If this is the case, either we need to be a forward decl, or it needs |
| 4580 | // to be. |
| 4581 | if (!CurFun.isDeclare && !Fn->isExternal()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4582 | GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4583 | |
| 4584 | // Make sure to strip off any argument names so we can't get conflicts. |
| 4585 | if (Fn->isExternal()) |
| 4586 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4587 | AI != AE; ++AI) |
| 4588 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4589 | } else { // Not already defined? |
| 4590 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4591 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4592 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4593 | InsertValue(Fn, CurModule.Values); |
| 4594 | } |
| 4595 | |
| 4596 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4597 | |
| 4598 | if (CurFun.isDeclare) { |
| 4599 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4600 | // correctly handle cases, when pointer to function is passed as argument to |
| 4601 | // another function. |
| 4602 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4603 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4604 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4605 | Fn->setCallingConv((yyvsp[-8].UIntVal)); |
| 4606 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4607 | if ((yyvsp[-1].StrVal)) { |
| 4608 | Fn->setSection((yyvsp[-1].StrVal)); |
| 4609 | free((yyvsp[-1].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4610 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4611 | |
| 4612 | // Add all of the arguments we parsed to the function... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4613 | if ((yyvsp[-4].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4614 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4615 | assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&& |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4616 | "Not a varargs marker!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4617 | delete (yyvsp[-4].ArgList)->back().Ty; |
| 4618 | (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4619 | } |
| 4620 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4621 | unsigned Idx = 1; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4622 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4623 | delete I->Ty; // Delete the typeholder... |
| 4624 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4625 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4626 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4627 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4628 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4629 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4630 | delete (yyvsp[-4].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4631 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4632 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4633 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4634 | break; |
| 4635 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4636 | case 210: |
| 4637 | #line 2147 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4638 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4639 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4640 | |
| 4641 | // Make sure that we keep track of the linkage type even if there was a |
| 4642 | // previous "declare". |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4643 | (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage)); |
| 4644 | (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility)); |
| 4645 | ;} |
| 4646 | break; |
| 4647 | |
| 4648 | case 213: |
| 4649 | #line 2158 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4650 | { |
| 4651 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 4652 | CHECK_FOR_ERROR |
| 4653 | ;} |
| 4654 | break; |
| 4655 | |
| 4656 | case 214: |
| 4657 | #line 2163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4658 | { |
| 4659 | CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); |
| 4660 | CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); |
| 4661 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
| 4662 | CurFun.FunctionDone(); |
| 4663 | CHECK_FOR_ERROR |
| 4664 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4665 | break; |
| 4666 | |
| 4667 | case 215: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4668 | #line 2175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4669 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4670 | (yyval.BoolVal) = false; |
| 4671 | CHECK_FOR_ERROR |
| 4672 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4673 | break; |
| 4674 | |
| 4675 | case 216: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4676 | #line 2179 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4677 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4678 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4679 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4680 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4681 | break; |
| 4682 | |
| 4683 | case 217: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4684 | #line 2184 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4685 | { // A reference to a direct constant |
| 4686 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4687 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4688 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4689 | break; |
| 4690 | |
| 4691 | case 218: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4692 | #line 2188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4693 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4694 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4695 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4696 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4697 | break; |
| 4698 | |
| 4699 | case 219: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4700 | #line 2192 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4701 | { // Perhaps it's an FP constant? |
| 4702 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4703 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4704 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4705 | break; |
| 4706 | |
| 4707 | case 220: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4708 | #line 2196 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4709 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4710 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4711 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4712 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4713 | break; |
| 4714 | |
| 4715 | case 221: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4716 | #line 2200 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4717 | { |
| 4718 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4719 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4720 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4721 | break; |
| 4722 | |
| 4723 | case 222: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4724 | #line 2204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4725 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4726 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4727 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4728 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4729 | break; |
| 4730 | |
| 4731 | case 223: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4732 | #line 2208 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4733 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4734 | (yyval.ValIDVal) = ValID::createUndef(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4735 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4736 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4737 | break; |
| 4738 | |
| 4739 | case 224: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4740 | #line 2212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4741 | { // A vector zero constant. |
| 4742 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4743 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4744 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4745 | break; |
| 4746 | |
| 4747 | case 225: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4748 | #line 2216 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4749 | { // Nonempty unsized packed vector |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4750 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
| 4751 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4752 | |
| 4753 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 4754 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4755 | HandleUpRefs( |
| 4756 | PackedType::get( |
| 4757 | ETy, |
| 4758 | NumElements) |
| 4759 | ) |
| 4760 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4761 | |
| 4762 | // Verify all elements are correct type! |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4763 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4764 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4765 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4766 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4767 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4768 | } |
| 4769 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4770 | (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); |
| 4771 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4772 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4773 | ;} |
| 4774 | break; |
| 4775 | |
| 4776 | case 226: |
| 4777 | #line 2241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4778 | { |
| 4779 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
| 4780 | CHECK_FOR_ERROR |
| 4781 | ;} |
| 4782 | break; |
| 4783 | |
| 4784 | case 227: |
| 4785 | #line 2245 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4786 | { |
| 4787 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 4788 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 4789 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4790 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 4791 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 4792 | free((yyvsp[-2].StrVal)); |
| 4793 | free((yyvsp[0].StrVal)); |
| 4794 | CHECK_FOR_ERROR |
| 4795 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4796 | break; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4797 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4798 | case 228: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4799 | #line 2259 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4800 | { // Is it an integer reference...? |
| 4801 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4802 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4803 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4804 | break; |
| 4805 | |
| 4806 | case 229: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4807 | #line 2263 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4808 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4809 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4810 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4811 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4812 | break; |
| 4813 | |
| 4814 | case 230: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4815 | #line 2267 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 4816 | { // Is it a named reference...? |
| 4817 | (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4818 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4819 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4820 | break; |
| 4821 | |
| 4822 | case 231: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4823 | #line 2271 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4824 | { // Is it a named reference...? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4825 | (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4826 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4827 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4828 | break; |
| 4829 | |
| 4830 | case 234: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4831 | #line 2283 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4832 | { |
| 4833 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4834 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 4835 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
| 4836 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4837 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4838 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4839 | break; |
| 4840 | |
| 4841 | case 235: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4842 | #line 2292 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4843 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4844 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4845 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4846 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4847 | break; |
| 4848 | |
| 4849 | case 236: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4850 | #line 2296 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4851 | { // Do not allow functions with 0 basic blocks |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4852 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4853 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4854 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4855 | break; |
| 4856 | |
| 4857 | case 237: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4858 | #line 2305 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4859 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4860 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4861 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4862 | InsertValue((yyvsp[0].TermInstVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4863 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4864 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 4865 | InsertValue((yyvsp[-2].BasicBlockVal)); |
| 4866 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4867 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4868 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4869 | break; |
| 4870 | |
| 4871 | case 238: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4872 | #line 2316 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4873 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4874 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4875 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4876 | if (CI2->getParent() == 0) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4877 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
| 4878 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 4879 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4880 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4881 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4882 | break; |
| 4883 | |
| 4884 | case 239: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4885 | #line 2325 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4886 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4887 | (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4888 | CHECK_FOR_ERROR |
| 4889 | |
| 4890 | // Make sure to move the basic block to the correct location in the |
| 4891 | // function, instead of leaving it inserted wherever it was first |
| 4892 | // referenced. |
| 4893 | Function::BasicBlockListType &BBL = |
| 4894 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4895 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4896 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4897 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4898 | break; |
| 4899 | |
| 4900 | case 240: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4901 | #line 2337 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4902 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4903 | (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4904 | CHECK_FOR_ERROR |
| 4905 | |
| 4906 | // Make sure to move the basic block to the correct location in the |
| 4907 | // function, instead of leaving it inserted wherever it was first |
| 4908 | // referenced. |
| 4909 | Function::BasicBlockListType &BBL = |
| 4910 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4911 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4912 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4913 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4914 | break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4915 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4916 | case 241: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4917 | #line 2350 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4918 | { // Return with a result... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4919 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4920 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4921 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4922 | break; |
| 4923 | |
| 4924 | case 242: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4925 | #line 2354 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4926 | { // Return with no result... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4927 | (yyval.TermInstVal) = new ReturnInst(); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4928 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4929 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4930 | break; |
| 4931 | |
| 4932 | case 243: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4933 | #line 2358 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4934 | { // Unconditional Branch... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4935 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4936 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4937 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 4938 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4939 | break; |
| 4940 | |
| 4941 | case 244: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4942 | #line 2363 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4943 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4944 | assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4945 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4946 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4947 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4948 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4949 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4950 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4951 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 4952 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4953 | break; |
| 4954 | |
| 4955 | case 245: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4956 | #line 2373 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4957 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4958 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4959 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4960 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4961 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4962 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 4963 | (yyval.TermInstVal) = S; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4964 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4965 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 4966 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4967 | for (; I != E; ++I) { |
| 4968 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4969 | S->addCase(CI, I->second); |
| 4970 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4971 | GEN_ERROR("Switch case is constant, but not a simple integer!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4972 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4973 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4974 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4975 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4976 | break; |
| 4977 | |
| 4978 | case 246: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4979 | #line 2392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4980 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4981 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4982 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4983 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4984 | CHECK_FOR_ERROR |
| 4985 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4986 | (yyval.TermInstVal) = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4987 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4988 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4989 | break; |
| 4990 | |
| 4991 | case 247: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4992 | #line 2402 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4993 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4994 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4995 | // Handle the short syntax |
| 4996 | const PointerType *PFTy = 0; |
| 4997 | const FunctionType *Ty = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 4998 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4999 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5000 | // Pull out the types of all of the arguments... |
| 5001 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5002 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5003 | ParamAttrs.push_back((yyvsp[-6].ParamAttrs)); |
| 5004 | 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] | 5005 | const Type *Ty = I->Val->getType(); |
| 5006 | if (Ty == Type::VoidTy) |
| 5007 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5008 | ParamTypes.push_back(Ty); |
| 5009 | ParamAttrs.push_back(I->Attrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5010 | } |
| 5011 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5012 | Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5013 | PFTy = PointerType::get(Ty); |
| 5014 | } |
| 5015 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5016 | 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] | 5017 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5018 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5019 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5020 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5021 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5022 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5023 | // Check the arguments |
| 5024 | ValueList Args; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5025 | if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5026 | // Make sure no arguments is a good thing! |
| 5027 | if (Ty->getNumParams() != 0) |
| 5028 | GEN_ERROR("No arguments passed to a function that " |
| 5029 | "expects arguments!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5030 | } else { // Has arguments? |
| 5031 | // Loop through FunctionType's arguments and ensure they are specified |
| 5032 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5033 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5034 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5035 | ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5036 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5037 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5038 | if (ArgI->Val->getType() != *I) |
| 5039 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5040 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5041 | Args.push_back(ArgI->Val); |
| 5042 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5043 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5044 | if (Ty->isVarArg()) { |
| 5045 | if (I == E) |
| 5046 | for (; ArgI != ArgE; ++ArgI) |
| 5047 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5048 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5049 | GEN_ERROR("Invalid number of parameters detected!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5050 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5051 | |
| 5052 | // Create the InvokeInst |
| 5053 | InvokeInst *II = new InvokeInst(V, Normal, Except, Args); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5054 | II->setCallingConv((yyvsp[-12].UIntVal)); |
| 5055 | (yyval.TermInstVal) = II; |
| 5056 | delete (yyvsp[-8].ValueRefList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5057 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5058 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5059 | break; |
| 5060 | |
| 5061 | case 248: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5062 | #line 2468 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5063 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5064 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5065 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5066 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5067 | break; |
| 5068 | |
| 5069 | case 249: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5070 | #line 2472 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5071 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5072 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5073 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5074 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5075 | break; |
| 5076 | |
| 5077 | case 250: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5078 | #line 2479 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5079 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5080 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
| 5081 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5082 | CHECK_FOR_ERROR |
| 5083 | if (V == 0) |
| 5084 | GEN_ERROR("May only switch on a constant pool value!"); |
| 5085 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5086 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5087 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5088 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5089 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5090 | break; |
| 5091 | |
| 5092 | case 251: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5093 | #line 2490 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5094 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5095 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5096 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5097 | CHECK_FOR_ERROR |
| 5098 | |
| 5099 | if (V == 0) |
| 5100 | GEN_ERROR("May only switch on a constant pool value!"); |
| 5101 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5102 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5103 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5104 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5105 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5106 | break; |
| 5107 | |
| 5108 | case 252: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5109 | #line 2503 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5110 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5111 | // Is this definition named?? if so, assign the name... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5112 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5113 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5114 | InsertValue((yyvsp[0].InstVal)); |
| 5115 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5116 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5117 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5118 | break; |
| 5119 | |
| 5120 | case 253: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5121 | #line 2512 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5122 | { // Used for PHI nodes |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5123 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5124 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); |
| 5125 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5126 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5127 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5128 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5129 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5130 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5131 | delete (yyvsp[-5].TypeVal); |
| 5132 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5133 | break; |
| 5134 | |
| 5135 | case 254: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5136 | #line 2523 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5137 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5138 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5139 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5140 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5141 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5142 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5143 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5144 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5145 | break; |
| 5146 | |
| 5147 | case 255: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5148 | #line 2533 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5149 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5150 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5151 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5152 | // Used for call and invoke instructions |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5153 | (yyval.ValueRefList) = new ValueRefList(); |
| 5154 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5155 | (yyval.ValueRefList)->push_back(E); |
| 5156 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5157 | break; |
| 5158 | |
| 5159 | case 256: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5160 | #line 2541 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5161 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5162 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5163 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5164 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); |
| 5165 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); |
| 5166 | (yyval.ValueRefList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5167 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5168 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5169 | break; |
| 5170 | |
| 5171 | case 257: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5172 | #line 2549 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 5173 | { (yyval.ValueRefList) = new ValueRefList(); ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5174 | break; |
| 5175 | |
| 5176 | case 258: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5177 | #line 2552 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
| 5178 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5179 | break; |
| 5180 | |
| 5181 | case 259: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5182 | #line 2553 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5183 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5184 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5185 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5186 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5187 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5188 | break; |
| 5189 | |
| 5190 | case 260: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5191 | #line 2560 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5192 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5193 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5194 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5195 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5196 | break; |
| 5197 | |
| 5198 | case 261: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5199 | #line 2564 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5200 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5201 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5202 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5203 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5204 | break; |
| 5205 | |
| 5206 | case 262: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5207 | #line 2569 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5208 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5209 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5210 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5211 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5212 | !isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5213 | GEN_ERROR( |
| 5214 | "Arithmetic operator requires integer, FP, or packed operands!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5215 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5216 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5217 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5218 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5219 | GEN_ERROR("U/S/FRem not supported on packed types!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5220 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5221 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5222 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5223 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5224 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
| 5225 | if ((yyval.InstVal) == 0) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5226 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5227 | delete (yyvsp[-3].TypeVal); |
| 5228 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5229 | break; |
| 5230 | |
| 5231 | case 263: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5232 | #line 2590 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5233 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5234 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5235 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5236 | if (!(*(yyvsp[-3].TypeVal))->isInteger()) { |
| 5237 | if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) || |
| 5238 | !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5239 | GEN_ERROR("Logical operator requires integral operands!"); |
| 5240 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5241 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5242 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5243 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5244 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5245 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
| 5246 | if ((yyval.InstVal) == 0) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5247 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5248 | delete (yyvsp[-3].TypeVal); |
| 5249 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5250 | break; |
| 5251 | |
| 5252 | case 264: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5253 | #line 2607 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5254 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5255 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5256 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5257 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 5258 | GEN_ERROR("Packed types not supported by icmp instruction"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5259 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5260 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5261 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5262 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5263 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5264 | if ((yyval.InstVal) == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5265 | GEN_ERROR("icmp operator returned null!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5266 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5267 | break; |
| 5268 | |
| 5269 | case 265: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5270 | #line 2620 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5271 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5272 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5273 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); |
| 5274 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 5275 | GEN_ERROR("Packed types not supported by fcmp instruction"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5276 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5277 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5278 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5279 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5280 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5281 | if ((yyval.InstVal) == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5282 | GEN_ERROR("fcmp operator returned null!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5283 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5284 | break; |
| 5285 | |
| 5286 | case 266: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5287 | #line 2633 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5288 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5289 | if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty) |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5290 | GEN_ERROR("Shift amount must be i8 type!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5291 | if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5292 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 5293 | CHECK_FOR_ERROR; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5294 | (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5295 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5296 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5297 | break; |
| 5298 | |
| 5299 | case 267: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5300 | #line 2642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5301 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5302 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5303 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5304 | Value* Val = (yyvsp[-2].ValueVal); |
| 5305 | const Type* DestTy = (yyvsp[0].TypeVal)->get(); |
| 5306 | if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy)) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5307 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5308 | Val->getType()->getDescription() + "' to '" + |
| 5309 | DestTy->getDescription() + "'!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5310 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy); |
| 5311 | delete (yyvsp[0].TypeVal); |
| 5312 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5313 | break; |
| 5314 | |
| 5315 | case 268: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5316 | #line 2654 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5317 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5318 | if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5319 | GEN_ERROR("select condition must be boolean!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5320 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5321 | GEN_ERROR("select value types should match!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5322 | (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5323 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5324 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5325 | break; |
| 5326 | |
| 5327 | case 269: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5328 | #line 2662 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5329 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5330 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5331 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
| 5332 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5333 | delete (yyvsp[0].TypeVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5334 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5335 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5336 | break; |
| 5337 | |
| 5338 | case 270: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5339 | #line 2669 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5340 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5341 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5342 | GEN_ERROR("Invalid extractelement operands!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5343 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5344 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5345 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5346 | break; |
| 5347 | |
| 5348 | case 271: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5349 | #line 2675 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5350 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5351 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5352 | GEN_ERROR("Invalid insertelement operands!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5353 | (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] | 5354 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5355 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5356 | break; |
| 5357 | |
| 5358 | case 272: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5359 | #line 2681 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5360 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5361 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5362 | GEN_ERROR("Invalid shufflevector operands!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5363 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5364 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5365 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5366 | break; |
| 5367 | |
| 5368 | case 273: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5369 | #line 2687 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5370 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5371 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5372 | if (!Ty->isFirstClassType()) |
| 5373 | GEN_ERROR("PHI node operands must be of first class type!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5374 | (yyval.InstVal) = new PHINode(Ty); |
| 5375 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5376 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5377 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5378 | GEN_ERROR("All elements of a PHI node must be of the same type!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5379 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5380 | (yyvsp[0].PHIList)->pop_front(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5381 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5382 | delete (yyvsp[0].PHIList); // Free the list... |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5383 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5384 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5385 | break; |
| 5386 | |
| 5387 | case 274: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5388 | #line 2703 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5389 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5390 | |
| 5391 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5392 | const PointerType *PFTy = 0; |
| 5393 | const FunctionType *Ty = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5394 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5395 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5396 | // Pull out the types of all of the arguments... |
| 5397 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5398 | FunctionType::ParamAttrsList ParamAttrs; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5399 | ParamAttrs.push_back((yyvsp[0].ParamAttrs)); |
| 5400 | 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] | 5401 | const Type *Ty = I->Val->getType(); |
| 5402 | if (Ty == Type::VoidTy) |
| 5403 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5404 | ParamTypes.push_back(Ty); |
| 5405 | ParamAttrs.push_back(I->Attrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5406 | } |
| 5407 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5408 | Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5409 | PFTy = PointerType::get(Ty); |
| 5410 | } |
| 5411 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5412 | 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] | 5413 | CHECK_FOR_ERROR |
| 5414 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5415 | // Check the arguments |
| 5416 | ValueList Args; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5417 | if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5418 | // Make sure no arguments is a good thing! |
| 5419 | if (Ty->getNumParams() != 0) |
| 5420 | GEN_ERROR("No arguments passed to a function that " |
| 5421 | "expects arguments!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5422 | } else { // Has arguments? |
| 5423 | // Loop through FunctionType's arguments and ensure they are specified |
| 5424 | // correctly! |
| 5425 | // |
| 5426 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5427 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5428 | ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5429 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5430 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5431 | if (ArgI->Val->getType() != *I) |
| 5432 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5433 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5434 | Args.push_back(ArgI->Val); |
| 5435 | } |
| 5436 | if (Ty->isVarArg()) { |
| 5437 | if (I == E) |
| 5438 | for (; ArgI != ArgE; ++ArgI) |
| 5439 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5440 | } else if (I != E || ArgI != ArgE) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5441 | GEN_ERROR("Invalid number of parameters detected!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5442 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5443 | // Create the call node |
| 5444 | CallInst *CI = new CallInst(V, Args); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5445 | CI->setTailCall((yyvsp[-7].BoolVal)); |
| 5446 | CI->setCallingConv((yyvsp[-6].UIntVal)); |
| 5447 | (yyval.InstVal) = CI; |
| 5448 | delete (yyvsp[-2].ValueRefList); |
| 5449 | delete (yyvsp[-5].TypeVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5450 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5451 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5452 | break; |
| 5453 | |
| 5454 | case 275: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5455 | #line 2766 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5456 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5457 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5458 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5459 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5460 | break; |
| 5461 | |
| 5462 | case 276: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5463 | #line 2771 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5464 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5465 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5466 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5467 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5468 | break; |
| 5469 | |
| 5470 | case 277: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5471 | #line 2775 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5472 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5473 | (yyval.BoolVal) = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5474 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5475 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5476 | break; |
| 5477 | |
| 5478 | case 278: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5479 | #line 2782 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5480 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5481 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5482 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5483 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5484 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5485 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5486 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5487 | break; |
| 5488 | |
| 5489 | case 279: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5490 | #line 2789 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5491 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5492 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5493 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5494 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5495 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5496 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5497 | delete (yyvsp[-4].TypeVal); |
| 5498 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5499 | break; |
| 5500 | |
| 5501 | case 280: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5502 | #line 2797 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5503 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5504 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5505 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5506 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5507 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5508 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5509 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5510 | break; |
| 5511 | |
| 5512 | case 281: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5513 | #line 2804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5514 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5515 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5516 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); |
| 5517 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5518 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5519 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5520 | delete (yyvsp[-4].TypeVal); |
| 5521 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5522 | break; |
| 5523 | |
| 5524 | case 282: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5525 | #line 2812 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5526 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5527 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5528 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5529 | (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); |
| 5530 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5531 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5532 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5533 | break; |
| 5534 | |
| 5535 | case 283: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5536 | #line 2820 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5537 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5538 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5539 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5540 | if (!isa<PointerType>((yyvsp[-1].TypeVal)->get())) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5541 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5542 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5543 | if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5544 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5545 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5546 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5547 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5548 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
| 5549 | delete (yyvsp[-1].TypeVal); |
| 5550 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5551 | break; |
| 5552 | |
| 5553 | case 284: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5554 | #line 2834 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5555 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5556 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5557 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5558 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5559 | if (!PT) |
| 5560 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5561 | (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5562 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5563 | if (ElTy != (yyvsp[-3].ValueVal)->getType()) |
| 5564 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5565 | "' into space of type '" + ElTy->getDescription() + "'!"); |
| 5566 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5567 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5568 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5569 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); |
| 5570 | delete (yyvsp[-1].TypeVal); |
| 5571 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5572 | break; |
| 5573 | |
| 5574 | case 285: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5575 | #line 2851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5576 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5577 | if (!UpRefs.empty()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5578 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); |
| 5579 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5580 | GEN_ERROR("getelementptr insn requires pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5581 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5582 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5583 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5584 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); |
| 5585 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5586 | CHECK_FOR_ERROR |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5587 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); |
| 5588 | delete (yyvsp[-2].TypeVal); |
| 5589 | delete (yyvsp[0].ValueList); |
| 5590 | ;} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5591 | break; |
| 5592 | |
| 5593 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5594 | default: break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5595 | } |
| 5596 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5597 | /* Line 1126 of yacc.c. */ |
| 5598 | #line 5599 "llvmAsmParser.tab.c" |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5599 | |
| 5600 | yyvsp -= yylen; |
| 5601 | yyssp -= yylen; |
| 5602 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5603 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5604 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5605 | |
| 5606 | *++yyvsp = yyval; |
| 5607 | |
| 5608 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5609 | /* Now `shift' the result of the reduction. Determine what state |
| 5610 | that goes to, based on the state we popped back to and the rule |
| 5611 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5612 | |
| 5613 | yyn = yyr1[yyn]; |
| 5614 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5615 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5616 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5617 | yystate = yytable[yystate]; |
| 5618 | else |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5619 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5620 | |
| 5621 | goto yynewstate; |
| 5622 | |
| 5623 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5624 | /*------------------------------------. |
| 5625 | | yyerrlab -- here on detecting error | |
| 5626 | `------------------------------------*/ |
| 5627 | yyerrlab: |
| 5628 | /* If not already recovering from an error, report this error. */ |
| 5629 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5630 | { |
| 5631 | ++yynerrs; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5632 | #if YYERROR_VERBOSE |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5633 | yyn = yypact[yystate]; |
Chris Lattner | 0fab59c | 2007-01-12 18:33:30 +0000 | [diff] [blame] | 5634 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5635 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5636 | { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5637 | int yytype = YYTRANSLATE (yychar); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5638 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5639 | YYSIZE_T yysize = yysize0; |
| 5640 | YYSIZE_T yysize1; |
| 5641 | int yysize_overflow = 0; |
| 5642 | char *yymsg = 0; |
| 5643 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5644 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5645 | int yyx; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5646 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5647 | #if 0 |
| 5648 | /* This is so xgettext sees the translatable formats that are |
| 5649 | constructed on the fly. */ |
| 5650 | YY_("syntax error, unexpected %s"); |
| 5651 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5652 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5653 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5654 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5655 | #endif |
| 5656 | char *yyfmt; |
| 5657 | char const *yyf; |
| 5658 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5659 | static char const yyexpecting[] = ", expecting %s"; |
| 5660 | static char const yyor[] = " or %s"; |
| 5661 | char yyformat[sizeof yyunexpected |
| 5662 | + sizeof yyexpecting - 1 |
| 5663 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5664 | * (sizeof yyor - 1))]; |
| 5665 | char const *yyprefix = yyexpecting; |
| 5666 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5667 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5668 | YYCHECK. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5669 | int yyxbegin = yyn < 0 ? -yyn : 0; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5670 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5671 | /* Stay within bounds of both yycheck and yytname. */ |
| 5672 | int yychecklim = YYLAST - yyn; |
| 5673 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5674 | int yycount = 1; |
| 5675 | |
| 5676 | yyarg[0] = yytname[yytype]; |
| 5677 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5678 | |
| 5679 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5680 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5681 | { |
| 5682 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 5683 | { |
| 5684 | yycount = 1; |
| 5685 | yysize = yysize0; |
| 5686 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 5687 | break; |
| 5688 | } |
| 5689 | yyarg[yycount++] = yytname[yyx]; |
| 5690 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5691 | yysize_overflow |= yysize1 < yysize; |
| 5692 | yysize = yysize1; |
| 5693 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5694 | yyprefix = yyor; |
| 5695 | } |
| 5696 | |
| 5697 | yyf = YY_(yyformat); |
| 5698 | yysize1 = yysize + yystrlen (yyf); |
| 5699 | yysize_overflow |= yysize1 < yysize; |
| 5700 | yysize = yysize1; |
| 5701 | |
| 5702 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5703 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5704 | if (yymsg) |
| 5705 | { |
| 5706 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5707 | Don't have undefined behavior even if the translation |
| 5708 | produced a string with the wrong number of "%s"s. */ |
| 5709 | char *yyp = yymsg; |
| 5710 | int yyi = 0; |
| 5711 | while ((*yyp = *yyf)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5712 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5713 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5714 | { |
| 5715 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5716 | yyf += 2; |
| 5717 | } |
| 5718 | else |
| 5719 | { |
| 5720 | yyp++; |
| 5721 | yyf++; |
| 5722 | } |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5723 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5724 | yyerror (yymsg); |
| 5725 | YYSTACK_FREE (yymsg); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5726 | } |
| 5727 | else |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5728 | { |
| 5729 | yyerror (YY_("syntax error")); |
| 5730 | goto yyexhaustedlab; |
| 5731 | } |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5732 | } |
| 5733 | else |
| 5734 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5735 | yyerror (YY_("syntax error")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5736 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5737 | |
| 5738 | |
| 5739 | |
| 5740 | if (yyerrstatus == 3) |
| 5741 | { |
| 5742 | /* If just tried and failed to reuse look-ahead token after an |
| 5743 | error, discard it. */ |
| 5744 | |
| 5745 | if (yychar <= YYEOF) |
| 5746 | { |
| 5747 | /* Return failure if at end of input. */ |
| 5748 | if (yychar == YYEOF) |
| 5749 | YYABORT; |
| 5750 | } |
| 5751 | else |
| 5752 | { |
| 5753 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 5754 | yychar = YYEMPTY; |
| 5755 | } |
| 5756 | } |
| 5757 | |
| 5758 | /* Else will try to reuse look-ahead token after shifting the error |
| 5759 | token. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5760 | goto yyerrlab1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5761 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5762 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5763 | /*---------------------------------------------------. |
| 5764 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5765 | `---------------------------------------------------*/ |
| 5766 | yyerrorlab: |
| 5767 | |
| 5768 | /* Pacify compilers like GCC when the user code never invokes |
| 5769 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5770 | code. */ |
| 5771 | if (0) |
| 5772 | goto yyerrorlab; |
| 5773 | |
| 5774 | yyvsp -= yylen; |
| 5775 | yyssp -= yylen; |
| 5776 | yystate = *yyssp; |
| 5777 | goto yyerrlab1; |
| 5778 | |
| 5779 | |
| 5780 | /*-------------------------------------------------------------. |
| 5781 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5782 | `-------------------------------------------------------------*/ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5783 | yyerrlab1: |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5784 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5785 | |
| 5786 | for (;;) |
| 5787 | { |
| 5788 | yyn = yypact[yystate]; |
| 5789 | if (yyn != YYPACT_NINF) |
| 5790 | { |
| 5791 | yyn += YYTERROR; |
| 5792 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5793 | { |
| 5794 | yyn = yytable[yyn]; |
| 5795 | if (0 < yyn) |
| 5796 | break; |
| 5797 | } |
| 5798 | } |
| 5799 | |
| 5800 | /* Pop the current state because it cannot handle the error token. */ |
| 5801 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5802 | YYABORT; |
| 5803 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5804 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5805 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 5806 | YYPOPSTACK; |
| 5807 | yystate = *yyssp; |
| 5808 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5809 | } |
| 5810 | |
| 5811 | if (yyn == YYFINAL) |
| 5812 | YYACCEPT; |
| 5813 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5814 | *++yyvsp = yylval; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5815 | |
| 5816 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5817 | /* Shift the error token. */ |
| 5818 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
| 5819 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5820 | yystate = yyn; |
| 5821 | goto yynewstate; |
| 5822 | |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 5823 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5824 | /*-------------------------------------. |
| 5825 | | yyacceptlab -- YYACCEPT comes here. | |
| 5826 | `-------------------------------------*/ |
| 5827 | yyacceptlab: |
| 5828 | yyresult = 0; |
| 5829 | goto yyreturn; |
| 5830 | |
| 5831 | /*-----------------------------------. |
| 5832 | | yyabortlab -- YYABORT comes here. | |
| 5833 | `-----------------------------------*/ |
| 5834 | yyabortlab: |
| 5835 | yyresult = 1; |
| 5836 | goto yyreturn; |
| 5837 | |
| 5838 | #ifndef yyoverflow |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5839 | /*-------------------------------------------------. |
| 5840 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5841 | `-------------------------------------------------*/ |
| 5842 | yyexhaustedlab: |
| 5843 | yyerror (YY_("memory exhausted")); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5844 | yyresult = 2; |
| 5845 | /* Fall through. */ |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 5846 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5847 | |
| 5848 | yyreturn: |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5849 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5850 | yydestruct ("Cleanup: discarding lookahead", |
| 5851 | yytoken, &yylval); |
| 5852 | while (yyssp != yyss) |
| 5853 | { |
| 5854 | yydestruct ("Cleanup: popping", |
| 5855 | yystos[*yyssp], yyvsp); |
| 5856 | YYPOPSTACK; |
| 5857 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5858 | #ifndef yyoverflow |
| 5859 | if (yyss != yyssa) |
| 5860 | YYSTACK_FREE (yyss); |
| 5861 | #endif |
| 5862 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5863 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5864 | |
| 5865 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame^] | 5866 | #line 2868 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5867 | |
| 5868 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5869 | // common code from the two 'RunVMAsmParser' functions |
| 5870 | static Module* RunParser(Module * M) { |
| 5871 | |
| 5872 | llvmAsmlineno = 1; // Reset the current line number... |
| 5873 | CurModule.CurrentModule = M; |
| 5874 | #if YYDEBUG |
| 5875 | yydebug = Debug; |
| 5876 | #endif |
| 5877 | |
| 5878 | // Check to make sure the parser succeeded |
| 5879 | if (yyparse()) { |
| 5880 | if (ParserResult) |
| 5881 | delete ParserResult; |
| 5882 | return 0; |
| 5883 | } |
| 5884 | |
| 5885 | // Check to make sure that parsing produced a result |
| 5886 | if (!ParserResult) |
| 5887 | return 0; |
| 5888 | |
| 5889 | // Reset ParserResult variable while saving its value for the result. |
| 5890 | Module *Result = ParserResult; |
| 5891 | ParserResult = 0; |
| 5892 | |
| 5893 | return Result; |
| 5894 | } |
| 5895 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5896 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5897 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5898 | // TODO: column number in exception |
| 5899 | if (TheParseError) |
| 5900 | TheParseError->setError(CurFilename, message, LineNo); |
| 5901 | TriggerError = 1; |
| 5902 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5903 | |
| 5904 | int yyerror(const char *ErrorMsg) { |
| 5905 | std::string where |
| 5906 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5907 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5908 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5909 | if (yychar == YYEMPTY || yychar == 0) |
| 5910 | errMsg += "end-of-file."; |
| 5911 | else |
| 5912 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5913 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5914 | return 0; |
| 5915 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5916 | |