Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1 | /* A Bison parser, made from /usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y, by GNU bison 1.75. */ |
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, |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 18 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, 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. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 37 | #define YYBISON 1 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 38 | |
| 39 | /* Pure parsers. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 40 | #define YYPURE 0 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 41 | |
| 42 | /* Using locations. */ |
| 43 | #define YYLSP_NEEDED 0 |
| 44 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 45 | /* If NAME_PREFIX is specified substitute the variables and functions |
| 46 | names. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 47 | #define yyparse llvmAsmparse |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 48 | #define yylex llvmAsmlex |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 49 | #define yyerror llvmAsmerror |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 50 | #define yylval llvmAsmlval |
| 51 | #define yychar llvmAsmchar |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 52 | #define yydebug llvmAsmdebug |
| 53 | #define yynerrs llvmAsmnerrs |
| 54 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 55 | |
| 56 | /* Tokens. */ |
| 57 | #ifndef YYTOKENTYPE |
| 58 | # define YYTOKENTYPE |
| 59 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 60 | know about them. */ |
| 61 | enum yytokentype { |
| 62 | ESINT64VAL = 258, |
| 63 | EUINT64VAL = 259, |
| 64 | SINTVAL = 260, |
| 65 | UINTVAL = 261, |
| 66 | FPVAL = 262, |
| 67 | VOID = 263, |
| 68 | INTTYPE = 264, |
| 69 | FLOAT = 265, |
| 70 | DOUBLE = 266, |
| 71 | LABEL = 267, |
| 72 | TYPE = 268, |
| 73 | VAR_ID = 269, |
| 74 | LABELSTR = 270, |
| 75 | STRINGCONSTANT = 271, |
| 76 | IMPLEMENTATION = 272, |
| 77 | ZEROINITIALIZER = 273, |
| 78 | TRUETOK = 274, |
| 79 | FALSETOK = 275, |
| 80 | BEGINTOK = 276, |
| 81 | ENDTOK = 277, |
| 82 | DECLARE = 278, |
| 83 | DEFINE = 279, |
| 84 | GLOBAL = 280, |
| 85 | CONSTANT = 281, |
| 86 | SECTION = 282, |
| 87 | VOLATILE = 283, |
| 88 | TO = 284, |
| 89 | DOTDOTDOT = 285, |
| 90 | NULL_TOK = 286, |
| 91 | UNDEF = 287, |
| 92 | INTERNAL = 288, |
| 93 | LINKONCE = 289, |
| 94 | WEAK = 290, |
| 95 | APPENDING = 291, |
| 96 | DLLIMPORT = 292, |
| 97 | DLLEXPORT = 293, |
| 98 | EXTERN_WEAK = 294, |
| 99 | OPAQUE = 295, |
| 100 | EXTERNAL = 296, |
| 101 | TARGET = 297, |
| 102 | TRIPLE = 298, |
| 103 | ENDIAN = 299, |
| 104 | POINTERSIZE = 300, |
| 105 | LITTLE = 301, |
| 106 | BIG = 302, |
| 107 | ALIGN = 303, |
| 108 | DEPLIBS = 304, |
| 109 | CALL = 305, |
| 110 | TAIL = 306, |
| 111 | ASM_TOK = 307, |
| 112 | MODULE = 308, |
| 113 | SIDEEFFECT = 309, |
| 114 | CC_TOK = 310, |
| 115 | CCC_TOK = 311, |
| 116 | CSRETCC_TOK = 312, |
| 117 | FASTCC_TOK = 313, |
| 118 | COLDCC_TOK = 314, |
| 119 | X86_STDCALLCC_TOK = 315, |
| 120 | X86_FASTCALLCC_TOK = 316, |
| 121 | DATALAYOUT = 317, |
| 122 | RET = 318, |
| 123 | BR = 319, |
| 124 | SWITCH = 320, |
| 125 | INVOKE = 321, |
| 126 | UNWIND = 322, |
| 127 | UNREACHABLE = 323, |
| 128 | ADD = 324, |
| 129 | SUB = 325, |
| 130 | MUL = 326, |
| 131 | UDIV = 327, |
| 132 | SDIV = 328, |
| 133 | FDIV = 329, |
| 134 | UREM = 330, |
| 135 | SREM = 331, |
| 136 | FREM = 332, |
| 137 | AND = 333, |
| 138 | OR = 334, |
| 139 | XOR = 335, |
| 140 | ICMP = 336, |
| 141 | FCMP = 337, |
| 142 | EQ = 338, |
| 143 | NE = 339, |
| 144 | SLT = 340, |
| 145 | SGT = 341, |
| 146 | SLE = 342, |
| 147 | SGE = 343, |
| 148 | ULT = 344, |
| 149 | UGT = 345, |
| 150 | ULE = 346, |
| 151 | UGE = 347, |
| 152 | OEQ = 348, |
| 153 | ONE = 349, |
| 154 | OLT = 350, |
| 155 | OGT = 351, |
| 156 | OLE = 352, |
| 157 | OGE = 353, |
| 158 | ORD = 354, |
| 159 | UNO = 355, |
| 160 | UEQ = 356, |
| 161 | UNE = 357, |
| 162 | MALLOC = 358, |
| 163 | ALLOCA = 359, |
| 164 | FREE = 360, |
| 165 | LOAD = 361, |
| 166 | STORE = 362, |
| 167 | GETELEMENTPTR = 363, |
| 168 | TRUNC = 364, |
| 169 | ZEXT = 365, |
| 170 | SEXT = 366, |
| 171 | FPTRUNC = 367, |
| 172 | FPEXT = 368, |
| 173 | BITCAST = 369, |
| 174 | UITOFP = 370, |
| 175 | SITOFP = 371, |
| 176 | FPTOUI = 372, |
| 177 | FPTOSI = 373, |
| 178 | INTTOPTR = 374, |
| 179 | PTRTOINT = 375, |
| 180 | PHI_TOK = 376, |
| 181 | SELECT = 377, |
| 182 | SHL = 378, |
| 183 | LSHR = 379, |
| 184 | ASHR = 380, |
| 185 | VAARG = 381, |
| 186 | EXTRACTELEMENT = 382, |
| 187 | INSERTELEMENT = 383, |
| 188 | SHUFFLEVECTOR = 384, |
| 189 | NORETURN = 385, |
| 190 | DEFAULT = 386, |
| 191 | HIDDEN = 387 |
| 192 | }; |
| 193 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 194 | #define ESINT64VAL 258 |
| 195 | #define EUINT64VAL 259 |
| 196 | #define SINTVAL 260 |
| 197 | #define UINTVAL 261 |
| 198 | #define FPVAL 262 |
| 199 | #define VOID 263 |
| 200 | #define INTTYPE 264 |
| 201 | #define FLOAT 265 |
| 202 | #define DOUBLE 266 |
| 203 | #define LABEL 267 |
| 204 | #define TYPE 268 |
| 205 | #define VAR_ID 269 |
| 206 | #define LABELSTR 270 |
| 207 | #define STRINGCONSTANT 271 |
| 208 | #define IMPLEMENTATION 272 |
| 209 | #define ZEROINITIALIZER 273 |
| 210 | #define TRUETOK 274 |
| 211 | #define FALSETOK 275 |
| 212 | #define BEGINTOK 276 |
| 213 | #define ENDTOK 277 |
| 214 | #define DECLARE 278 |
| 215 | #define DEFINE 279 |
| 216 | #define GLOBAL 280 |
| 217 | #define CONSTANT 281 |
| 218 | #define SECTION 282 |
| 219 | #define VOLATILE 283 |
| 220 | #define TO 284 |
| 221 | #define DOTDOTDOT 285 |
| 222 | #define NULL_TOK 286 |
| 223 | #define UNDEF 287 |
| 224 | #define INTERNAL 288 |
| 225 | #define LINKONCE 289 |
| 226 | #define WEAK 290 |
| 227 | #define APPENDING 291 |
| 228 | #define DLLIMPORT 292 |
| 229 | #define DLLEXPORT 293 |
| 230 | #define EXTERN_WEAK 294 |
| 231 | #define OPAQUE 295 |
| 232 | #define EXTERNAL 296 |
| 233 | #define TARGET 297 |
| 234 | #define TRIPLE 298 |
| 235 | #define ENDIAN 299 |
| 236 | #define POINTERSIZE 300 |
| 237 | #define LITTLE 301 |
| 238 | #define BIG 302 |
| 239 | #define ALIGN 303 |
| 240 | #define DEPLIBS 304 |
| 241 | #define CALL 305 |
| 242 | #define TAIL 306 |
| 243 | #define ASM_TOK 307 |
| 244 | #define MODULE 308 |
| 245 | #define SIDEEFFECT 309 |
| 246 | #define CC_TOK 310 |
| 247 | #define CCC_TOK 311 |
| 248 | #define CSRETCC_TOK 312 |
| 249 | #define FASTCC_TOK 313 |
| 250 | #define COLDCC_TOK 314 |
| 251 | #define X86_STDCALLCC_TOK 315 |
| 252 | #define X86_FASTCALLCC_TOK 316 |
| 253 | #define DATALAYOUT 317 |
| 254 | #define RET 318 |
| 255 | #define BR 319 |
| 256 | #define SWITCH 320 |
| 257 | #define INVOKE 321 |
| 258 | #define UNWIND 322 |
| 259 | #define UNREACHABLE 323 |
| 260 | #define ADD 324 |
| 261 | #define SUB 325 |
| 262 | #define MUL 326 |
| 263 | #define UDIV 327 |
| 264 | #define SDIV 328 |
| 265 | #define FDIV 329 |
| 266 | #define UREM 330 |
| 267 | #define SREM 331 |
| 268 | #define FREM 332 |
| 269 | #define AND 333 |
| 270 | #define OR 334 |
| 271 | #define XOR 335 |
| 272 | #define ICMP 336 |
| 273 | #define FCMP 337 |
| 274 | #define EQ 338 |
| 275 | #define NE 339 |
| 276 | #define SLT 340 |
| 277 | #define SGT 341 |
| 278 | #define SLE 342 |
| 279 | #define SGE 343 |
| 280 | #define ULT 344 |
| 281 | #define UGT 345 |
| 282 | #define ULE 346 |
| 283 | #define UGE 347 |
| 284 | #define OEQ 348 |
| 285 | #define ONE 349 |
| 286 | #define OLT 350 |
| 287 | #define OGT 351 |
| 288 | #define OLE 352 |
| 289 | #define OGE 353 |
| 290 | #define ORD 354 |
| 291 | #define UNO 355 |
| 292 | #define UEQ 356 |
| 293 | #define UNE 357 |
| 294 | #define MALLOC 358 |
| 295 | #define ALLOCA 359 |
| 296 | #define FREE 360 |
| 297 | #define LOAD 361 |
| 298 | #define STORE 362 |
| 299 | #define GETELEMENTPTR 363 |
| 300 | #define TRUNC 364 |
| 301 | #define ZEXT 365 |
| 302 | #define SEXT 366 |
| 303 | #define FPTRUNC 367 |
| 304 | #define FPEXT 368 |
| 305 | #define BITCAST 369 |
| 306 | #define UITOFP 370 |
| 307 | #define SITOFP 371 |
| 308 | #define FPTOUI 372 |
| 309 | #define FPTOSI 373 |
| 310 | #define INTTOPTR 374 |
| 311 | #define PTRTOINT 375 |
| 312 | #define PHI_TOK 376 |
| 313 | #define SELECT 377 |
| 314 | #define SHL 378 |
| 315 | #define LSHR 379 |
| 316 | #define ASHR 380 |
| 317 | #define VAARG 381 |
| 318 | #define EXTRACTELEMENT 382 |
| 319 | #define INSERTELEMENT 383 |
| 320 | #define SHUFFLEVECTOR 384 |
| 321 | #define NORETURN 385 |
| 322 | #define DEFAULT 386 |
| 323 | #define HIDDEN 387 |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | /* Copy the first part of user declarations. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 329 | #line 14 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 330 | |
| 331 | #include "ParserInternals.h" |
| 332 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 333 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 334 | #include "llvm/Instructions.h" |
| 335 | #include "llvm/Module.h" |
| 336 | #include "llvm/SymbolTable.h" |
| 337 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 338 | #include "llvm/Support/CommandLine.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 339 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 340 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 341 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 342 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 343 | #include <list> |
| 344 | #include <utility> |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 345 | #ifndef NDEBUG |
| 346 | #define YYDEBUG 1 |
| 347 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 348 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 349 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 350 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 351 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 352 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 353 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 354 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 355 | // GenerateError are made from inside productions and they must simulate the |
| 356 | // previous exception behavior by exiting the production immediately. We have |
| 357 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 358 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 359 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 360 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 361 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 362 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 363 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 364 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 365 | int yylex(); // declaration" of xxx warnings. |
| 366 | int yyparse(); |
| 367 | |
| 368 | namespace llvm { |
| 369 | std::string CurFilename; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 370 | #if YYDEBUG |
| 371 | static cl::opt<bool> |
| 372 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), |
| 373 | cl::Hidden, cl::init(false)); |
| 374 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 375 | } |
| 376 | using namespace llvm; |
| 377 | |
| 378 | static Module *ParserResult; |
| 379 | |
| 380 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 381 | // relating to upreferences in the input stream. |
| 382 | // |
| 383 | //#define DEBUG_UPREFS 1 |
| 384 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 385 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 386 | #else |
| 387 | #define UR_OUT(X) |
| 388 | #endif |
| 389 | |
| 390 | #define YYERROR_VERBOSE 1 |
| 391 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 392 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 393 | |
| 394 | |
| 395 | // This contains info used when building the body of a function. It is |
| 396 | // destroyed when the function is completed. |
| 397 | // |
| 398 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 399 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 400 | static void |
| 401 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 402 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 403 | |
| 404 | static struct PerModuleInfo { |
| 405 | Module *CurrentModule; |
| 406 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 407 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 408 | std::vector<PATypeHolder> Types; |
| 409 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 410 | |
| 411 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 412 | /// 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] | 413 | /// that we can resolve them later and print error messages as appropriate. |
| 414 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 415 | |
| 416 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 417 | // references to global values. Global values may be referenced before they |
| 418 | // are defined, and if so, the temporary object that they represent is held |
| 419 | // here. This is used for forward references of GlobalValues. |
| 420 | // |
| 421 | typedef std::map<std::pair<const PointerType *, |
| 422 | ValID>, GlobalValue*> GlobalRefsType; |
| 423 | GlobalRefsType GlobalRefs; |
| 424 | |
| 425 | void ModuleDone() { |
| 426 | // If we could not resolve some functions at function compilation time |
| 427 | // (calls to functions before they are defined), resolve them now... Types |
| 428 | // are resolved when the constant pool has been completely parsed. |
| 429 | // |
| 430 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 431 | if (TriggerError) |
| 432 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 433 | |
| 434 | // Check to make sure that all global value forward references have been |
| 435 | // resolved! |
| 436 | // |
| 437 | if (!GlobalRefs.empty()) { |
| 438 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 439 | |
| 440 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 441 | I != E; ++I) { |
| 442 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 443 | I->first.second.getName() + "\n"; |
| 444 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 445 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 446 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | Values.clear(); // Clear out function local definitions |
| 450 | Types.clear(); |
| 451 | CurrentModule = 0; |
| 452 | } |
| 453 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 454 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 455 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 456 | // If not, just return null. |
| 457 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 458 | // Check to see if there is a forward reference to this global variable... |
| 459 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 460 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 461 | GlobalValue *Ret = 0; |
| 462 | if (I != GlobalRefs.end()) { |
| 463 | Ret = I->second; |
| 464 | GlobalRefs.erase(I); |
| 465 | } |
| 466 | return Ret; |
| 467 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 468 | |
| 469 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 470 | // If it isn't abstract, its resolved |
| 471 | const Type* Ty = PATy->get(); |
| 472 | if (!Ty->isAbstract()) |
| 473 | return false; |
| 474 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 475 | // we don't need to traverse that leg of the type. |
| 476 | std::vector<const Type*> WorkList, SeenList; |
| 477 | WorkList.push_back(Ty); |
| 478 | while (!WorkList.empty()) { |
| 479 | const Type* Ty = WorkList.back(); |
| 480 | SeenList.push_back(Ty); |
| 481 | WorkList.pop_back(); |
| 482 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 483 | // Check to see if this is an unresolved type |
| 484 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 485 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 486 | for ( ; I != E; ++I) { |
| 487 | if (I->second.get() == OpTy) |
| 488 | return true; |
| 489 | } |
| 490 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 491 | const Type* TheTy = SeqTy->getElementType(); |
| 492 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 493 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 494 | E = SeenList.end(); |
| 495 | for ( ; I != E; ++I) |
| 496 | if (*I == TheTy) |
| 497 | break; |
| 498 | if (I == E) |
| 499 | WorkList.push_back(TheTy); |
| 500 | } |
| 501 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 502 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 503 | const Type* TheTy = StrTy->getElementType(i); |
| 504 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 505 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 506 | E = SeenList.end(); |
| 507 | for ( ; I != E; ++I) |
| 508 | if (*I == TheTy) |
| 509 | break; |
| 510 | if (I == E) |
| 511 | WorkList.push_back(TheTy); |
| 512 | } |
| 513 | } |
| 514 | } |
| 515 | } |
| 516 | return false; |
| 517 | } |
| 518 | |
| 519 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 520 | } CurModule; |
| 521 | |
| 522 | static struct PerFunctionInfo { |
| 523 | Function *CurrentFunction; // Pointer to current function being created |
| 524 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 525 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 526 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 527 | bool isDeclare; // Is this function a forward declararation? |
| 528 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 529 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 530 | |
| 531 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 532 | /// track of them here. |
| 533 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 534 | std::vector<BasicBlock*> NumberedBlocks; |
| 535 | unsigned NextBBNum; |
| 536 | |
| 537 | inline PerFunctionInfo() { |
| 538 | CurrentFunction = 0; |
| 539 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 540 | Linkage = GlobalValue::ExternalLinkage; |
| 541 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | inline void FunctionStart(Function *M) { |
| 545 | CurrentFunction = M; |
| 546 | NextBBNum = 0; |
| 547 | } |
| 548 | |
| 549 | void FunctionDone() { |
| 550 | NumberedBlocks.clear(); |
| 551 | |
| 552 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 553 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 554 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 555 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 556 | return; |
| 557 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 558 | |
| 559 | // Resolve all forward references now. |
| 560 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 561 | |
| 562 | Values.clear(); // Clear out function local definitions |
| 563 | CurrentFunction = 0; |
| 564 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 565 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 566 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 567 | } |
| 568 | } CurFun; // Info for the current function... |
| 569 | |
| 570 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 571 | |
| 572 | |
| 573 | //===----------------------------------------------------------------------===// |
| 574 | // Code to handle definitions of all the types |
| 575 | //===----------------------------------------------------------------------===// |
| 576 | |
| 577 | static int InsertValue(Value *V, |
| 578 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 579 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 580 | |
| 581 | // Yes, insert the value into the value table... |
| 582 | ValueList &List = ValueTab[V->getType()]; |
| 583 | List.push_back(V); |
| 584 | return List.size()-1; |
| 585 | } |
| 586 | |
| 587 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 588 | switch (D.Type) { |
| 589 | case ValID::NumberVal: // Is it a numbered definition? |
| 590 | // Module constants occupy the lowest numbered slots... |
| 591 | if ((unsigned)D.Num < CurModule.Types.size()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 592 | return CurModule.Types[(unsigned)D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 593 | break; |
| 594 | case ValID::NameVal: // Is it a named definition? |
| 595 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 596 | D.destroy(); // Free old strdup'd memory... |
| 597 | return N; |
| 598 | } |
| 599 | break; |
| 600 | default: |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 601 | GenerateError("Internal parser error: Invalid symbol type reference!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 602 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 603 | } |
| 604 | |
| 605 | // If we reached here, we referenced either a symbol that we don't know about |
| 606 | // or an id number that hasn't been read yet. We may be referencing something |
| 607 | // forward, so just create an entry to be resolved later and get to it... |
| 608 | // |
| 609 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 610 | |
| 611 | |
| 612 | if (inFunctionScope()) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 613 | if (D.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 614 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 615 | return 0; |
| 616 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 617 | GenerateError("Reference to an undefined type: #" + itostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 618 | return 0; |
| 619 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 620 | } |
| 621 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 622 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 623 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 624 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 625 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 626 | Type *Typ = OpaqueType::get(); |
| 627 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 628 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 629 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 630 | |
| 631 | static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { |
| 632 | SymbolTable &SymTab = |
Reid Spencer | 78d033e | 2007-01-06 07:24:44 +0000 | [diff] [blame] | 633 | inFunctionScope() ? CurFun.CurrentFunction->getValueSymbolTable() : |
| 634 | CurModule.CurrentModule->getValueSymbolTable(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 635 | return SymTab.lookup(Ty, Name); |
| 636 | } |
| 637 | |
| 638 | // getValNonImprovising - Look up the value specified by the provided type and |
| 639 | // the provided ValID. If the value exists and has already been defined, return |
| 640 | // it. Otherwise return null. |
| 641 | // |
| 642 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 643 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 644 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 645 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 646 | return 0; |
| 647 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 648 | |
| 649 | switch (D.Type) { |
| 650 | case ValID::NumberVal: { // Is it a numbered definition? |
| 651 | unsigned Num = (unsigned)D.Num; |
| 652 | |
| 653 | // Module constants occupy the lowest numbered slots... |
| 654 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 655 | if (VI != CurModule.Values.end()) { |
| 656 | if (Num < VI->second.size()) |
| 657 | return VI->second[Num]; |
| 658 | Num -= VI->second.size(); |
| 659 | } |
| 660 | |
| 661 | // Make sure that our type is within bounds |
| 662 | VI = CurFun.Values.find(Ty); |
| 663 | if (VI == CurFun.Values.end()) return 0; |
| 664 | |
| 665 | // Check that the number is within bounds... |
| 666 | if (VI->second.size() <= Num) return 0; |
| 667 | |
| 668 | return VI->second[Num]; |
| 669 | } |
| 670 | |
| 671 | case ValID::NameVal: { // Is it a named definition? |
| 672 | Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); |
| 673 | if (N == 0) return 0; |
| 674 | |
| 675 | D.destroy(); // Free old strdup'd memory... |
| 676 | return N; |
| 677 | } |
| 678 | |
| 679 | // Check to make sure that "Ty" is an integral type, and that our |
| 680 | // value will fit into the specified type... |
| 681 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 682 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 683 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 684 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 685 | Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 686 | return 0; |
| 687 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 688 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 689 | |
| 690 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 691 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 692 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 693 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 694 | "' is invalid or out of range!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 695 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 696 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 697 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 698 | } |
| 699 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 700 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 701 | } |
| 702 | |
| 703 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 704 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 705 | GenerateError("FP constant invalid for type!!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 706 | return 0; |
| 707 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 708 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 709 | |
| 710 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 711 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 712 | GenerateError("Cannot create a a non pointer null!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 713 | return 0; |
| 714 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 715 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 716 | |
| 717 | case ValID::ConstUndefVal: // Is it an undef value? |
| 718 | return UndefValue::get(Ty); |
| 719 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 720 | case ValID::ConstZeroVal: // Is it a zero value? |
| 721 | return Constant::getNullValue(Ty); |
| 722 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 723 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 724 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 725 | GenerateError("Constant expression type different from required type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 726 | return 0; |
| 727 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 728 | return D.ConstantValue; |
| 729 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 730 | case ValID::InlineAsmVal: { // Inline asm expression |
| 731 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 732 | const FunctionType *FTy = |
| 733 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 734 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 735 | GenerateError("Invalid type for asm constraint string!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 736 | return 0; |
| 737 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 738 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 739 | D.IAD->HasSideEffects); |
| 740 | D.destroy(); // Free InlineAsmDescriptor. |
| 741 | return IA; |
| 742 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 743 | default: |
| 744 | assert(0 && "Unhandled case!"); |
| 745 | return 0; |
| 746 | } // End of switch |
| 747 | |
| 748 | assert(0 && "Unhandled case!"); |
| 749 | return 0; |
| 750 | } |
| 751 | |
| 752 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 753 | // value is not already defined, it "improvises" by creating a placeholder var |
| 754 | // that looks and acts just like the requested variable. When the value is |
| 755 | // defined later, all uses of the placeholder variable are replaced with the |
| 756 | // real thing. |
| 757 | // |
| 758 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 759 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 760 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 761 | return 0; |
| 762 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 763 | |
| 764 | // See if the value has already been defined. |
| 765 | Value *V = getValNonImprovising(Ty, ID); |
| 766 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 767 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 768 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 769 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 770 | GenerateError("Invalid use of a composite type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 771 | return 0; |
| 772 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 773 | |
| 774 | // If we reached here, we referenced either a symbol that we don't know about |
| 775 | // or an id number that hasn't been read yet. We may be referencing something |
| 776 | // forward, so just create an entry to be resolved later and get to it... |
| 777 | // |
| 778 | V = new Argument(Ty); |
| 779 | |
| 780 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 781 | // to recycle these things?? |
| 782 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 783 | llvmAsmlineno))); |
| 784 | |
| 785 | if (inFunctionScope()) |
| 786 | InsertValue(V, CurFun.LateResolveValues); |
| 787 | else |
| 788 | InsertValue(V, CurModule.LateResolveValues); |
| 789 | return V; |
| 790 | } |
| 791 | |
| 792 | /// getBBVal - This is used for two purposes: |
| 793 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 794 | /// defined. |
| 795 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 796 | /// or may not be a forward reference. |
| 797 | /// |
| 798 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 799 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 800 | |
| 801 | std::string Name; |
| 802 | BasicBlock *BB = 0; |
| 803 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 804 | default: |
| 805 | GenerateError("Illegal label reference " + ID.getName()); |
| 806 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 807 | case ValID::NumberVal: // Is it a numbered definition? |
| 808 | if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) |
| 809 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 810 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 811 | break; |
| 812 | case ValID::NameVal: // Is it a named definition? |
| 813 | Name = ID.Name; |
| 814 | if (Value *N = CurFun.CurrentFunction-> |
Reid Spencer | 78d033e | 2007-01-06 07:24:44 +0000 | [diff] [blame] | 815 | getValueSymbolTable().lookup(Type::LabelTy, Name)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 816 | BB = cast<BasicBlock>(N); |
| 817 | break; |
| 818 | } |
| 819 | |
| 820 | // See if the block has already been defined. |
| 821 | if (BB) { |
| 822 | // If this is the definition of the block, make sure the existing value was |
| 823 | // just a forward reference. If it was a forward reference, there will be |
| 824 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 825 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 826 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 827 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 828 | return 0; |
| 829 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 830 | |
| 831 | ID.destroy(); // Free strdup'd memory. |
| 832 | return BB; |
| 833 | } |
| 834 | |
| 835 | // Otherwise this block has not been seen before. |
| 836 | BB = new BasicBlock("", CurFun.CurrentFunction); |
| 837 | if (ID.Type == ValID::NameVal) { |
| 838 | BB->setName(ID.Name); |
| 839 | } else { |
| 840 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 841 | } |
| 842 | |
| 843 | // If this is not a definition, keep track of it so we can use it as a forward |
| 844 | // reference. |
| 845 | if (!isDefinition) { |
| 846 | // Remember where this forward reference came from. |
| 847 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 848 | } else { |
| 849 | // The forward declaration could have been inserted anywhere in the |
| 850 | // function: insert it into the correct place now. |
| 851 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 852 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 853 | } |
| 854 | ID.destroy(); |
| 855 | return BB; |
| 856 | } |
| 857 | |
| 858 | |
| 859 | //===----------------------------------------------------------------------===// |
| 860 | // Code to handle forward references in instructions |
| 861 | //===----------------------------------------------------------------------===// |
| 862 | // |
| 863 | // This code handles the late binding needed with statements that reference |
| 864 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 865 | // a loop body. |
| 866 | // |
| 867 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 868 | // and back patchs after we are done. |
| 869 | // |
| 870 | |
| 871 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 872 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 873 | // defs now... |
| 874 | // |
| 875 | static void |
| 876 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 877 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 878 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 879 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 880 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 881 | ValueList &List = LRI->second; |
| 882 | while (!List.empty()) { |
| 883 | Value *V = List.back(); |
| 884 | List.pop_back(); |
| 885 | |
| 886 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 887 | CurModule.PlaceHolderInfo.find(V); |
| 888 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 889 | |
| 890 | ValID &DID = PHI->second.first; |
| 891 | |
| 892 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 893 | if (TriggerError) |
| 894 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 895 | if (TheRealValue) { |
| 896 | V->replaceAllUsesWith(TheRealValue); |
| 897 | delete V; |
| 898 | CurModule.PlaceHolderInfo.erase(PHI); |
| 899 | } else if (FutureLateResolvers) { |
| 900 | // Functions have their unresolved items forwarded to the module late |
| 901 | // resolver table |
| 902 | InsertValue(V, *FutureLateResolvers); |
| 903 | } else { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 904 | if (DID.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 905 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 906 | "' of type '" + V->getType()->getDescription() + "'", |
| 907 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 908 | return; |
| 909 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 910 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 911 | itostr(DID.Num) + " of type '" + |
| 912 | V->getType()->getDescription() + "'", |
| 913 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 914 | return; |
| 915 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 916 | } |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | LateResolvers.clear(); |
| 921 | } |
| 922 | |
| 923 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 924 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 925 | // refering to the number can be resolved. Do this now. |
| 926 | // |
| 927 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 928 | ValID D; |
| 929 | if (Name) D = ValID::create(Name); |
| 930 | else D = ValID::create((int)CurModule.Types.size()); |
| 931 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 932 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 933 | CurModule.LateResolveTypes.find(D); |
| 934 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 935 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 936 | CurModule.LateResolveTypes.erase(I); |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | // setValueName - Set the specified value to the name given. The name may be |
| 941 | // null potentially, in which case this is a noop. The string passed in is |
| 942 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 943 | // |
| 944 | static void setValueName(Value *V, char *NameStr) { |
| 945 | if (NameStr) { |
| 946 | std::string Name(NameStr); // Copy string |
| 947 | free(NameStr); // Free old string |
| 948 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 949 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 950 | GenerateError("Can't assign name '" + Name+"' to value with void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 951 | return; |
| 952 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 953 | |
| 954 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | 78d033e | 2007-01-06 07:24:44 +0000 | [diff] [blame] | 955 | SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 956 | if (ST.lookup(V->getType(), Name)) { |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 957 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
| 958 | V->getType()->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 959 | return; |
| 960 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 961 | |
| 962 | // Set the name. |
| 963 | V->setName(Name); |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 968 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 969 | static GlobalVariable * |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 970 | ParseGlobalVariable(char *NameStr, |
| 971 | GlobalValue::LinkageTypes Linkage, |
| 972 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 973 | bool isConstantGlobal, const Type *Ty, |
| 974 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 975 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 976 | GenerateError("Cannot declare global vars of function type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 977 | return 0; |
| 978 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 979 | |
| 980 | const PointerType *PTy = PointerType::get(Ty); |
| 981 | |
| 982 | std::string Name; |
| 983 | if (NameStr) { |
| 984 | Name = NameStr; // Copy string |
| 985 | free(NameStr); // Free old string |
| 986 | } |
| 987 | |
| 988 | // See if this global value was forward referenced. If so, recycle the |
| 989 | // object. |
| 990 | ValID ID; |
| 991 | if (!Name.empty()) { |
| 992 | ID = ValID::create((char*)Name.c_str()); |
| 993 | } else { |
| 994 | ID = ValID::create((int)CurModule.Values[PTy].size()); |
| 995 | } |
| 996 | |
| 997 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 998 | // Move the global to the end of the list, from whereever it was |
| 999 | // previously inserted. |
| 1000 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1001 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1002 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1003 | GV->setInitializer(Initializer); |
| 1004 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1005 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1006 | GV->setConstant(isConstantGlobal); |
| 1007 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1008 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1009 | } |
| 1010 | |
| 1011 | // 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] | 1012 | // of this global in the module. If so, it is an error. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1013 | if (!Name.empty()) { |
| 1014 | // We are a simple redefinition of a value, check to see if it is defined |
| 1015 | // the same as the old one. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1016 | if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1017 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1018 | "' of type '" + Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1019 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | // Otherwise there is no existing GV to use, create one now. |
| 1024 | GlobalVariable *GV = |
| 1025 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1026 | CurModule.CurrentModule); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1027 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1028 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1029 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1030 | } |
| 1031 | |
| 1032 | // setTypeName - Set the specified type to the name given. The name may be |
| 1033 | // null potentially, in which case this is a noop. The string passed in is |
| 1034 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1035 | // |
| 1036 | // This function returns true if the type has already been defined, but is |
| 1037 | // allowed to be redefined in the specified context. If the name is a new name |
| 1038 | // for the type plane, it is inserted and false is returned. |
| 1039 | static bool setTypeName(const Type *T, char *NameStr) { |
| 1040 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 1041 | if (NameStr == 0) return false; |
| 1042 | |
| 1043 | std::string Name(NameStr); // Copy string |
| 1044 | free(NameStr); // Free old string |
| 1045 | |
| 1046 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1047 | if (T == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1048 | GenerateError("Can't assign name '" + Name + "' to the void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1049 | return false; |
| 1050 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1051 | |
| 1052 | // Set the type name, checking for conflicts as we do so. |
| 1053 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1054 | |
| 1055 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1056 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1057 | assert(Existing && "Conflict but no matching type?"); |
| 1058 | |
| 1059 | // There is only one case where this is allowed: when we are refining an |
| 1060 | // opaque type. In this case, Existing will be an opaque type. |
| 1061 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1062 | // We ARE replacing an opaque type! |
| 1063 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1064 | return true; |
| 1065 | } |
| 1066 | |
| 1067 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1068 | // the redefinition is identical to the original. This will be so if |
| 1069 | // Existing and T point to the same Type object. In this one case we |
| 1070 | // allow the equivalent redefinition. |
| 1071 | if (Existing == T) return true; // Yes, it's equal. |
| 1072 | |
| 1073 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1074 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
| 1075 | T->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1076 | } |
| 1077 | |
| 1078 | return false; |
| 1079 | } |
| 1080 | |
| 1081 | //===----------------------------------------------------------------------===// |
| 1082 | // Code for handling upreferences in type names... |
| 1083 | // |
| 1084 | |
| 1085 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1086 | // |
| 1087 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1088 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1089 | E) != Ty->subtype_end(); |
| 1090 | } |
| 1091 | |
| 1092 | namespace { |
| 1093 | struct UpRefRecord { |
| 1094 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1095 | // this type is resolved. |
| 1096 | unsigned NestingLevel; |
| 1097 | |
| 1098 | // LastContainedTy - This is the type at the current binding level for the |
| 1099 | // type. Every time we reduce the nesting level, this gets updated. |
| 1100 | const Type *LastContainedTy; |
| 1101 | |
| 1102 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1103 | // represented with. |
| 1104 | OpaqueType *UpRefTy; |
| 1105 | |
| 1106 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1107 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1108 | }; |
| 1109 | } |
| 1110 | |
| 1111 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1112 | static std::vector<UpRefRecord> UpRefs; |
| 1113 | |
| 1114 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1115 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1116 | /// currently active types. For each type, if the up reference is contained in |
| 1117 | /// the newly completed type, we decrement the level count. When the level |
| 1118 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1119 | /// thus we can complete the cycle. |
| 1120 | /// |
| 1121 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1122 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1123 | // nothing to resolve here. |
| 1124 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1125 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1126 | PATypeHolder Ty(ty); |
| 1127 | UR_OUT("Type '" << Ty->getDescription() << |
| 1128 | "' newly formed. Resolving upreferences.\n" << |
| 1129 | UpRefs.size() << " upreferences active!\n"); |
| 1130 | |
| 1131 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1132 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1133 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1134 | // this variable. |
| 1135 | OpaqueType *TypeToResolve = 0; |
| 1136 | |
| 1137 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1138 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1139 | << UpRefs[i].second->getDescription() << ") = " |
| 1140 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1141 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1142 | // Decrement level of upreference |
| 1143 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1144 | UpRefs[i].LastContainedTy = Ty; |
| 1145 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1146 | if (Level == 0) { // Upreference should be resolved! |
| 1147 | if (!TypeToResolve) { |
| 1148 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1149 | } else { |
| 1150 | UR_OUT(" * Resolving upreference for " |
| 1151 | << UpRefs[i].second->getDescription() << "\n"; |
| 1152 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1153 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1154 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1155 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1156 | } |
| 1157 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1158 | --i; // Do not skip the next element... |
| 1159 | } |
| 1160 | } |
| 1161 | } |
| 1162 | |
| 1163 | if (TypeToResolve) { |
| 1164 | UR_OUT(" * Resolving upreference for " |
| 1165 | << UpRefs[i].second->getDescription() << "\n"; |
| 1166 | std::string OldName = TypeToResolve->getDescription()); |
| 1167 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1168 | } |
| 1169 | |
| 1170 | return Ty; |
| 1171 | } |
| 1172 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1173 | //===----------------------------------------------------------------------===// |
| 1174 | // RunVMAsmParser - Define an interface to this parser |
| 1175 | //===----------------------------------------------------------------------===// |
| 1176 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1177 | static Module* RunParser(Module * M); |
| 1178 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1179 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1180 | set_scan_file(F); |
| 1181 | |
| 1182 | CurFilename = Filename; |
| 1183 | return RunParser(new Module(CurFilename)); |
| 1184 | } |
| 1185 | |
| 1186 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1187 | set_scan_string(AsmString); |
| 1188 | |
| 1189 | CurFilename = "from_memory"; |
| 1190 | if (M == NULL) { |
| 1191 | return RunParser(new Module (CurFilename)); |
| 1192 | } else { |
| 1193 | return RunParser(M); |
| 1194 | } |
| 1195 | } |
| 1196 | |
| 1197 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1198 | |
| 1199 | /* Enabling traces. */ |
| 1200 | #ifndef YYDEBUG |
| 1201 | # define YYDEBUG 0 |
| 1202 | #endif |
| 1203 | |
| 1204 | /* Enabling verbose error messages. */ |
| 1205 | #ifdef YYERROR_VERBOSE |
| 1206 | # undef YYERROR_VERBOSE |
| 1207 | # define YYERROR_VERBOSE 1 |
| 1208 | #else |
| 1209 | # define YYERROR_VERBOSE 0 |
| 1210 | #endif |
| 1211 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1212 | #ifndef YYSTYPE |
| 1213 | #line 883 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 1214 | typedef union { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1215 | llvm::Module *ModuleVal; |
| 1216 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1217 | llvm::BasicBlock *BasicBlockVal; |
| 1218 | llvm::TerminatorInst *TermInstVal; |
| 1219 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1220 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1221 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1222 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1223 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1224 | llvm::PATypeHolder *TypeVal; |
| 1225 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1226 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1227 | llvm::ArgListType *ArgList; |
| 1228 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1229 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1230 | llvm::ValueRefList *ValueRefList; |
| 1231 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1232 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1233 | std::list<std::pair<llvm::Value*, |
| 1234 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1235 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1236 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1237 | |
| 1238 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1239 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1240 | llvm::FunctionType::ParameterAttributes ParamAttrs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1241 | int64_t SInt64Val; |
| 1242 | uint64_t UInt64Val; |
| 1243 | int SIntVal; |
| 1244 | unsigned UIntVal; |
| 1245 | double FPVal; |
| 1246 | bool BoolVal; |
| 1247 | |
| 1248 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1249 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1250 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1251 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1252 | llvm::Instruction::TermOps TermOpVal; |
| 1253 | llvm::Instruction::MemoryOps MemOpVal; |
| 1254 | llvm::Instruction::CastOps CastOpVal; |
| 1255 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1256 | llvm::Module::Endianness Endianness; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1257 | llvm::ICmpInst::Predicate IPredicate; |
| 1258 | llvm::FCmpInst::Predicate FPredicate; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1259 | } yystype; |
| 1260 | /* Line 188 of /usr/local/share/bison/yacc.c. */ |
| 1261 | #line 1262 "llvmAsmParser.tab.c" |
| 1262 | # define YYSTYPE yystype |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1263 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1264 | #endif |
| 1265 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1266 | #ifndef YYLTYPE |
| 1267 | typedef struct yyltype |
| 1268 | { |
| 1269 | int first_line; |
| 1270 | int first_column; |
| 1271 | int last_line; |
| 1272 | int last_column; |
| 1273 | } yyltype; |
| 1274 | # define YYLTYPE yyltype |
| 1275 | # define YYLTYPE_IS_TRIVIAL 1 |
| 1276 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1277 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1278 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1279 | |
| 1280 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1281 | /* Line 213 of /usr/local/share/bison/yacc.c. */ |
| 1282 | #line 1283 "llvmAsmParser.tab.c" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1283 | |
| 1284 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1285 | |
| 1286 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1287 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1288 | # if YYSTACK_USE_ALLOCA |
| 1289 | # define YYSTACK_ALLOC alloca |
| 1290 | # else |
| 1291 | # ifndef YYSTACK_USE_ALLOCA |
| 1292 | # if defined (alloca) || defined (_ALLOCA_H) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1293 | # define YYSTACK_ALLOC alloca |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1294 | # else |
| 1295 | # ifdef __GNUC__ |
| 1296 | # define YYSTACK_ALLOC __builtin_alloca |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1297 | # endif |
| 1298 | # endif |
| 1299 | # endif |
| 1300 | # endif |
| 1301 | |
| 1302 | # ifdef YYSTACK_ALLOC |
| 1303 | /* Pacify GCC's `empty if-body' warning. */ |
| 1304 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1305 | # else |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1306 | # if defined (__STDC__) || defined (__cplusplus) |
| 1307 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1308 | # define YYSIZE_T size_t |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1309 | # endif |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1310 | # define YYSTACK_ALLOC malloc |
| 1311 | # define YYSTACK_FREE free |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1312 | # endif |
| 1313 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1314 | |
| 1315 | |
| 1316 | #if (! defined (yyoverflow) \ |
| 1317 | && (! defined (__cplusplus) \ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1318 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1319 | |
| 1320 | /* A type that is properly aligned for any stack member. */ |
| 1321 | union yyalloc |
| 1322 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1323 | short yyss; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1324 | YYSTYPE yyvs; |
| 1325 | }; |
| 1326 | |
| 1327 | /* The size of the maximum gap between one aligned stack and the next. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1328 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1329 | |
| 1330 | /* The size of an array large to enough to hold all stacks, each with |
| 1331 | N elements. */ |
| 1332 | # define YYSTACK_BYTES(N) \ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1333 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ |
| 1334 | + YYSTACK_GAP_MAX) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1335 | |
| 1336 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1337 | not overlap. */ |
| 1338 | # ifndef YYCOPY |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1339 | # if 1 < __GNUC__ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1340 | # define YYCOPY(To, From, Count) \ |
| 1341 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1342 | # else |
| 1343 | # define YYCOPY(To, From, Count) \ |
| 1344 | do \ |
| 1345 | { \ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1346 | register YYSIZE_T yyi; \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1347 | for (yyi = 0; yyi < (Count); yyi++) \ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1348 | (To)[yyi] = (From)[yyi]; \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1349 | } \ |
| 1350 | while (0) |
| 1351 | # endif |
| 1352 | # endif |
| 1353 | |
| 1354 | /* Relocate STACK from its old location to the new one. The |
| 1355 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1356 | elements in the stack, and YYPTR gives the new location of the |
| 1357 | stack. Advance YYPTR to a properly aligned location for the next |
| 1358 | stack. */ |
| 1359 | # define YYSTACK_RELOCATE(Stack) \ |
| 1360 | do \ |
| 1361 | { \ |
| 1362 | YYSIZE_T yynewbytes; \ |
| 1363 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1364 | Stack = &yyptr->Stack; \ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1365 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1366 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1367 | } \ |
| 1368 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1369 | |
| 1370 | #endif |
| 1371 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1372 | #if defined (__STDC__) || defined (__cplusplus) |
| 1373 | typedef signed char yysigned_char; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 1374 | #else |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1375 | typedef short yysigned_char; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 1376 | #endif |
| 1377 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1378 | /* YYFINAL -- State number of the termination state. */ |
| 1379 | #define YYFINAL 36 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1380 | #define YYLAST 1357 |
| 1381 | |
| 1382 | /* YYNTOKENS -- Number of terminals. */ |
| 1383 | #define YYNTOKENS 147 |
| 1384 | /* YYNNTS -- Number of nonterminals. */ |
| 1385 | #define YYNNTS 79 |
| 1386 | /* YYNRULES -- Number of rules. */ |
| 1387 | #define YYNRULES 285 |
| 1388 | /* YYNRULES -- Number of states. */ |
| 1389 | #define YYNSTATES 569 |
| 1390 | |
| 1391 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1392 | #define YYUNDEFTOK 2 |
| 1393 | #define YYMAXUTOK 387 |
| 1394 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1395 | #define YYTRANSLATE(X) \ |
| 1396 | ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1397 | |
| 1398 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1399 | static const unsigned char yytranslate[] = |
| 1400 | { |
| 1401 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1402 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1403 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1404 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1405 | 137, 138, 135, 2, 134, 2, 2, 2, 2, 2, |
| 1406 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1407 | 142, 133, 143, 2, 2, 2, 2, 2, 2, 2, |
| 1408 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1409 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1410 | 2, 139, 136, 141, 2, 2, 2, 2, 2, 146, |
| 1411 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1412 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1413 | 140, 2, 2, 144, 2, 145, 2, 2, 2, 2, |
| 1414 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1415 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1416 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1417 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1418 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1419 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1420 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1421 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1422 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1423 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1424 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1425 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1426 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1427 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1428 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1429 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1430 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1431 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1432 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1433 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1434 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1435 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1436 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1437 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1438 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1439 | 125, 126, 127, 128, 129, 130, 131, 132 |
| 1440 | }; |
| 1441 | |
| 1442 | #if YYDEBUG |
| 1443 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1444 | YYRHS. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1445 | static const unsigned short yyprhs[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1446 | { |
| 1447 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1448 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1449 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1450 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1451 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1452 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1453 | 119, 122, 123, 125, 127, 129, 131, 133, 135, 137, |
| 1454 | 139, 140, 142, 143, 145, 147, 148, 150, 152, 154, |
| 1455 | 156, 157, 159, 161, 163, 165, 167, 169, 172, 174, |
| 1456 | 176, 177, 180, 182, 184, 185, 188, 189, 192, 193, |
| 1457 | 197, 200, 201, 203, 204, 208, 210, 213, 215, 217, |
| 1458 | 219, 221, 223, 225, 228, 230, 233, 239, 245, 251, |
| 1459 | 257, 261, 264, 270, 275, 278, 280, 282, 284, 288, |
| 1460 | 290, 294, 296, 297, 299, 303, 308, 312, 316, 321, |
| 1461 | 326, 330, 337, 343, 346, 349, 352, 355, 358, 361, |
| 1462 | 364, 367, 370, 373, 380, 386, 395, 402, 409, 417, |
| 1463 | 425, 432, 439, 448, 457, 461, 463, 465, 467, 469, |
| 1464 | 470, 472, 475, 476, 480, 481, 485, 489, 491, 495, |
| 1465 | 499, 500, 507, 508, 516, 517, 525, 528, 532, 534, |
| 1466 | 536, 538, 542, 546, 550, 554, 558, 562, 564, 565, |
| 1467 | 567, 569, 571, 572, 578, 582, 584, 588, 590, 591, |
| 1468 | 601, 603, 605, 610, 612, 614, 617, 621, 622, 624, |
| 1469 | 626, 628, 630, 632, 634, 636, 638, 640, 644, 646, |
| 1470 | 652, 654, 656, 658, 660, 663, 666, 669, 673, 676, |
| 1471 | 677, 679, 682, 685, 689, 699, 709, 718, 733, 735, |
| 1472 | 737, 744, 750, 753, 760, 768, 772, 778, 779, 780, |
| 1473 | 784, 787, 789, 795, 801, 808, 815, 820, 825, 832, |
| 1474 | 837, 842, 849, 856, 859, 868, 870, 872, 873, 877, |
| 1475 | 884, 888, 895, 898, 903, 910 |
| 1476 | }; |
| 1477 | |
| 1478 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1479 | static const short yyrhs[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1480 | { |
| 1481 | 185, 0, -1, 5, -1, 6, -1, 69, -1, 70, |
| 1482 | -1, 71, -1, 72, -1, 73, -1, 74, -1, 75, |
| 1483 | -1, 76, -1, 77, -1, 78, -1, 79, -1, 80, |
| 1484 | -1, 109, -1, 110, -1, 111, -1, 112, -1, 113, |
| 1485 | -1, 114, -1, 115, -1, 116, -1, 117, -1, 118, |
| 1486 | -1, 119, -1, 120, -1, 123, -1, 124, -1, 125, |
| 1487 | -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, |
| 1488 | -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, |
| 1489 | -1, 93, -1, 94, -1, 95, -1, 96, -1, 97, |
| 1490 | -1, 98, -1, 99, -1, 100, -1, 101, -1, 102, |
| 1491 | -1, 89, -1, 90, -1, 91, -1, 92, -1, 19, |
| 1492 | -1, 20, -1, 9, -1, 10, -1, 11, -1, 198, |
| 1493 | 133, -1, -1, 33, -1, 35, -1, 34, -1, 36, |
| 1494 | -1, 38, -1, 37, -1, 39, -1, 41, -1, -1, |
| 1495 | 132, -1, -1, 37, -1, 39, -1, -1, 33, -1, |
| 1496 | 34, -1, 35, -1, 38, -1, -1, 56, -1, 57, |
| 1497 | -1, 58, -1, 59, -1, 60, -1, 61, -1, 55, |
| 1498 | 4, -1, 110, -1, 111, -1, -1, 165, 164, -1, |
| 1499 | 130, -1, 164, -1, -1, 167, 166, -1, -1, 48, |
| 1500 | 4, -1, -1, 134, 48, 4, -1, 27, 16, -1, |
| 1501 | -1, 170, -1, -1, 134, 173, 172, -1, 170, -1, |
| 1502 | 48, 4, -1, 9, -1, 10, -1, 11, -1, 12, |
| 1503 | -1, 40, -1, 174, -1, 175, 135, -1, 210, -1, |
| 1504 | 136, 4, -1, 175, 137, 179, 138, 167, -1, 8, |
| 1505 | 137, 179, 138, 167, -1, 139, 4, 140, 175, 141, |
| 1506 | -1, 142, 4, 140, 175, 143, -1, 144, 180, 145, |
| 1507 | -1, 144, 145, -1, 142, 144, 180, 145, 143, -1, |
| 1508 | 142, 144, 145, 143, -1, 175, 165, -1, 175, -1, |
| 1509 | 8, -1, 176, -1, 178, 134, 176, -1, 178, -1, |
| 1510 | 178, 134, 30, -1, 30, -1, -1, 175, -1, 180, |
| 1511 | 134, 175, -1, 175, 139, 183, 141, -1, 175, 139, |
| 1512 | 141, -1, 175, 146, 16, -1, 175, 142, 183, 143, |
| 1513 | -1, 175, 144, 183, 145, -1, 175, 144, 145, -1, |
| 1514 | 175, 142, 144, 183, 145, 143, -1, 175, 142, 144, |
| 1515 | 145, 143, -1, 175, 31, -1, 175, 32, -1, 175, |
| 1516 | 210, -1, 175, 182, -1, 175, 18, -1, 155, 3, |
| 1517 | -1, 155, 4, -1, 9, 19, -1, 9, 20, -1, |
| 1518 | 156, 7, -1, 151, 137, 181, 29, 175, 138, -1, |
| 1519 | 108, 137, 181, 221, 138, -1, 122, 137, 181, 134, |
| 1520 | 181, 134, 181, 138, -1, 149, 137, 181, 134, 181, |
| 1521 | 138, -1, 150, 137, 181, 134, 181, 138, -1, 81, |
| 1522 | 153, 137, 181, 134, 181, 138, -1, 82, 154, 137, |
| 1523 | 181, 134, 181, 138, -1, 152, 137, 181, 134, 181, |
| 1524 | 138, -1, 127, 137, 181, 134, 181, 138, -1, 128, |
| 1525 | 137, 181, 134, 181, 134, 181, 138, -1, 129, 137, |
| 1526 | 181, 134, 181, 134, 181, 138, -1, 183, 134, 181, |
| 1527 | -1, 181, -1, 25, -1, 26, -1, 186, -1, -1, |
| 1528 | 187, -1, 186, 187, -1, -1, 24, 188, 206, -1, |
| 1529 | -1, 23, 189, 207, -1, 53, 52, 193, -1, 17, |
| 1530 | -1, 157, 13, 175, -1, 157, 13, 8, -1, -1, |
| 1531 | 157, 160, 184, 181, 190, 172, -1, -1, 157, 158, |
| 1532 | 160, 184, 181, 191, 172, -1, -1, 157, 159, 160, |
| 1533 | 184, 175, 192, 172, -1, 42, 195, -1, 49, 133, |
| 1534 | 196, -1, 16, -1, 47, -1, 46, -1, 44, 133, |
| 1535 | 194, -1, 45, 133, 4, -1, 43, 133, 16, -1, |
| 1536 | 62, 133, 16, -1, 139, 197, 141, -1, 197, 134, |
| 1537 | 16, -1, 16, -1, -1, 14, -1, 16, -1, 198, |
| 1538 | -1, -1, 200, 134, 175, 165, 199, -1, 175, 165, |
| 1539 | 199, -1, 200, -1, 200, 134, 30, -1, 30, -1, |
| 1540 | -1, 163, 177, 198, 137, 201, 138, 167, 171, 168, |
| 1541 | -1, 21, -1, 144, -1, 162, 160, 202, 203, -1, |
| 1542 | 22, -1, 145, -1, 213, 205, -1, 161, 160, 202, |
| 1543 | -1, -1, 54, -1, 3, -1, 4, -1, 7, -1, |
| 1544 | 19, -1, 20, -1, 31, -1, 32, -1, 18, -1, |
| 1545 | 142, 183, 143, -1, 182, -1, 52, 208, 16, 134, |
| 1546 | 16, -1, 148, -1, 198, -1, 210, -1, 209, -1, |
| 1547 | 175, 211, -1, 213, 214, -1, 204, 214, -1, 215, |
| 1548 | 157, 216, -1, 215, 218, -1, -1, 15, -1, 63, |
| 1549 | 212, -1, 63, 8, -1, 64, 12, 211, -1, 64, |
| 1550 | 9, 211, 134, 12, 211, 134, 12, 211, -1, 65, |
| 1551 | 155, 211, 134, 12, 211, 139, 217, 141, -1, 65, |
| 1552 | 155, 211, 134, 12, 211, 139, 141, -1, 66, 163, |
| 1553 | 177, 211, 137, 220, 138, 167, 29, 12, 211, 67, |
| 1554 | 12, 211, -1, 67, -1, 68, -1, 217, 155, 209, |
| 1555 | 134, 12, 211, -1, 155, 209, 134, 12, 211, -1, |
| 1556 | 157, 223, -1, 175, 139, 211, 134, 211, 141, -1, |
| 1557 | 219, 134, 139, 211, 134, 211, 141, -1, 175, 211, |
| 1558 | 165, -1, 220, 134, 175, 211, 165, -1, -1, -1, |
| 1559 | 221, 134, 212, -1, 51, 50, -1, 50, -1, 149, |
| 1560 | 175, 211, 134, 211, -1, 150, 175, 211, 134, 211, |
| 1561 | -1, 81, 153, 175, 211, 134, 211, -1, 82, 154, |
| 1562 | 175, 211, 134, 211, -1, 152, 212, 134, 212, -1, |
| 1563 | 151, 212, 29, 175, -1, 122, 212, 134, 212, 134, |
| 1564 | 212, -1, 126, 212, 134, 175, -1, 127, 212, 134, |
| 1565 | 212, -1, 128, 212, 134, 212, 134, 212, -1, 129, |
| 1566 | 212, 134, 212, 134, 212, -1, 121, 219, -1, 222, |
| 1567 | 163, 177, 211, 137, 220, 138, 167, -1, 225, -1, |
| 1568 | 28, -1, -1, 103, 175, 169, -1, 103, 175, 134, |
| 1569 | 9, 211, 169, -1, 104, 175, 169, -1, 104, 175, |
| 1570 | 134, 9, 211, 169, -1, 105, 212, -1, 224, 106, |
| 1571 | 175, 211, -1, 224, 107, 212, 134, 175, 211, -1, |
| 1572 | 108, 175, 211, 221, -1 |
| 1573 | }; |
| 1574 | |
| 1575 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1576 | static const unsigned short yyrline[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1577 | { |
| 1578 | 0, 1031, 1031, 1032, 1042, 1042, 1042, 1042, 1042, 1042, |
| 1579 | 1042, 1042, 1042, 1043, 1043, 1043, 1044, 1044, 1044, 1044, |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1580 | 1044, 1044, 1044, 1045, 1045, 1045, 1045, 1045, 1046, 1046, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1581 | 1046, 1048, 1048, 1049, 1049, 1050, 1050, 1051, 1051, 1052, |
| 1582 | 1052, 1056, 1056, 1057, 1057, 1058, 1058, 1059, 1059, 1060, |
| 1583 | 1060, 1061, 1061, 1062, 1062, 1063, 1064, 1069, 1070, 1070, |
| 1584 | 1073, 1077, 1083, 1084, 1085, 1086, 1087, 1091, 1092, 1093, |
| 1585 | 1097, 1098, 1102, 1103, 1104, 1108, 1109, 1110, 1111, 1112, |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1586 | 1115, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1129, 1130, |
| 1587 | 1133, 1134, 1139, 1140, 1143, 1144, 1151, 1151, 1158, 1158, |
| 1588 | 1167, 1175, 1175, 1181, 1181, 1183, 1188, 1201, 1201, 1201, |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1589 | 1201, 1204, 1208, 1212, 1219, 1224, 1232, 1250, 1268, 1273, |
| 1590 | 1285, 1295, 1299, 1309, 1316, 1323, 1330, 1335, 1340, 1347, |
| 1591 | 1348, 1355, 1362, 1370, 1375, 1386, 1414, 1430, 1459, 1487, |
| 1592 | 1512, 1531, 1556, 1575, 1587, 1594, 1657, 1667, 1677, 1683, |
| 1593 | 1689, 1694, 1699, 1707, 1719, 1740, 1748, 1754, 1765, 1770, |
| 1594 | 1775, 1784, 1790, 1796, 1805, 1809, 1817, 1817, 1828, 1833, |
| 1595 | 1841, 1842, 1846, 1846, 1850, 1850, 1853, 1856, 1868, 1892, |
| 1596 | 1903, 1903, 1912, 1912, 1920, 1920, 1930, 1933, 1939, 1952, |
| 1597 | 1953, 1955, 1959, 1968, 1972, 1977, 1979, 1984, 1989, 1998, |
| 1598 | 1998, 1999, 1999, 2001, 2011, 2022, 2026, 2035, 2044, 2049, |
| 1599 | 2155, 2155, 2157, 2166, 2166, 2168, 2173, 2185, 2189, 2194, |
| 1600 | 2198, 2202, 2206, 2210, 2214, 2218, 2222, 2226, 2251, 2255, |
| 1601 | 2269, 2273, 2279, 2279, 2285, 2294, 2298, 2307, 2318, 2327, |
| 1602 | 2339, 2352, 2356, 2360, 2365, 2375, 2394, 2403, 2470, 2474, |
| 1603 | 2481, 2492, 2505, 2514, 2525, 2535, 2543, 2551, 2554, 2555, |
| 1604 | 2562, 2566, 2571, 2592, 2609, 2622, 2635, 2644, 2656, 2664, |
| 1605 | 2671, 2677, 2683, 2689, 2704, 2767, 2772, 2776, 2783, 2790, |
| 1606 | 2798, 2805, 2813, 2821, 2835, 2852 |
| 1607 | }; |
| 1608 | #endif |
| 1609 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1610 | #if YYDEBUG || YYERROR_VERBOSE |
| 1611 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1612 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1613 | static const char *const yytname[] = |
| 1614 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1615 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", |
| 1616 | "UINTVAL", "FPVAL", "VOID", "INTTYPE", "FLOAT", "DOUBLE", "LABEL", |
| 1617 | "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", |
| 1618 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1619 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1620 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
| 1621 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1622 | "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", |
| 1623 | "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", |
| 1624 | "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", |
| 1625 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1626 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", |
| 1627 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", |
| 1628 | "XOR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", |
| 1629 | "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", |
| 1630 | "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", |
| 1631 | "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", |
| 1632 | "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", |
| 1633 | "PHI_TOK", "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT", |
| 1634 | "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "DEFAULT", "HIDDEN", |
| 1635 | "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", |
| 1636 | "'>'", "'{'", "'}'", "'c'", "$accept", "INTVAL", "ArithmeticOps", |
| 1637 | "LogicalOps", "CastOps", "ShiftOps", "IPredicates", "FPredicates", |
| 1638 | "IntType", "FPType", "OptAssign", "GVInternalLinkage", |
| 1639 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1640 | "FunctionDefineLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs", |
| 1641 | "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", |
| 1642 | "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", |
| 1643 | "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", |
| 1644 | "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType", |
| 1645 | "Module", "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", |
| 1646 | "AsmBlock", "BigOrLittle", "TargetDefinition", "LibrariesDefinition", |
| 1647 | "LibList", "Name", "OptName", "ArgListH", "ArgList", "FunctionHeaderH", |
| 1648 | "BEGIN", "FunctionHeader", "END", "Function", "FunctionProto", |
| 1649 | "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", |
| 1650 | "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", |
| 1651 | "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", |
| 1652 | "IndexList", "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1653 | }; |
| 1654 | #endif |
| 1655 | |
| 1656 | # ifdef YYPRINT |
| 1657 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1658 | token YYLEX-NUM. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1659 | static const unsigned short yytoknum[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1660 | { |
| 1661 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1662 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1663 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1664 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1665 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1666 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1667 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1668 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1669 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1670 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1671 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1672 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1673 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1674 | 385, 386, 387, 61, 44, 42, 92, 40, 41, 91, |
| 1675 | 120, 93, 60, 62, 123, 125, 99 |
| 1676 | }; |
| 1677 | # endif |
| 1678 | |
| 1679 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1680 | static const unsigned char yyr1[] = |
| 1681 | { |
| 1682 | 0, 147, 148, 148, 149, 149, 149, 149, 149, 149, |
| 1683 | 149, 149, 149, 150, 150, 150, 151, 151, 151, 151, |
| 1684 | 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, |
| 1685 | 152, 153, 153, 153, 153, 153, 153, 153, 153, 153, |
| 1686 | 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, |
| 1687 | 154, 154, 154, 154, 154, 154, 154, 155, 156, 156, |
| 1688 | 157, 157, 158, 158, 158, 158, 158, 159, 159, 159, |
| 1689 | 160, 160, 161, 161, 161, 162, 162, 162, 162, 162, |
| 1690 | 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, |
| 1691 | 165, 165, 166, 166, 167, 167, 168, 168, 169, 169, |
| 1692 | 170, 171, 171, 172, 172, 173, 173, 174, 174, 174, |
| 1693 | 174, 175, 175, 175, 175, 175, 175, 175, 175, 175, |
| 1694 | 175, 175, 175, 175, 176, 177, 177, 178, 178, 179, |
| 1695 | 179, 179, 179, 180, 180, 181, 181, 181, 181, 181, |
| 1696 | 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, |
| 1697 | 181, 181, 181, 182, 182, 182, 182, 182, 182, 182, |
| 1698 | 182, 182, 182, 182, 183, 183, 184, 184, 185, 185, |
| 1699 | 186, 186, 188, 187, 189, 187, 187, 187, 187, 187, |
| 1700 | 190, 187, 191, 187, 192, 187, 187, 187, 193, 194, |
| 1701 | 194, 195, 195, 195, 195, 196, 197, 197, 197, 198, |
| 1702 | 198, 199, 199, 200, 200, 201, 201, 201, 201, 202, |
| 1703 | 203, 203, 204, 205, 205, 206, 207, 208, 208, 209, |
| 1704 | 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, |
| 1705 | 210, 210, 211, 211, 212, 213, 213, 214, 215, 215, |
| 1706 | 215, 216, 216, 216, 216, 216, 216, 216, 216, 216, |
| 1707 | 217, 217, 218, 219, 219, 220, 220, 220, 221, 221, |
| 1708 | 222, 222, 223, 223, 223, 223, 223, 223, 223, 223, |
| 1709 | 223, 223, 223, 223, 223, 223, 224, 224, 225, 225, |
| 1710 | 225, 225, 225, 225, 225, 225 |
| 1711 | }; |
| 1712 | |
| 1713 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1714 | static const unsigned char yyr2[] = |
| 1715 | { |
| 1716 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1717 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1718 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1719 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1720 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1721 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1722 | 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1723 | 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, |
| 1724 | 0, 1, 1, 1, 1, 1, 1, 2, 1, 1, |
| 1725 | 0, 2, 1, 1, 0, 2, 0, 2, 0, 3, |
| 1726 | 2, 0, 1, 0, 3, 1, 2, 1, 1, 1, |
| 1727 | 1, 1, 1, 2, 1, 2, 5, 5, 5, 5, |
| 1728 | 3, 2, 5, 4, 2, 1, 1, 1, 3, 1, |
| 1729 | 3, 1, 0, 1, 3, 4, 3, 3, 4, 4, |
| 1730 | 3, 6, 5, 2, 2, 2, 2, 2, 2, 2, |
| 1731 | 2, 2, 2, 6, 5, 8, 6, 6, 7, 7, |
| 1732 | 6, 6, 8, 8, 3, 1, 1, 1, 1, 0, |
| 1733 | 1, 2, 0, 3, 0, 3, 3, 1, 3, 3, |
| 1734 | 0, 6, 0, 7, 0, 7, 2, 3, 1, 1, |
| 1735 | 1, 3, 3, 3, 3, 3, 3, 1, 0, 1, |
| 1736 | 1, 1, 0, 5, 3, 1, 3, 1, 0, 9, |
| 1737 | 1, 1, 4, 1, 1, 2, 3, 0, 1, 1, |
| 1738 | 1, 1, 1, 1, 1, 1, 1, 3, 1, 5, |
| 1739 | 1, 1, 1, 1, 2, 2, 2, 3, 2, 0, |
| 1740 | 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, |
| 1741 | 6, 5, 2, 6, 7, 3, 5, 0, 0, 3, |
| 1742 | 2, 1, 5, 5, 6, 6, 4, 4, 6, 4, |
| 1743 | 4, 6, 6, 2, 8, 1, 1, 0, 3, 6, |
| 1744 | 3, 6, 2, 4, 6, 4 |
| 1745 | }; |
| 1746 | |
| 1747 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1748 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1749 | means the default is an error. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1750 | static const unsigned short yydefact[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1751 | { |
| 1752 | 61, 199, 200, 177, 174, 172, 0, 0, 0, 70, |
| 1753 | 0, 61, 170, 0, 72, 75, 0, 0, 0, 0, |
| 1754 | 186, 0, 0, 0, 62, 64, 63, 65, 67, 66, |
| 1755 | 68, 69, 71, 70, 70, 0, 1, 171, 60, 73, |
| 1756 | 74, 70, 175, 76, 77, 78, 79, 70, 239, 173, |
| 1757 | 239, 0, 0, 0, 0, 198, 187, 188, 176, 2, |
| 1758 | 3, 179, 107, 108, 109, 110, 111, 0, 0, 0, |
| 1759 | 0, 230, 112, 178, 231, 114, 0, 0, 166, 167, |
| 1760 | 0, 80, 80, 240, 236, 61, 213, 214, 215, 235, |
| 1761 | 193, 190, 189, 191, 192, 194, 197, 0, 132, 115, |
| 1762 | 0, 0, 0, 0, 121, 133, 0, 113, 132, 0, |
| 1763 | 0, 107, 108, 109, 0, 0, 0, 180, 0, 81, |
| 1764 | 82, 83, 84, 85, 86, 0, 216, 0, 277, 238, |
| 1765 | 0, 195, 131, 90, 127, 129, 0, 0, 0, 0, |
| 1766 | 0, 0, 120, 0, 182, 184, 150, 151, 148, 149, |
| 1767 | 152, 147, 143, 144, 4, 5, 6, 7, 8, 9, |
| 1768 | 10, 11, 12, 13, 14, 15, 0, 0, 0, 16, |
| 1769 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 1770 | 27, 0, 28, 29, 30, 0, 0, 0, 0, 0, |
| 1771 | 0, 0, 0, 0, 0, 0, 146, 145, 103, 87, |
| 1772 | 126, 125, 0, 210, 211, 212, 276, 261, 0, 0, |
| 1773 | 0, 0, 80, 248, 249, 0, 0, 0, 0, 0, |
| 1774 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1775 | 0, 237, 80, 252, 0, 275, 196, 124, 0, 94, |
| 1776 | 0, 0, 123, 0, 134, 94, 103, 103, 31, 32, |
| 1777 | 33, 34, 35, 36, 37, 38, 39, 40, 0, 55, |
| 1778 | 56, 51, 52, 53, 54, 41, 42, 43, 44, 45, |
| 1779 | 46, 47, 48, 49, 50, 0, 0, 0, 0, 0, |
| 1780 | 0, 136, 165, 0, 0, 0, 140, 0, 137, 0, |
| 1781 | 0, 0, 0, 0, 181, 0, 260, 242, 0, 241, |
| 1782 | 0, 0, 57, 0, 0, 0, 0, 98, 98, 282, |
| 1783 | 0, 0, 273, 0, 0, 0, 0, 0, 0, 0, |
| 1784 | 0, 0, 0, 0, 0, 88, 89, 91, 130, 128, |
| 1785 | 117, 118, 119, 122, 116, 183, 185, 0, 0, 258, |
| 1786 | 0, 0, 0, 0, 0, 135, 121, 133, 0, 138, |
| 1787 | 139, 0, 0, 0, 0, 0, 0, 105, 103, 208, |
| 1788 | 219, 220, 221, 226, 222, 223, 224, 225, 217, 0, |
| 1789 | 228, 233, 232, 234, 0, 243, 0, 0, 0, 0, |
| 1790 | 0, 278, 0, 280, 258, 0, 0, 0, 0, 0, |
| 1791 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, |
| 1792 | 93, 95, 0, 0, 0, 0, 0, 0, 0, 164, |
| 1793 | 142, 0, 0, 0, 0, 0, 100, 106, 104, 207, |
| 1794 | 90, 205, 0, 218, 0, 0, 0, 0, 0, 0, |
| 1795 | 0, 0, 0, 0, 285, 0, 0, 0, 269, 270, |
| 1796 | 0, 0, 0, 0, 267, 266, 0, 283, 0, 0, |
| 1797 | 0, 0, 154, 0, 0, 0, 0, 141, 0, 0, |
| 1798 | 0, 0, 202, 0, 94, 0, 227, 0, 0, 257, |
| 1799 | 0, 0, 98, 99, 98, 0, 0, 0, 0, 0, |
| 1800 | 262, 263, 257, 0, 0, 0, 259, 0, 161, 0, |
| 1801 | 0, 156, 157, 153, 160, 201, 204, 206, 90, 101, |
| 1802 | 0, 0, 0, 0, 0, 264, 265, 0, 279, 281, |
| 1803 | 0, 0, 268, 271, 272, 0, 284, 158, 159, 0, |
| 1804 | 0, 0, 202, 102, 96, 229, 0, 0, 90, 0, |
| 1805 | 94, 253, 0, 94, 155, 162, 163, 203, 0, 209, |
| 1806 | 0, 246, 0, 0, 255, 0, 0, 254, 274, 97, |
| 1807 | 244, 0, 245, 0, 90, 0, 0, 0, 256, 0, |
| 1808 | 0, 0, 0, 251, 0, 0, 250, 0, 247 |
| 1809 | }; |
| 1810 | |
| 1811 | /* YYDEFGOTO[NTERM-NUM]. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1812 | static const short yydefgoto[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1813 | { |
| 1814 | -1, 71, 192, 193, 194, 195, 258, 275, 114, 115, |
| 1815 | 9, 33, 34, 35, 41, 47, 125, 327, 237, 401, |
| 1816 | 330, 539, 381, 357, 524, 294, 358, 72, 116, 134, |
| 1817 | 202, 135, 136, 106, 282, 370, 283, 80, 10, 11, |
| 1818 | 12, 15, 14, 198, 246, 247, 58, 93, 20, 56, |
| 1819 | 97, 74, 496, 421, 422, 126, 205, 48, 88, 49, |
| 1820 | 42, 424, 371, 75, 373, 299, 50, 84, 85, 231, |
| 1821 | 543, 129, 312, 504, 404, 232, 233, 234, 235 |
| 1822 | }; |
| 1823 | |
| 1824 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1825 | STATE-NUM. */ |
| 1826 | #define YYPACT_NINF -413 |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1827 | static const short yypact[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1828 | { |
| 1829 | 401, -413, -413, -413, -413, -413, 110, -107, 30, 67, |
| 1830 | 77, 527, -413, -43, 2, 238, -16, 8, 47, 84, |
| 1831 | -413, -4, 132, 791, -413, -413, -413, -413, -413, -413, |
| 1832 | -413, -413, -413, 91, 91, 149, -413, -413, -413, -413, |
| 1833 | -413, 91, -413, -413, -413, -413, -413, 91, 147, -413, |
| 1834 | 20, 210, 208, 280, 226, 273, -413, -413, -413, -413, |
| 1835 | -413, 160, -413, -413, -413, -413, -413, 295, 299, 3, |
| 1836 | 7, -413, -413, 140, -413, -413, 149, 149, -413, -413, |
| 1837 | 954, 192, 192, -413, -413, 184, -413, -413, -413, -413, |
| 1838 | -413, -413, -413, -413, -413, -413, -413, -65, 549, -413, |
| 1839 | 167, 171, 22, 160, -413, 140, -81, -413, 549, 954, |
| 1840 | 1045, 95, 311, 312, 284, 313, 602, -413, 317, -413, |
| 1841 | -413, -413, -413, -413, -413, 1125, -413, -7, 1228, -413, |
| 1842 | 306, -413, -413, 140, -413, 191, 193, 1045, 1045, 186, |
| 1843 | -64, 1045, -413, 194, -413, 140, -413, -413, -413, -413, |
| 1844 | -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, |
| 1845 | -413, -413, -413, -413, -413, -413, 251, 501, 207, -413, |
| 1846 | -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, |
| 1847 | -413, 209, -413, -413, -413, 214, 215, 216, 49, 1138, |
| 1848 | 120, 314, 219, 222, 224, 225, -413, -413, 230, -413, |
| 1849 | 160, 140, 184, -413, -413, -413, -413, -413, 315, 1185, |
| 1850 | 175, 357, 192, -413, -413, 251, 501, 1045, 1045, 1045, |
| 1851 | 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, |
| 1852 | 1045, -413, 192, -413, 195, -413, -413, 203, 693, -413, |
| 1853 | 126, 46, -413, 228, 140, -413, 230, 230, -413, -413, |
| 1854 | -413, -413, -413, -413, -413, -413, -413, -413, 231, -413, |
| 1855 | -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, |
| 1856 | -413, -413, -413, -413, -413, 235, 954, 954, 954, 954, |
| 1857 | 954, -413, -413, 29, 500, -24, -413, -27, -413, 954, |
| 1858 | 954, 954, 954, 39, -413, 241, -413, 160, 746, -413, |
| 1859 | 873, 873, -413, 873, 1125, 1045, 1045, 123, 159, -413, |
| 1860 | 746, 146, 233, 245, 248, 249, 250, 252, 746, 746, |
| 1861 | 356, 253, 1125, 1045, 1045, -413, -413, -413, -413, -413, |
| 1862 | -18, -413, -413, -413, -18, -413, -413, 954, 954, -413, |
| 1863 | 254, 255, 256, 259, 954, -413, 262, 602, -12, -413, |
| 1864 | -413, 265, 274, 367, 275, 391, 407, -413, 230, 774, |
| 1865 | -413, -413, -413, -413, -413, -413, -413, -413, 358, 954, |
| 1866 | -413, -413, -413, -413, 282, -413, 285, 873, 746, 746, |
| 1867 | 35, -413, 43, -413, -413, 873, 281, 1045, 1045, 1045, |
| 1868 | 1045, 1045, 289, 292, 1045, 1045, 873, 746, 293, -413, |
| 1869 | -413, -413, 294, 301, -25, 954, 954, 954, 954, -413, |
| 1870 | -413, 271, 954, 954, 1045, 954, -413, -413, -413, -413, |
| 1871 | 140, 302, 303, -413, 417, 25, 427, 428, 305, 310, |
| 1872 | 318, 873, 441, 873, 319, 322, 873, 323, 140, -413, |
| 1873 | 324, 325, 873, 873, 140, -413, 309, -413, 1045, 954, |
| 1874 | 954, 1045, -413, 326, 328, 327, 335, -413, 332, 333, |
| 1875 | 131, 336, 34, 1028, -413, 339, -413, 873, 873, 1045, |
| 1876 | 873, 873, 341, -413, 341, 873, 342, 1045, 1045, 1045, |
| 1877 | -413, -413, 1045, 746, 340, 345, -413, 954, -413, 954, |
| 1878 | 954, -413, -413, -413, -413, -413, -413, -413, 140, 10, |
| 1879 | 431, 343, 346, 746, 63, -413, -413, 400, -413, -413, |
| 1880 | 338, 873, -413, -413, -413, 144, -413, -413, -413, 351, |
| 1881 | 352, 354, 34, -413, 403, -413, 472, -3, -413, 1045, |
| 1882 | -413, -413, 355, -413, -413, -413, -413, -413, 489, -413, |
| 1883 | 873, -413, 1000, 15, 203, 746, 66, -413, -18, -413, |
| 1884 | -413, 361, -413, 1000, -413, 485, 486, 368, 203, 873, |
| 1885 | 873, 491, 434, -413, 873, 492, -413, 873, -413 |
| 1886 | }; |
| 1887 | |
| 1888 | /* YYPGOTO[NTERM-NUM]. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1889 | static const short yypgoto[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1890 | { |
| 1891 | -413, -413, 379, 385, 389, 390, 304, 307, -210, -413, |
| 1892 | 439, -413, -413, 145, -413, -413, -192, -305, -412, -413, |
| 1893 | -235, -413, -303, 26, -413, -201, -413, -413, -14, 288, |
| 1894 | -255, -413, 420, 429, -58, -112, -187, 239, -413, -413, |
| 1895 | 518, -413, -413, -413, -413, -413, -413, -413, -413, -413, |
| 1896 | -413, 0, 11, -413, -413, 448, -413, -413, -413, -413, |
| 1897 | -413, -413, -403, -73, 103, -151, -413, 482, -413, -413, |
| 1898 | -413, -413, -413, 53, 153, -413, -413, -413, -413 |
| 1899 | }; |
| 1900 | |
| 1901 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 1902 | positive, shift that token. If negative, reduce the rule which |
| 1903 | number is the opposite. If zero, do what YYDEFACT says. |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1904 | If YYTABLE_NINF, parse error. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1905 | #define YYTABLE_NINF -170 |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 1906 | static const short yytable[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1907 | { |
| 1908 | 13, 303, 285, 287, 196, 383, 302, 101, 462, 73, |
| 1909 | 334, 13, 59, 60, 203, 103, 62, 63, 64, 65, |
| 1910 | 304, 1, 117, 2, 302, 400, 21, 59, 60, 400, |
| 1911 | 103, 62, 63, 64, 65, 83, 1, 355, 2, 39, |
| 1912 | 322, 40, 86, 197, 431, 335, 336, 66, 1, 377, |
| 1913 | 2, 144, 433, 141, 59, 60, 105, 103, 111, 112, |
| 1914 | 113, 65, 66, 1, 142, 2, 355, 396, 309, 130, |
| 1915 | 141, 313, 314, 315, 316, 317, 131, 36, 320, 321, |
| 1916 | 23, 243, 22, 432, 133, 13, 522, 356, 105, 66, |
| 1917 | 38, 432, 325, 326, 133, 555, 145, 348, -57, -57, |
| 1918 | 24, 25, 26, 27, 28, 29, 30, 344, 31, 451, |
| 1919 | 344, 201, 399, 452, 146, 147, 544, 51, 350, 349, |
| 1920 | 325, 326, 344, 240, 241, 59, 60, 244, 103, 111, |
| 1921 | 112, 113, 65, 411, 1, 55, 2, 204, 541, 551, |
| 1922 | 399, 52, 558, 67, 325, 326, 68, 102, 57, 69, |
| 1923 | 557, 70, 104, 16, 17, 18, 552, 418, 67, 344, |
| 1924 | 66, 68, 83, 344, 69, 87, 70, 139, 466, 508, |
| 1925 | 345, 509, 19, 398, 78, 79, 325, 326, 76, 77, |
| 1926 | 53, 107, 425, 108, 300, 67, 81, 301, 68, 332, |
| 1927 | 281, 69, 82, 70, 400, 298, 399, 529, 1, 32, |
| 1928 | 2, 530, 295, 307, 308, 298, 310, 311, 298, 298, |
| 1929 | 298, 298, 298, 318, 319, 298, 298, 54, 339, 340, |
| 1930 | 341, 342, 343, 32, 133, 372, 90, 372, 372, 499, |
| 1931 | 372, 351, 352, 353, 354, 196, 437, 372, 439, 440, |
| 1932 | 441, 400, 95, 400, 445, 372, 372, 118, 119, 120, |
| 1933 | 121, 122, 123, 124, 91, 92, 67, 380, 107, 68, |
| 1934 | 108, 107, 69, 108, 70, 286, 107, 331, 108, 493, |
| 1935 | 347, 43, 44, 45, 197, 107, 46, 108, 529, 402, |
| 1936 | 403, 107, 533, 108, 94, 385, 409, 148, 149, 96, |
| 1937 | 201, 378, 379, 382, 107, 546, 108, 98, 548, 99, |
| 1938 | 486, 323, 324, 100, 372, 372, 372, 137, 201, 397, |
| 1939 | 298, 138, 372, 325, 326, 109, 110, 542, -58, -59, |
| 1940 | 150, 199, 236, 372, 372, 238, 512, 513, 514, 242, |
| 1941 | 288, 239, 245, 553, 248, 249, 250, 251, 252, 253, |
| 1942 | 254, 255, 256, 257, 276, 420, 277, 453, 454, 455, |
| 1943 | 456, 278, 279, 280, 458, 459, 289, 461, 372, 290, |
| 1944 | 372, 291, 292, 372, 293, 296, 302, 386, 337, 372, |
| 1945 | 372, 333, 338, 298, 438, 298, 298, 298, 359, 387, |
| 1946 | 444, 298, 388, 389, 390, 394, 391, 395, 405, 406, |
| 1947 | 407, 484, 485, 408, 372, 372, 414, 372, 372, 412, |
| 1948 | 460, -169, 372, 374, 375, 410, 376, 416, 413, 415, |
| 1949 | 372, 417, 423, 384, 457, 1, 426, 2, 3, 427, |
| 1950 | 436, 392, 393, 442, 4, 5, 443, 448, 449, 519, |
| 1951 | 372, 520, 521, 465, 483, 450, 463, 298, 372, 467, |
| 1952 | 468, 464, 469, 6, 470, 473, 482, 525, 432, 498, |
| 1953 | 7, 538, 471, 451, 8, 503, 475, 477, 478, 479, |
| 1954 | 487, 489, 495, 298, 298, 298, 488, 372, 503, 490, |
| 1955 | 491, 492, 372, 500, 494, 507, 511, 526, 517, 531, |
| 1956 | 428, 429, 430, 518, 540, 527, 372, 372, 435, 534, |
| 1957 | 535, 372, 536, 549, 372, 556, 547, 559, 560, 446, |
| 1958 | 447, 565, 561, 564, 567, 59, 60, 227, 103, 111, |
| 1959 | 112, 113, 65, 228, 1, 545, 2, 229, 230, 305, |
| 1960 | 259, 260, 495, 306, 128, 523, 329, -168, 143, 37, |
| 1961 | 127, 140, 89, 537, 472, 515, 474, 434, 0, 476, |
| 1962 | 66, 1, 0, 2, 3, 480, 481, 0, 0, 0, |
| 1963 | 4, 5, 0, 0, 59, 60, 0, 103, 62, 63, |
| 1964 | 64, 65, 0, 1, 0, 2, 0, 0, 0, 6, |
| 1965 | 501, 502, 0, 505, 506, 0, 7, 0, 510, 132, |
| 1966 | 8, 0, 0, 0, 0, 0, 516, 0, 0, 66, |
| 1967 | 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, |
| 1968 | 271, 272, 273, 274, 0, 0, 528, 59, 60, 0, |
| 1969 | 0, 0, 0, 0, 532, 0, 1, 0, 2, 0, |
| 1970 | 151, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1971 | 0, 0, 0, 152, 153, 0, 67, 0, 0, 68, |
| 1972 | 0, 0, 69, 550, 70, 346, 0, 0, 554, 0, |
| 1973 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1974 | 0, 0, 562, 563, 0, 0, 0, 566, 0, 0, |
| 1975 | 568, 154, 155, 156, 157, 158, 159, 160, 161, 162, |
| 1976 | 163, 164, 165, 166, 167, 67, 0, 0, 68, 0, |
| 1977 | 0, 69, 0, 70, 0, 0, 0, 0, 59, 60, |
| 1978 | 0, 103, 62, 63, 64, 65, 0, 1, 0, 2, |
| 1979 | 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, |
| 1980 | 178, 179, 180, 328, 181, 182, 183, 184, 0, 185, |
| 1981 | 186, 187, 0, 66, 0, 0, 0, 107, 0, 108, |
| 1982 | 0, 188, 0, 0, 189, 0, 190, 0, 191, 360, |
| 1983 | 361, 59, 60, 362, 0, 0, 0, 0, 0, 0, |
| 1984 | 1, 0, 2, 0, 363, 364, 365, 0, 0, 0, |
| 1985 | 0, 0, 0, 0, 0, 0, 0, 366, 367, 59, |
| 1986 | 60, 0, 103, 62, 63, 64, 65, 0, 1, 0, |
| 1987 | 2, 0, 0, 0, 0, 0, 59, 60, 368, 61, |
| 1988 | 62, 63, 64, 65, 419, 1, 0, 2, 0, 0, |
| 1989 | 0, 0, 0, 0, 66, 154, 155, 156, 157, 158, |
| 1990 | 159, 160, 161, 162, 163, 164, 165, 166, 167, 67, |
| 1991 | 0, 66, 68, 0, 0, 69, 0, 70, 0, 0, |
| 1992 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1993 | 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, |
| 1994 | 174, 175, 176, 177, 178, 179, 180, 0, 181, 182, |
| 1995 | 183, 184, 0, 185, 186, 187, 360, 361, 59, 60, |
| 1996 | 362, 107, 0, 108, 0, 0, 0, 1, 369, 2, |
| 1997 | 0, 363, 364, 365, 0, 0, 0, 0, 0, 0, |
| 1998 | 0, 0, 0, 0, 366, 367, 0, 0, 0, 0, |
| 1999 | 67, 0, 0, 68, 0, 0, 69, 0, 70, 0, |
| 2000 | 0, 0, 0, 0, 0, 368, 0, 67, 0, 0, |
| 2001 | 68, 0, 0, 69, 0, 70, 0, 0, 0, 0, |
| 2002 | 0, 0, 154, 155, 156, 157, 158, 159, 160, 161, |
| 2003 | 162, 163, 164, 165, 166, 167, 0, 0, 0, 59, |
| 2004 | 60, 0, 103, 111, 112, 113, 65, 0, 1, 0, |
| 2005 | 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2006 | 0, 168, 169, 170, 171, 172, 173, 174, 175, 176, |
| 2007 | 177, 178, 179, 180, 66, 181, 182, 183, 184, 0, |
| 2008 | 185, 186, 187, 360, 361, 0, 0, 362, 0, 0, |
| 2009 | 0, 0, 0, 0, 0, 369, 0, 0, 363, 364, |
| 2010 | 365, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2011 | 0, 366, 367, 59, 60, 0, 103, 62, 63, 64, |
| 2012 | 65, 0, 1, 0, 2, 0, 0, 0, 0, 0, |
| 2013 | 59, 60, 368, 103, 62, 63, 64, 65, 497, 1, |
| 2014 | 0, 2, 0, 0, 0, 0, 0, 0, 66, 154, |
| 2015 | 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, |
| 2016 | 165, 166, 167, 0, 0, 66, 0, 0, 0, 0, |
| 2017 | 67, 0, 0, 68, 0, 0, 69, 0, 70, 0, |
| 2018 | 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, |
| 2019 | 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, |
| 2020 | 180, 0, 181, 182, 183, 184, 0, 185, 186, 187, |
| 2021 | 59, 60, 0, 200, 62, 63, 64, 65, 0, 1, |
| 2022 | 0, 2, 369, 59, 60, 0, 103, 111, 112, 113, |
| 2023 | 65, 0, 1, 0, 2, 0, 0, 0, 0, 0, |
| 2024 | 0, 0, 0, 0, 67, 66, 0, 68, 0, 0, |
| 2025 | 69, 0, 70, 0, 0, 0, 0, 0, 66, 0, |
| 2026 | 0, 67, 0, 0, 68, 0, 0, 69, 0, 70, |
| 2027 | 59, 60, 0, 297, 62, 63, 64, 65, 0, 1, |
| 2028 | 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2029 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2030 | 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, |
| 2031 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2032 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2033 | 0, 0, 0, 0, 0, 0, 206, 0, 0, 0, |
| 2034 | 0, 67, 0, 0, 68, 0, 0, 69, 0, 70, |
| 2035 | 0, 0, 0, 0, 67, 0, 0, 68, 207, 208, |
| 2036 | 69, 0, 284, 0, 0, 0, 0, 0, 0, 0, |
| 2037 | 0, 209, 210, 211, 212, 213, 214, 154, 155, 156, |
| 2038 | 157, 158, 159, 160, 161, 162, 163, 164, 165, 215, |
| 2039 | 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2040 | 0, 67, 0, 0, 68, 0, 0, 69, 0, 70, |
| 2041 | 0, 217, 218, 219, 0, 0, 220, 169, 170, 171, |
| 2042 | 172, 173, 174, 175, 176, 177, 178, 179, 180, 221, |
| 2043 | 222, 182, 183, 184, 223, 224, 225, 226 |
| 2044 | }; |
| 2045 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2046 | static const short yycheck[] = |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2047 | { |
| 2048 | 0, 211, 189, 190, 116, 308, 9, 4, 420, 23, |
| 2049 | 245, 11, 5, 6, 21, 8, 9, 10, 11, 12, |
| 2050 | 212, 14, 80, 16, 9, 330, 133, 5, 6, 334, |
| 2051 | 8, 9, 10, 11, 12, 15, 14, 27, 16, 37, |
| 2052 | 232, 39, 22, 116, 9, 246, 247, 40, 14, 304, |
| 2053 | 16, 109, 9, 134, 5, 6, 70, 8, 9, 10, |
| 2054 | 11, 12, 40, 14, 145, 16, 27, 322, 219, 134, |
| 2055 | 134, 222, 223, 224, 225, 226, 141, 0, 229, 230, |
| 2056 | 13, 145, 52, 48, 98, 85, 498, 48, 102, 40, |
| 2057 | 133, 48, 110, 111, 108, 29, 110, 284, 3, 4, |
| 2058 | 33, 34, 35, 36, 37, 38, 39, 134, 41, 134, |
| 2059 | 134, 125, 130, 138, 19, 20, 528, 133, 145, 143, |
| 2060 | 110, 111, 134, 137, 138, 5, 6, 141, 8, 9, |
| 2061 | 10, 11, 12, 145, 14, 139, 16, 144, 141, 542, |
| 2062 | 130, 133, 554, 136, 110, 111, 139, 144, 16, 142, |
| 2063 | 553, 144, 145, 43, 44, 45, 141, 358, 136, 134, |
| 2064 | 40, 139, 15, 134, 142, 145, 144, 145, 143, 472, |
| 2065 | 141, 474, 62, 324, 25, 26, 110, 111, 33, 34, |
| 2066 | 133, 135, 369, 137, 9, 136, 41, 12, 139, 143, |
| 2067 | 141, 142, 47, 144, 499, 209, 130, 134, 14, 132, |
| 2068 | 16, 138, 202, 217, 218, 219, 220, 221, 222, 223, |
| 2069 | 224, 225, 226, 227, 228, 229, 230, 133, 276, 277, |
| 2070 | 278, 279, 280, 132, 238, 298, 16, 300, 301, 464, |
| 2071 | 303, 289, 290, 291, 292, 347, 387, 310, 389, 390, |
| 2072 | 391, 546, 16, 548, 395, 318, 319, 55, 56, 57, |
| 2073 | 58, 59, 60, 61, 46, 47, 136, 134, 135, 139, |
| 2074 | 137, 135, 142, 137, 144, 145, 135, 141, 137, 138, |
| 2075 | 284, 33, 34, 35, 347, 135, 38, 137, 134, 337, |
| 2076 | 338, 135, 138, 137, 4, 139, 344, 3, 4, 16, |
| 2077 | 304, 305, 306, 134, 135, 530, 137, 137, 533, 4, |
| 2078 | 451, 106, 107, 4, 377, 378, 379, 140, 322, 323, |
| 2079 | 324, 140, 385, 110, 111, 76, 77, 527, 7, 7, |
| 2080 | 7, 4, 16, 396, 397, 134, 477, 478, 479, 143, |
| 2081 | 16, 138, 138, 543, 83, 84, 85, 86, 87, 88, |
| 2082 | 89, 90, 91, 92, 137, 359, 137, 405, 406, 407, |
| 2083 | 408, 137, 137, 137, 412, 413, 137, 415, 431, 137, |
| 2084 | 433, 137, 137, 436, 134, 50, 9, 134, 137, 442, |
| 2085 | 443, 143, 137, 387, 388, 389, 390, 391, 137, 134, |
| 2086 | 394, 395, 134, 134, 134, 29, 134, 134, 134, 134, |
| 2087 | 134, 449, 450, 134, 467, 468, 29, 470, 471, 134, |
| 2088 | 414, 0, 475, 300, 301, 143, 303, 16, 134, 134, |
| 2089 | 483, 4, 54, 310, 143, 14, 134, 16, 17, 134, |
| 2090 | 139, 318, 319, 134, 23, 24, 134, 134, 134, 487, |
| 2091 | 503, 489, 490, 16, 448, 134, 134, 451, 511, 12, |
| 2092 | 12, 138, 137, 42, 134, 4, 137, 16, 48, 463, |
| 2093 | 49, 48, 134, 134, 53, 469, 134, 134, 134, 134, |
| 2094 | 134, 134, 462, 477, 478, 479, 138, 540, 482, 134, |
| 2095 | 138, 138, 545, 134, 138, 134, 134, 134, 138, 141, |
| 2096 | 377, 378, 379, 138, 12, 139, 559, 560, 385, 138, |
| 2097 | 138, 564, 138, 4, 567, 134, 141, 12, 12, 396, |
| 2098 | 397, 67, 134, 12, 12, 5, 6, 128, 8, 9, |
| 2099 | 10, 11, 12, 128, 14, 529, 16, 128, 128, 215, |
| 2100 | 19, 20, 522, 216, 85, 499, 238, 0, 108, 11, |
| 2101 | 82, 102, 50, 522, 431, 482, 433, 384, -1, 436, |
| 2102 | 40, 14, -1, 16, 17, 442, 443, -1, -1, -1, |
| 2103 | 23, 24, -1, -1, 5, 6, -1, 8, 9, 10, |
| 2104 | 11, 12, -1, 14, -1, 16, -1, -1, -1, 42, |
| 2105 | 467, 468, -1, 470, 471, -1, 49, -1, 475, 30, |
| 2106 | 53, -1, -1, -1, -1, -1, 483, -1, -1, 40, |
| 2107 | 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, |
| 2108 | 99, 100, 101, 102, -1, -1, 503, 5, 6, -1, |
| 2109 | -1, -1, -1, -1, 511, -1, 14, -1, 16, -1, |
| 2110 | 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2111 | -1, -1, -1, 31, 32, -1, 136, -1, -1, 139, |
| 2112 | -1, -1, 142, 540, 144, 145, -1, -1, 545, -1, |
| 2113 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2114 | -1, -1, 559, 560, -1, -1, -1, 564, -1, -1, |
| 2115 | 567, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2116 | 78, 79, 80, 81, 82, 136, -1, -1, 139, -1, |
| 2117 | -1, 142, -1, 144, -1, -1, -1, -1, 5, 6, |
| 2118 | -1, 8, 9, 10, 11, 12, -1, 14, -1, 16, |
| 2119 | 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, |
| 2120 | 118, 119, 120, 30, 122, 123, 124, 125, -1, 127, |
| 2121 | 128, 129, -1, 40, -1, -1, -1, 135, -1, 137, |
| 2122 | -1, 139, -1, -1, 142, -1, 144, -1, 146, 3, |
| 2123 | 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, |
| 2124 | 14, -1, 16, -1, 18, 19, 20, -1, -1, -1, |
| 2125 | -1, -1, -1, -1, -1, -1, -1, 31, 32, 5, |
| 2126 | 6, -1, 8, 9, 10, 11, 12, -1, 14, -1, |
| 2127 | 16, -1, -1, -1, -1, -1, 5, 6, 52, 8, |
| 2128 | 9, 10, 11, 12, 30, 14, -1, 16, -1, -1, |
| 2129 | -1, -1, -1, -1, 40, 69, 70, 71, 72, 73, |
| 2130 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 136, |
| 2131 | -1, 40, 139, -1, -1, 142, -1, 144, -1, -1, |
| 2132 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2133 | -1, -1, -1, -1, 108, 109, 110, 111, 112, 113, |
| 2134 | 114, 115, 116, 117, 118, 119, 120, -1, 122, 123, |
| 2135 | 124, 125, -1, 127, 128, 129, 3, 4, 5, 6, |
| 2136 | 7, 135, -1, 137, -1, -1, -1, 14, 142, 16, |
| 2137 | -1, 18, 19, 20, -1, -1, -1, -1, -1, -1, |
| 2138 | -1, -1, -1, -1, 31, 32, -1, -1, -1, -1, |
| 2139 | 136, -1, -1, 139, -1, -1, 142, -1, 144, -1, |
| 2140 | -1, -1, -1, -1, -1, 52, -1, 136, -1, -1, |
| 2141 | 139, -1, -1, 142, -1, 144, -1, -1, -1, -1, |
| 2142 | -1, -1, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2143 | 77, 78, 79, 80, 81, 82, -1, -1, -1, 5, |
| 2144 | 6, -1, 8, 9, 10, 11, 12, -1, 14, -1, |
| 2145 | 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2146 | -1, 108, 109, 110, 111, 112, 113, 114, 115, 116, |
| 2147 | 117, 118, 119, 120, 40, 122, 123, 124, 125, -1, |
| 2148 | 127, 128, 129, 3, 4, -1, -1, 7, -1, -1, |
| 2149 | -1, -1, -1, -1, -1, 142, -1, -1, 18, 19, |
| 2150 | 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2151 | -1, 31, 32, 5, 6, -1, 8, 9, 10, 11, |
| 2152 | 12, -1, 14, -1, 16, -1, -1, -1, -1, -1, |
| 2153 | 5, 6, 52, 8, 9, 10, 11, 12, 30, 14, |
| 2154 | -1, 16, -1, -1, -1, -1, -1, -1, 40, 69, |
| 2155 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2156 | 80, 81, 82, -1, -1, 40, -1, -1, -1, -1, |
| 2157 | 136, -1, -1, 139, -1, -1, 142, -1, 144, -1, |
| 2158 | -1, -1, -1, -1, -1, -1, -1, -1, 108, 109, |
| 2159 | 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
| 2160 | 120, -1, 122, 123, 124, 125, -1, 127, 128, 129, |
| 2161 | 5, 6, -1, 8, 9, 10, 11, 12, -1, 14, |
| 2162 | -1, 16, 142, 5, 6, -1, 8, 9, 10, 11, |
| 2163 | 12, -1, 14, -1, 16, -1, -1, -1, -1, -1, |
| 2164 | -1, -1, -1, -1, 136, 40, -1, 139, -1, -1, |
| 2165 | 142, -1, 144, -1, -1, -1, -1, -1, 40, -1, |
| 2166 | -1, 136, -1, -1, 139, -1, -1, 142, -1, 144, |
| 2167 | 5, 6, -1, 8, 9, 10, 11, 12, -1, 14, |
| 2168 | -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2169 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2170 | -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, |
| 2171 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2172 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2173 | -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, |
| 2174 | -1, 136, -1, -1, 139, -1, -1, 142, -1, 144, |
| 2175 | -1, -1, -1, -1, 136, -1, -1, 139, 50, 51, |
| 2176 | 142, -1, 144, -1, -1, -1, -1, -1, -1, -1, |
| 2177 | -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, |
| 2178 | 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, |
| 2179 | 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2180 | -1, 136, -1, -1, 139, -1, -1, 142, -1, 144, |
| 2181 | -1, 103, 104, 105, -1, -1, 108, 109, 110, 111, |
| 2182 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
| 2183 | 122, 123, 124, 125, 126, 127, 128, 129 |
| 2184 | }; |
| 2185 | |
| 2186 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2187 | symbol of state STATE-NUM. */ |
| 2188 | static const unsigned char yystos[] = |
| 2189 | { |
| 2190 | 0, 14, 16, 17, 23, 24, 42, 49, 53, 157, |
| 2191 | 185, 186, 187, 198, 189, 188, 43, 44, 45, 62, |
| 2192 | 195, 133, 52, 13, 33, 34, 35, 36, 37, 38, |
| 2193 | 39, 41, 132, 158, 159, 160, 0, 187, 133, 37, |
| 2194 | 39, 161, 207, 33, 34, 35, 38, 162, 204, 206, |
| 2195 | 213, 133, 133, 133, 133, 139, 196, 16, 193, 5, |
| 2196 | 6, 8, 9, 10, 11, 12, 40, 136, 139, 142, |
| 2197 | 144, 148, 174, 175, 198, 210, 160, 160, 25, 26, |
| 2198 | 184, 160, 160, 15, 214, 215, 22, 145, 205, 214, |
| 2199 | 16, 46, 47, 194, 4, 16, 16, 197, 137, 4, |
| 2200 | 4, 4, 144, 8, 145, 175, 180, 135, 137, 184, |
| 2201 | 184, 9, 10, 11, 155, 156, 175, 181, 55, 56, |
| 2202 | 57, 58, 59, 60, 61, 163, 202, 202, 157, 218, |
| 2203 | 134, 141, 30, 175, 176, 178, 179, 140, 140, 145, |
| 2204 | 180, 134, 145, 179, 181, 175, 19, 20, 3, 4, |
| 2205 | 7, 18, 31, 32, 69, 70, 71, 72, 73, 74, |
| 2206 | 75, 76, 77, 78, 79, 80, 81, 82, 108, 109, |
| 2207 | 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, |
| 2208 | 120, 122, 123, 124, 125, 127, 128, 129, 139, 142, |
| 2209 | 144, 146, 149, 150, 151, 152, 182, 210, 190, 4, |
| 2210 | 8, 175, 177, 21, 144, 203, 28, 50, 51, 63, |
| 2211 | 64, 65, 66, 67, 68, 81, 82, 103, 104, 105, |
| 2212 | 108, 121, 122, 126, 127, 128, 129, 149, 150, 151, |
| 2213 | 152, 216, 222, 223, 224, 225, 16, 165, 134, 138, |
| 2214 | 175, 175, 143, 145, 175, 138, 191, 192, 83, 84, |
| 2215 | 85, 86, 87, 88, 89, 90, 91, 92, 153, 19, |
| 2216 | 20, 89, 90, 91, 92, 93, 94, 95, 96, 97, |
| 2217 | 98, 99, 100, 101, 102, 154, 137, 137, 137, 137, |
| 2218 | 137, 141, 181, 183, 144, 183, 145, 183, 16, 137, |
| 2219 | 137, 137, 137, 134, 172, 198, 50, 8, 175, 212, |
| 2220 | 9, 12, 9, 155, 163, 153, 154, 175, 175, 212, |
| 2221 | 175, 175, 219, 212, 212, 212, 212, 212, 175, 175, |
| 2222 | 212, 212, 163, 106, 107, 110, 111, 164, 30, 176, |
| 2223 | 167, 141, 143, 143, 167, 172, 172, 137, 137, 181, |
| 2224 | 181, 181, 181, 181, 134, 141, 145, 175, 183, 143, |
| 2225 | 145, 181, 181, 181, 181, 27, 48, 170, 173, 137, |
| 2226 | 3, 4, 7, 18, 19, 20, 31, 32, 52, 142, |
| 2227 | 182, 209, 210, 211, 211, 211, 211, 177, 175, 175, |
| 2228 | 134, 169, 134, 169, 211, 139, 134, 134, 134, 134, |
| 2229 | 134, 134, 211, 211, 29, 134, 177, 175, 212, 130, |
| 2230 | 164, 166, 181, 181, 221, 134, 134, 134, 134, 181, |
| 2231 | 143, 145, 134, 134, 29, 134, 16, 4, 172, 30, |
| 2232 | 175, 200, 201, 54, 208, 183, 134, 134, 211, 211, |
| 2233 | 211, 9, 48, 9, 221, 211, 139, 212, 175, 212, |
| 2234 | 212, 212, 134, 134, 175, 212, 211, 211, 134, 134, |
| 2235 | 134, 134, 138, 181, 181, 181, 181, 143, 181, 181, |
| 2236 | 175, 181, 165, 134, 138, 16, 143, 12, 12, 137, |
| 2237 | 134, 134, 211, 4, 211, 134, 211, 134, 134, 134, |
| 2238 | 211, 211, 137, 175, 181, 181, 212, 134, 138, 134, |
| 2239 | 134, 138, 138, 138, 138, 198, 199, 30, 175, 167, |
| 2240 | 134, 211, 211, 175, 220, 211, 211, 134, 169, 169, |
| 2241 | 211, 134, 212, 212, 212, 220, 211, 138, 138, 181, |
| 2242 | 181, 181, 165, 170, 171, 16, 134, 139, 211, 134, |
| 2243 | 138, 141, 211, 138, 138, 138, 138, 199, 48, 168, |
| 2244 | 12, 141, 155, 217, 165, 175, 167, 141, 167, 4, |
| 2245 | 211, 209, 141, 155, 211, 29, 134, 209, 165, 12, |
| 2246 | 12, 134, 211, 211, 12, 67, 211, 12, 211 |
| 2247 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2248 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2249 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 2250 | # define YYSIZE_T __SIZE_TYPE__ |
| 2251 | #endif |
| 2252 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 2253 | # define YYSIZE_T size_t |
| 2254 | #endif |
| 2255 | #if ! defined (YYSIZE_T) |
| 2256 | # if defined (__STDC__) || defined (__cplusplus) |
| 2257 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 2258 | # define YYSIZE_T size_t |
| 2259 | # endif |
| 2260 | #endif |
| 2261 | #if ! defined (YYSIZE_T) |
| 2262 | # define YYSIZE_T unsigned int |
| 2263 | #endif |
| 2264 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2265 | #define yyerrok (yyerrstatus = 0) |
| 2266 | #define yyclearin (yychar = YYEMPTY) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2267 | #define YYEMPTY -2 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2268 | #define YYEOF 0 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2269 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2270 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2271 | #define YYABORT goto yyabortlab |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2272 | #define YYERROR goto yyerrlab1 |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2273 | |
| 2274 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2275 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2276 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2277 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2278 | #define YYFAIL goto yyerrlab |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2279 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2280 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2281 | |
| 2282 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2283 | do \ |
| 2284 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2285 | { \ |
| 2286 | yychar = (Token); \ |
| 2287 | yylval = (Value); \ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2288 | yychar1 = YYTRANSLATE (yychar); \ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2289 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2290 | goto yybackup; \ |
| 2291 | } \ |
| 2292 | else \ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2293 | { \ |
| 2294 | yyerror ("syntax error: cannot back up"); \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2295 | YYERROR; \ |
| 2296 | } \ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2297 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2298 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2299 | #define YYTERROR 1 |
| 2300 | #define YYERRCODE 256 |
| 2301 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2302 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
| 2303 | are run). */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2304 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2305 | #ifndef YYLLOC_DEFAULT |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2306 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2307 | Current.first_line = Rhs[1].first_line; \ |
| 2308 | Current.first_column = Rhs[1].first_column; \ |
| 2309 | Current.last_line = Rhs[N].last_line; \ |
| 2310 | Current.last_column = Rhs[N].last_column; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2311 | #endif |
| 2312 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2313 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2314 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2315 | #define YYLEX yylex () |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2316 | |
| 2317 | /* Enable debugging if requested. */ |
| 2318 | #if YYDEBUG |
| 2319 | |
| 2320 | # ifndef YYFPRINTF |
| 2321 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2322 | # define YYFPRINTF fprintf |
| 2323 | # endif |
| 2324 | |
| 2325 | # define YYDPRINTF(Args) \ |
| 2326 | do { \ |
| 2327 | if (yydebug) \ |
| 2328 | YYFPRINTF Args; \ |
| 2329 | } while (0) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2330 | # define YYDSYMPRINT(Args) \ |
| 2331 | do { \ |
| 2332 | if (yydebug) \ |
| 2333 | yysymprint Args; \ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2334 | } while (0) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2335 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2336 | multiple parsers can coexist. */ |
| 2337 | int yydebug; |
| 2338 | #else /* !YYDEBUG */ |
| 2339 | # define YYDPRINTF(Args) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2340 | # define YYDSYMPRINT(Args) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2341 | #endif /* !YYDEBUG */ |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2342 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2343 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2344 | #ifndef YYINITDEPTH |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2345 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2346 | #endif |
| 2347 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2348 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2349 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2350 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2351 | Do not make this value too large; the results are undefined if |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2352 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2353 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2354 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2355 | #if YYMAXDEPTH == 0 |
| 2356 | # undef YYMAXDEPTH |
| 2357 | #endif |
| 2358 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2359 | #ifndef YYMAXDEPTH |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2360 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2361 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2362 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2363 | |
| 2364 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2365 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2366 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2367 | # ifndef yystrlen |
| 2368 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2369 | # define yystrlen strlen |
| 2370 | # else |
| 2371 | /* Return the length of YYSTR. */ |
| 2372 | static YYSIZE_T |
| 2373 | # if defined (__STDC__) || defined (__cplusplus) |
| 2374 | yystrlen (const char *yystr) |
| 2375 | # else |
| 2376 | yystrlen (yystr) |
| 2377 | const char *yystr; |
| 2378 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2379 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2380 | register const char *yys = yystr; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2381 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2382 | while (*yys++ != '\0') |
| 2383 | continue; |
| 2384 | |
| 2385 | return yys - yystr - 1; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2386 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2387 | # endif |
| 2388 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2389 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2390 | # ifndef yystpcpy |
| 2391 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2392 | # define yystpcpy stpcpy |
| 2393 | # else |
| 2394 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2395 | YYDEST. */ |
| 2396 | static char * |
| 2397 | # if defined (__STDC__) || defined (__cplusplus) |
| 2398 | yystpcpy (char *yydest, const char *yysrc) |
| 2399 | # else |
| 2400 | yystpcpy (yydest, yysrc) |
| 2401 | char *yydest; |
| 2402 | const char *yysrc; |
| 2403 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2404 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2405 | register char *yyd = yydest; |
| 2406 | register const char *yys = yysrc; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2407 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2408 | while ((*yyd++ = *yys++) != '\0') |
| 2409 | continue; |
| 2410 | |
| 2411 | return yyd - 1; |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2412 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2413 | # endif |
| 2414 | # endif |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2415 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2416 | #endif /* !YYERROR_VERBOSE */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2417 | |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2418 | |
| 2419 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2420 | #if YYDEBUG |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2421 | /*-----------------------------. |
| 2422 | | Print this symbol on YYOUT. | |
| 2423 | `-----------------------------*/ |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2424 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2425 | static void |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2426 | #if defined (__STDC__) || defined (__cplusplus) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2427 | yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue) |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2428 | #else |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2429 | yysymprint (yyout, yytype, yyvalue) |
| 2430 | FILE* yyout; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2431 | int yytype; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2432 | YYSTYPE yyvalue; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2433 | #endif |
| 2434 | { |
| 2435 | /* Pacify ``unused variable'' warnings. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2436 | (void) yyvalue; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2437 | |
| 2438 | if (yytype < YYNTOKENS) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2439 | { |
| 2440 | YYFPRINTF (yyout, "token %s (", yytname[yytype]); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2441 | # ifdef YYPRINT |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2442 | YYPRINT (yyout, yytoknum[yytype], yyvalue); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2443 | # endif |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2444 | } |
| 2445 | else |
| 2446 | YYFPRINTF (yyout, "nterm %s (", yytname[yytype]); |
| 2447 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2448 | switch (yytype) |
| 2449 | { |
| 2450 | default: |
| 2451 | break; |
| 2452 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2453 | YYFPRINTF (yyout, ")"); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2454 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2455 | #endif /* YYDEBUG. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2456 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2457 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2458 | /*-----------------------------------------------. |
| 2459 | | Release the memory associated to this symbol. | |
| 2460 | `-----------------------------------------------*/ |
| 2461 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2462 | static void |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2463 | #if defined (__STDC__) || defined (__cplusplus) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2464 | yydestruct (int yytype, YYSTYPE yyvalue) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2465 | #else |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2466 | yydestruct (yytype, yyvalue) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2467 | int yytype; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2468 | YYSTYPE yyvalue; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2469 | #endif |
| 2470 | { |
| 2471 | /* Pacify ``unused variable'' warnings. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2472 | (void) yyvalue; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2473 | |
| 2474 | switch (yytype) |
| 2475 | { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2476 | default: |
| 2477 | break; |
| 2478 | } |
| 2479 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2480 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2481 | |
| 2482 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2483 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
| 2484 | into yyparse. The argument should have type void *. |
| 2485 | It should actually point to an object. |
| 2486 | Grammar actions can access the variable by casting it |
| 2487 | to the proper pointer type. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2488 | |
| 2489 | #ifdef YYPARSE_PARAM |
| 2490 | # if defined (__STDC__) || defined (__cplusplus) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2491 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
| 2492 | # define YYPARSE_PARAM_DECL |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2493 | # else |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2494 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM |
| 2495 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2496 | # endif |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2497 | #else /* !YYPARSE_PARAM */ |
| 2498 | # define YYPARSE_PARAM_ARG |
| 2499 | # define YYPARSE_PARAM_DECL |
| 2500 | #endif /* !YYPARSE_PARAM */ |
| 2501 | |
| 2502 | /* Prevent warning if -Wstrict-prototypes. */ |
| 2503 | #ifdef __GNUC__ |
| 2504 | # ifdef YYPARSE_PARAM |
| 2505 | int yyparse (void *); |
| 2506 | # else |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2507 | int yyparse (void); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2508 | # endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2509 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2510 | |
| 2511 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2512 | /* The lookahead symbol. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2513 | int yychar; |
| 2514 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2515 | /* The semantic value of the lookahead symbol. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2516 | YYSTYPE yylval; |
| 2517 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2518 | /* Number of parse errors so far. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2519 | int yynerrs; |
| 2520 | |
| 2521 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2522 | int |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2523 | yyparse (YYPARSE_PARAM_ARG) |
| 2524 | YYPARSE_PARAM_DECL |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2525 | { |
| 2526 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2527 | register int yystate; |
| 2528 | register int yyn; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2529 | int yyresult; |
| 2530 | /* Number of tokens to shift before error messages enabled. */ |
| 2531 | int yyerrstatus; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2532 | /* Lookahead token as an internal (translated) token number. */ |
| 2533 | int yychar1 = 0; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2534 | |
| 2535 | /* Three stacks and their tools: |
| 2536 | `yyss': related to states, |
| 2537 | `yyvs': related to semantic values, |
| 2538 | `yyls': related to locations. |
| 2539 | |
| 2540 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2541 | to reallocate them elsewhere. */ |
| 2542 | |
| 2543 | /* The state stack. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2544 | short yyssa[YYINITDEPTH]; |
| 2545 | short *yyss = yyssa; |
| 2546 | register short *yyssp; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2547 | |
| 2548 | /* The semantic value stack. */ |
| 2549 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2550 | YYSTYPE *yyvs = yyvsa; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2551 | register YYSTYPE *yyvsp; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2552 | |
| 2553 | |
| 2554 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2555 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2556 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2557 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2558 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2559 | /* The variables used to return semantic value and location from the |
| 2560 | action routines. */ |
| 2561 | YYSTYPE yyval; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2562 | |
| 2563 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2564 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2565 | rule. */ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2566 | int yylen; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2567 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2568 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2569 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2570 | yystate = 0; |
| 2571 | yyerrstatus = 0; |
| 2572 | yynerrs = 0; |
| 2573 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2574 | |
| 2575 | /* Initialize stack pointers. |
| 2576 | Waste one element of value and location stack |
| 2577 | so that they stay on the same level as the state stack. |
| 2578 | The wasted elements are never initialized. */ |
| 2579 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2580 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2581 | yyvsp = yyvs; |
| 2582 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2583 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2584 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2585 | /*------------------------------------------------------------. |
| 2586 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2587 | `------------------------------------------------------------*/ |
| 2588 | yynewstate: |
| 2589 | /* In all cases, when you get here, the value and location stacks |
| 2590 | have just been pushed. so pushing a state here evens the stacks. |
| 2591 | */ |
| 2592 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2593 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2594 | yysetstate: |
| 2595 | *yyssp = yystate; |
| 2596 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2597 | if (yyssp >= yyss + yystacksize - 1) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2598 | { |
| 2599 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2600 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2601 | |
| 2602 | #ifdef yyoverflow |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2603 | { |
| 2604 | /* Give user a chance to reallocate the stack. Use copies of |
| 2605 | these so that the &'s don't force the real ones into |
| 2606 | memory. */ |
| 2607 | YYSTYPE *yyvs1 = yyvs; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2608 | short *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2609 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2610 | |
| 2611 | /* Each stack pointer address is followed by the size of the |
| 2612 | data in use in that stack, in bytes. This used to be a |
| 2613 | conditional around just the two extra args, but that might |
| 2614 | be undefined if yyoverflow is a macro. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2615 | yyoverflow ("parser stack overflow", |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2616 | &yyss1, yysize * sizeof (*yyssp), |
| 2617 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2618 | |
| 2619 | &yystacksize); |
| 2620 | |
| 2621 | yyss = yyss1; |
| 2622 | yyvs = yyvs1; |
| 2623 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2624 | #else /* no yyoverflow */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2625 | # ifndef YYSTACK_RELOCATE |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2626 | goto yyoverflowlab; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2627 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2628 | /* Extend the stack our own way. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2629 | if (yystacksize >= YYMAXDEPTH) |
| 2630 | goto yyoverflowlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2631 | yystacksize *= 2; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2632 | if (yystacksize > YYMAXDEPTH) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2633 | yystacksize = YYMAXDEPTH; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2634 | |
| 2635 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2636 | short *yyss1 = yyss; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2637 | union yyalloc *yyptr = |
| 2638 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2639 | if (! yyptr) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2640 | goto yyoverflowlab; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2641 | YYSTACK_RELOCATE (yyss); |
| 2642 | YYSTACK_RELOCATE (yyvs); |
| 2643 | |
| 2644 | # undef YYSTACK_RELOCATE |
| 2645 | if (yyss1 != yyssa) |
| 2646 | YYSTACK_FREE (yyss1); |
| 2647 | } |
| 2648 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2649 | #endif /* no yyoverflow */ |
| 2650 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2651 | yyssp = yyss + yysize - 1; |
| 2652 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2653 | |
| 2654 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2655 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2656 | (unsigned long int) yystacksize)); |
| 2657 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2658 | if (yyssp >= yyss + yystacksize - 1) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2659 | YYABORT; |
| 2660 | } |
| 2661 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2662 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2663 | |
| 2664 | goto yybackup; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2665 | |
| 2666 | /*-----------. |
| 2667 | | yybackup. | |
| 2668 | `-----------*/ |
| 2669 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2670 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2671 | /* Do appropriate processing given the current state. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2672 | /* Read a lookahead token if we need one and don't already have one. */ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2673 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2674 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2675 | /* First try to decide what to do without reference to lookahead token. */ |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2676 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2677 | yyn = yypact[yystate]; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2678 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2679 | goto yydefault; |
| 2680 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2681 | /* Not known => get a lookahead token if don't already have one. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2682 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2683 | /* yychar is either YYEMPTY or YYEOF |
| 2684 | or a valid token in external form. */ |
| 2685 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2686 | if (yychar == YYEMPTY) |
| 2687 | { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2688 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2689 | yychar = YYLEX; |
| 2690 | } |
| 2691 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2692 | /* Convert token to internal form (in yychar1) for indexing tables with. */ |
| 2693 | |
| 2694 | if (yychar <= 0) /* This means end of input. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2695 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2696 | yychar1 = 0; |
| 2697 | yychar = YYEOF; /* Don't call YYLEX any more. */ |
| 2698 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2699 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2700 | } |
| 2701 | else |
| 2702 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2703 | yychar1 = YYTRANSLATE (yychar); |
| 2704 | |
| 2705 | /* We have to keep this `#if YYDEBUG', since we use variables |
| 2706 | which are defined only if `YYDEBUG' is set. */ |
| 2707 | YYDPRINTF ((stderr, "Next token is ")); |
| 2708 | YYDSYMPRINT ((stderr, yychar1, yylval)); |
| 2709 | YYDPRINTF ((stderr, "\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2710 | } |
| 2711 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2712 | /* If the proper action on seeing token YYCHAR1 is to reduce or to |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2713 | detect an error, take that action. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2714 | yyn += yychar1; |
| 2715 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2716 | goto yydefault; |
| 2717 | yyn = yytable[yyn]; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2718 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2719 | { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2720 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2721 | goto yyerrlab; |
| 2722 | yyn = -yyn; |
| 2723 | goto yyreduce; |
| 2724 | } |
| 2725 | |
| 2726 | if (yyn == YYFINAL) |
| 2727 | YYACCEPT; |
| 2728 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2729 | /* Shift the lookahead token. */ |
| 2730 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", |
| 2731 | yychar, yytname[yychar1])); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2732 | |
| 2733 | /* Discard the token being shifted unless it is eof. */ |
| 2734 | if (yychar != YYEOF) |
| 2735 | yychar = YYEMPTY; |
| 2736 | |
| 2737 | *++yyvsp = yylval; |
| 2738 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2739 | |
| 2740 | /* Count tokens shifted since error; after three, turn off error |
| 2741 | status. */ |
| 2742 | if (yyerrstatus) |
| 2743 | yyerrstatus--; |
Chris Lattner | 0fab59c | 2007-01-12 18:33:30 +0000 | [diff] [blame] | 2744 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2745 | yystate = yyn; |
| 2746 | goto yynewstate; |
| 2747 | |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 2748 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2749 | /*-----------------------------------------------------------. |
| 2750 | | yydefault -- do the default action for the current state. | |
| 2751 | `-----------------------------------------------------------*/ |
| 2752 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2753 | yyn = yydefact[yystate]; |
| 2754 | if (yyn == 0) |
| 2755 | goto yyerrlab; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2756 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2757 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2758 | |
| 2759 | /*-----------------------------. |
| 2760 | | yyreduce -- Do a reduction. | |
| 2761 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2762 | yyreduce: |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2763 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2764 | yylen = yyr2[yyn]; |
| 2765 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2766 | /* If YYLEN is nonzero, implement the default value of the action: |
| 2767 | `$$ = $1'. |
| 2768 | |
| 2769 | Otherwise, the following line sets YYVAL to garbage. |
| 2770 | This behavior is undocumented and Bison |
| 2771 | users should not rely upon it. Assigning to YYVAL |
| 2772 | unconditionally makes the parser a bit smaller, and it avoids a |
| 2773 | GCC warning that YYVAL may be used uninitialized. */ |
| 2774 | yyval = yyvsp[1-yylen]; |
| 2775 | |
| 2776 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2777 | |
| 2778 | #if YYDEBUG |
| 2779 | /* We have to keep this `#if YYDEBUG', since we use variables which |
| 2780 | are defined only if `YYDEBUG' is set. */ |
| 2781 | if (yydebug) |
| 2782 | { |
| 2783 | int yyi; |
| 2784 | |
| 2785 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", |
| 2786 | yyn - 1, yyrline[yyn]); |
| 2787 | |
| 2788 | /* Print the symbols being reduced, and their result. */ |
| 2789 | for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++) |
| 2790 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2791 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
| 2792 | } |
| 2793 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2794 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2795 | { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2796 | case 3: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2797 | #line 1032 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2798 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2799 | if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 2800 | GEN_ERROR("Value too large for type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2801 | yyval.SIntVal = (int32_t)yyvsp[0].UIntVal; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 2802 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2803 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2804 | break; |
| 2805 | |
| 2806 | case 31: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2807 | #line 1048 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2808 | { yyval.IPredicate = ICmpInst::ICMP_EQ; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2809 | break; |
| 2810 | |
| 2811 | case 32: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2812 | #line 1048 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2813 | { yyval.IPredicate = ICmpInst::ICMP_NE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2814 | break; |
| 2815 | |
| 2816 | case 33: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2817 | #line 1049 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2818 | { yyval.IPredicate = ICmpInst::ICMP_SLT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2819 | break; |
| 2820 | |
| 2821 | case 34: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2822 | #line 1049 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2823 | { yyval.IPredicate = ICmpInst::ICMP_SGT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2824 | break; |
| 2825 | |
| 2826 | case 35: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2827 | #line 1050 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2828 | { yyval.IPredicate = ICmpInst::ICMP_SLE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2829 | break; |
| 2830 | |
| 2831 | case 36: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2832 | #line 1050 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2833 | { yyval.IPredicate = ICmpInst::ICMP_SGE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2834 | break; |
| 2835 | |
| 2836 | case 37: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2837 | #line 1051 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2838 | { yyval.IPredicate = ICmpInst::ICMP_ULT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2839 | break; |
| 2840 | |
| 2841 | case 38: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2842 | #line 1051 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2843 | { yyval.IPredicate = ICmpInst::ICMP_UGT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2844 | break; |
| 2845 | |
| 2846 | case 39: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2847 | #line 1052 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2848 | { yyval.IPredicate = ICmpInst::ICMP_ULE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2849 | break; |
| 2850 | |
| 2851 | case 40: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2852 | #line 1052 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2853 | { yyval.IPredicate = ICmpInst::ICMP_UGE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2854 | break; |
| 2855 | |
| 2856 | case 41: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2857 | #line 1056 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2858 | { yyval.FPredicate = FCmpInst::FCMP_OEQ; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2859 | break; |
| 2860 | |
| 2861 | case 42: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2862 | #line 1056 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2863 | { yyval.FPredicate = FCmpInst::FCMP_ONE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2864 | break; |
| 2865 | |
| 2866 | case 43: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2867 | #line 1057 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2868 | { yyval.FPredicate = FCmpInst::FCMP_OLT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2869 | break; |
| 2870 | |
| 2871 | case 44: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2872 | #line 1057 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2873 | { yyval.FPredicate = FCmpInst::FCMP_OGT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2874 | break; |
| 2875 | |
| 2876 | case 45: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2877 | #line 1058 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2878 | { yyval.FPredicate = FCmpInst::FCMP_OLE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2879 | break; |
| 2880 | |
| 2881 | case 46: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2882 | #line 1058 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2883 | { yyval.FPredicate = FCmpInst::FCMP_OGE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2884 | break; |
| 2885 | |
| 2886 | case 47: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2887 | #line 1059 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2888 | { yyval.FPredicate = FCmpInst::FCMP_ORD; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2889 | break; |
| 2890 | |
| 2891 | case 48: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2892 | #line 1059 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2893 | { yyval.FPredicate = FCmpInst::FCMP_UNO; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2894 | break; |
| 2895 | |
| 2896 | case 49: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2897 | #line 1060 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2898 | { yyval.FPredicate = FCmpInst::FCMP_UEQ; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2899 | break; |
| 2900 | |
| 2901 | case 50: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2902 | #line 1060 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2903 | { yyval.FPredicate = FCmpInst::FCMP_UNE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2904 | break; |
| 2905 | |
| 2906 | case 51: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2907 | #line 1061 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2908 | { yyval.FPredicate = FCmpInst::FCMP_ULT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2909 | break; |
| 2910 | |
| 2911 | case 52: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2912 | #line 1061 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2913 | { yyval.FPredicate = FCmpInst::FCMP_UGT; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2914 | break; |
| 2915 | |
| 2916 | case 53: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2917 | #line 1062 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2918 | { yyval.FPredicate = FCmpInst::FCMP_ULE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2919 | break; |
| 2920 | |
| 2921 | case 54: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2922 | #line 1062 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2923 | { yyval.FPredicate = FCmpInst::FCMP_UGE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2924 | break; |
| 2925 | |
| 2926 | case 55: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2927 | #line 1063 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2928 | { yyval.FPredicate = FCmpInst::FCMP_TRUE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2929 | break; |
| 2930 | |
| 2931 | case 56: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2932 | #line 1064 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2933 | { yyval.FPredicate = FCmpInst::FCMP_FALSE; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2934 | break; |
| 2935 | |
| 2936 | case 60: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2937 | #line 1073 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2938 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2939 | yyval.StrVal = yyvsp[-1].StrVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2940 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2941 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2942 | break; |
| 2943 | |
| 2944 | case 61: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2945 | #line 1077 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2946 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2947 | yyval.StrVal = 0; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2948 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2949 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2950 | break; |
| 2951 | |
| 2952 | case 62: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2953 | #line 1083 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2954 | { yyval.Linkage = GlobalValue::InternalLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2955 | break; |
| 2956 | |
| 2957 | case 63: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2958 | #line 1084 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2959 | { yyval.Linkage = GlobalValue::WeakLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2960 | break; |
| 2961 | |
| 2962 | case 64: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2963 | #line 1085 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2964 | { yyval.Linkage = GlobalValue::LinkOnceLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2965 | break; |
| 2966 | |
| 2967 | case 65: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2968 | #line 1086 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2969 | { yyval.Linkage = GlobalValue::AppendingLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2970 | break; |
| 2971 | |
| 2972 | case 66: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2973 | #line 1087 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2974 | { yyval.Linkage = GlobalValue::DLLExportLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2975 | break; |
| 2976 | |
| 2977 | case 67: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2978 | #line 1091 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2979 | { yyval.Linkage = GlobalValue::DLLImportLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2980 | break; |
| 2981 | |
| 2982 | case 68: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2983 | #line 1092 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2984 | { yyval.Linkage = GlobalValue::ExternalWeakLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2985 | break; |
| 2986 | |
| 2987 | case 69: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2988 | #line 1093 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2989 | { yyval.Linkage = GlobalValue::ExternalLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2990 | break; |
| 2991 | |
| 2992 | case 70: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2993 | #line 1097 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2994 | { yyval.Visibility = GlobalValue::DefaultVisibility; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2995 | break; |
| 2996 | |
| 2997 | case 71: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 2998 | #line 1098 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2999 | { yyval.Visibility = GlobalValue::HiddenVisibility; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3000 | break; |
| 3001 | |
| 3002 | case 72: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3003 | #line 1102 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3004 | { yyval.Linkage = GlobalValue::ExternalLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3005 | break; |
| 3006 | |
| 3007 | case 73: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3008 | #line 1103 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3009 | { yyval.Linkage = GlobalValue::DLLImportLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3010 | break; |
| 3011 | |
| 3012 | case 74: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3013 | #line 1104 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3014 | { yyval.Linkage = GlobalValue::ExternalWeakLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3015 | break; |
| 3016 | |
| 3017 | case 75: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3018 | #line 1108 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3019 | { yyval.Linkage = GlobalValue::ExternalLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3020 | break; |
| 3021 | |
| 3022 | case 76: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3023 | #line 1109 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3024 | { yyval.Linkage = GlobalValue::InternalLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3025 | break; |
| 3026 | |
| 3027 | case 77: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3028 | #line 1110 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3029 | { yyval.Linkage = GlobalValue::LinkOnceLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3030 | break; |
| 3031 | |
| 3032 | case 78: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3033 | #line 1111 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3034 | { yyval.Linkage = GlobalValue::WeakLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3035 | break; |
| 3036 | |
| 3037 | case 79: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3038 | #line 1112 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3039 | { yyval.Linkage = GlobalValue::DLLExportLinkage; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3040 | break; |
| 3041 | |
| 3042 | case 80: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3043 | #line 1115 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3044 | { yyval.UIntVal = CallingConv::C; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3045 | break; |
| 3046 | |
| 3047 | case 81: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3048 | #line 1116 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3049 | { yyval.UIntVal = CallingConv::C; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3050 | break; |
| 3051 | |
| 3052 | case 82: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3053 | #line 1117 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3054 | { yyval.UIntVal = CallingConv::CSRet; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3055 | break; |
| 3056 | |
| 3057 | case 83: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3058 | #line 1118 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3059 | { yyval.UIntVal = CallingConv::Fast; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3060 | break; |
| 3061 | |
| 3062 | case 84: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3063 | #line 1119 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3064 | { yyval.UIntVal = CallingConv::Cold; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3065 | break; |
| 3066 | |
| 3067 | case 85: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3068 | #line 1120 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3069 | { yyval.UIntVal = CallingConv::X86_StdCall; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3070 | break; |
| 3071 | |
| 3072 | case 86: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3073 | #line 1121 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3074 | { yyval.UIntVal = CallingConv::X86_FastCall; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3075 | break; |
| 3076 | |
| 3077 | case 87: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3078 | #line 1122 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3079 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3080 | if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3081 | GEN_ERROR("Calling conv too large!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3082 | yyval.UIntVal = yyvsp[0].UInt64Val; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3083 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3084 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3085 | break; |
| 3086 | |
| 3087 | case 88: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3088 | #line 1129 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3089 | { yyval.ParamAttrs = FunctionType::ZExtAttribute; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3090 | break; |
| 3091 | |
| 3092 | case 89: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3093 | #line 1130 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3094 | { yyval.ParamAttrs = FunctionType::SExtAttribute; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3095 | break; |
| 3096 | |
| 3097 | case 90: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3098 | #line 1133 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3099 | { yyval.ParamAttrs = FunctionType::NoAttributeSet; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3100 | break; |
| 3101 | |
| 3102 | case 91: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3103 | #line 1134 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3104 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3105 | yyval.ParamAttrs = FunctionType::ParameterAttributes(yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs); |
| 3106 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3107 | break; |
| 3108 | |
| 3109 | case 92: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3110 | #line 1139 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3111 | { yyval.ParamAttrs = FunctionType::NoReturnAttribute; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3112 | break; |
| 3113 | |
| 3114 | case 94: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3115 | #line 1143 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3116 | { yyval.ParamAttrs = FunctionType::NoAttributeSet; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3117 | break; |
| 3118 | |
| 3119 | case 95: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3120 | #line 1144 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3121 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3122 | yyval.ParamAttrs = FunctionType::ParameterAttributes(yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs); |
| 3123 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3124 | break; |
| 3125 | |
| 3126 | case 96: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3127 | #line 1151 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3128 | { yyval.UIntVal = 0; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3129 | break; |
| 3130 | |
| 3131 | case 97: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3132 | #line 1152 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3133 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3134 | yyval.UIntVal = yyvsp[0].UInt64Val; |
| 3135 | if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 3136 | GEN_ERROR("Alignment must be a power of two!"); |
| 3137 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3138 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3139 | break; |
| 3140 | |
| 3141 | case 98: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3142 | #line 1158 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3143 | { yyval.UIntVal = 0; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3144 | break; |
| 3145 | |
| 3146 | case 99: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3147 | #line 1159 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3148 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3149 | yyval.UIntVal = yyvsp[0].UInt64Val; |
| 3150 | if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 3151 | GEN_ERROR("Alignment must be a power of two!"); |
| 3152 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3153 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3154 | break; |
| 3155 | |
| 3156 | case 100: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3157 | #line 1167 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3158 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3159 | for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) |
| 3160 | if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3161 | GEN_ERROR("Invalid character in section name!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3162 | yyval.StrVal = yyvsp[0].StrVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3163 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3164 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3165 | break; |
| 3166 | |
| 3167 | case 101: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3168 | #line 1175 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3169 | { yyval.StrVal = 0; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3170 | break; |
| 3171 | |
| 3172 | case 102: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3173 | #line 1176 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3174 | { yyval.StrVal = yyvsp[0].StrVal; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3175 | break; |
| 3176 | |
| 3177 | case 103: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3178 | #line 1181 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3179 | {} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3180 | break; |
| 3181 | |
| 3182 | case 104: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3183 | #line 1182 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3184 | {} |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3185 | break; |
| 3186 | |
| 3187 | case 105: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3188 | #line 1183 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3189 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3190 | CurGV->setSection(yyvsp[0].StrVal); |
| 3191 | free(yyvsp[0].StrVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3192 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3193 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3194 | break; |
| 3195 | |
| 3196 | case 106: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3197 | #line 1188 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3198 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3199 | if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3200 | GEN_ERROR("Alignment must be a power of two!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3201 | CurGV->setAlignment(yyvsp[0].UInt64Val); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3202 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3203 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3204 | break; |
| 3205 | |
| 3206 | case 111: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3207 | #line 1204 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3208 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3209 | yyval.TypeVal = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3210 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3211 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3212 | break; |
| 3213 | |
| 3214 | case 112: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3215 | #line 1208 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3216 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3217 | yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3218 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3219 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3220 | break; |
| 3221 | |
| 3222 | case 113: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3223 | #line 1212 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3224 | { // Pointer type? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3225 | if (*yyvsp[-1].TypeVal == Type::LabelTy) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3226 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3227 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); |
| 3228 | delete yyvsp[-1].TypeVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3229 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3230 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3231 | break; |
| 3232 | |
| 3233 | case 114: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3234 | #line 1219 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3235 | { // Named types are also simple types... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3236 | const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3237 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3238 | yyval.TypeVal = new PATypeHolder(tmp); |
| 3239 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3240 | break; |
| 3241 | |
| 3242 | case 115: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3243 | #line 1224 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3244 | { // Type UpReference |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3245 | if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3246 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3247 | UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... |
| 3248 | yyval.TypeVal = new PATypeHolder(OT); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3249 | UR_OUT("New Upreference!\n"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3250 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3251 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3252 | break; |
| 3253 | |
| 3254 | case 116: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3255 | #line 1232 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3256 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3257 | std::vector<const Type*> Params; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3258 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3259 | Attrs.push_back(yyvsp[0].ParamAttrs); |
| 3260 | for (TypeWithAttrsList::iterator I=yyvsp[-2].TypeWithAttrsList->begin(), E=yyvsp[-2].TypeWithAttrsList->end(); I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3261 | Params.push_back(I->Ty->get()); |
| 3262 | if (I->Ty->get() != Type::VoidTy) |
| 3263 | Attrs.push_back(I->Attrs); |
| 3264 | } |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3265 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3266 | if (isVarArg) Params.pop_back(); |
| 3267 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3268 | FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, Attrs); |
| 3269 | delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list |
| 3270 | delete yyvsp[-4].TypeVal; // Delete the return type handle |
| 3271 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3272 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3273 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3274 | break; |
| 3275 | |
| 3276 | case 117: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3277 | #line 1250 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3278 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3279 | std::vector<const Type*> Params; |
| 3280 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3281 | Attrs.push_back(yyvsp[0].ParamAttrs); |
| 3282 | 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] | 3283 | Params.push_back(I->Ty->get()); |
| 3284 | if (I->Ty->get() != Type::VoidTy) |
| 3285 | Attrs.push_back(I->Attrs); |
| 3286 | } |
| 3287 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3288 | if (isVarArg) Params.pop_back(); |
| 3289 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3290 | FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, Attrs); |
| 3291 | delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list |
| 3292 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3293 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3294 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3295 | break; |
| 3296 | |
| 3297 | case 118: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3298 | #line 1268 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3299 | { // Sized array type? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3300 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); |
| 3301 | delete yyvsp[-1].TypeVal; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3302 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3303 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3304 | break; |
| 3305 | |
| 3306 | case 119: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3307 | #line 1273 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3308 | { // Packed array type? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3309 | const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); |
| 3310 | if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3311 | GEN_ERROR("Unsigned result not equal to signed result"); |
Chris Lattner | 42a7551 | 2007-01-15 02:27:26 +0000 | [diff] [blame] | 3312 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 3313 | GEN_ERROR("Element type of a PackedType must be primitive"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3314 | if (!isPowerOf2_32(yyvsp[-3].UInt64Val)) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3315 | GEN_ERROR("Vector length should be a power of 2!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3316 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); |
| 3317 | delete yyvsp[-1].TypeVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3318 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3319 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3320 | break; |
| 3321 | |
| 3322 | case 120: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3323 | #line 1285 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3324 | { // Structure type? |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3325 | std::vector<const Type*> Elements; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3326 | for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(), |
| 3327 | E = yyvsp[-1].TypeList->end(); I != E; ++I) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3328 | Elements.push_back(*I); |
| 3329 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3330 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 3331 | delete yyvsp[-1].TypeList; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3332 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3333 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3334 | break; |
| 3335 | |
| 3336 | case 121: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3337 | #line 1295 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3338 | { // Empty structure type? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3339 | yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3340 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3341 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3342 | break; |
| 3343 | |
| 3344 | case 122: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3345 | #line 1299 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3346 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3347 | std::vector<const Type*> Elements; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3348 | for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(), |
| 3349 | E = yyvsp[-2].TypeList->end(); I != E; ++I) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3350 | Elements.push_back(*I); |
| 3351 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3352 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 3353 | delete yyvsp[-2].TypeList; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3354 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3355 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3356 | break; |
| 3357 | |
| 3358 | case 123: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3359 | #line 1309 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3360 | { // Empty structure type? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3361 | yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3362 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3363 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3364 | break; |
| 3365 | |
| 3366 | case 124: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3367 | #line 1316 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3368 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3369 | yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal; |
| 3370 | yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs; |
| 3371 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3372 | break; |
| 3373 | |
| 3374 | case 125: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3375 | #line 1323 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3376 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3377 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3378 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 3379 | if (!(*yyvsp[0].TypeVal)->isFirstClassType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3380 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3381 | yyval.TypeVal = yyvsp[0].TypeVal; |
| 3382 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3383 | break; |
| 3384 | |
| 3385 | case 126: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3386 | #line 1330 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3387 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3388 | yyval.TypeVal = new PATypeHolder(Type::VoidTy); |
| 3389 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3390 | break; |
| 3391 | |
| 3392 | case 127: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3393 | #line 1335 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3394 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3395 | yyval.TypeWithAttrsList = new TypeWithAttrsList(); |
| 3396 | yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3397 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3398 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3399 | break; |
| 3400 | |
| 3401 | case 128: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3402 | #line 1340 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3403 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3404 | (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3405 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3406 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3407 | break; |
| 3408 | |
| 3409 | case 130: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3410 | #line 1348 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3411 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3412 | yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3413 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3414 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3415 | yyval.TypeWithAttrsList->push_back(TWA); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3416 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3417 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3418 | break; |
| 3419 | |
| 3420 | case 131: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3421 | #line 1355 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3422 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3423 | yyval.TypeWithAttrsList = new TypeWithAttrsList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3424 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 3425 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3426 | yyval.TypeWithAttrsList->push_back(TWA); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3427 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3428 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3429 | break; |
| 3430 | |
| 3431 | case 132: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3432 | #line 1362 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3433 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3434 | yyval.TypeWithAttrsList = new TypeWithAttrsList(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3435 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3436 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3437 | break; |
| 3438 | |
| 3439 | case 133: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3440 | #line 1370 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3441 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3442 | yyval.TypeList = new std::list<PATypeHolder>(); |
| 3443 | yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3444 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3445 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3446 | break; |
| 3447 | |
| 3448 | case 134: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3449 | #line 1375 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3450 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3451 | (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3452 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3453 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3454 | break; |
| 3455 | |
| 3456 | case 135: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3457 | #line 1386 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3458 | { // Nonempty unsized arr |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3459 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3460 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 3461 | const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3462 | if (ATy == 0) |
| 3463 | GEN_ERROR("Cannot make array constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3464 | (*yyvsp[-3].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3465 | const Type *ETy = ATy->getElementType(); |
| 3466 | int NumElements = ATy->getNumElements(); |
| 3467 | |
| 3468 | // Verify that we have the correct size... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3469 | if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3470 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3471 | utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3472 | itostr(NumElements) + "!"); |
| 3473 | |
| 3474 | // Verify all elements are correct type! |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3475 | for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { |
| 3476 | if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3477 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3478 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3479 | (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3480 | } |
| 3481 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3482 | yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector); |
| 3483 | delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3484 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3485 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3486 | break; |
| 3487 | |
| 3488 | case 136: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3489 | #line 1414 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3490 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3491 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3492 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 3493 | const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3494 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3495 | GEN_ERROR("Cannot make array constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3496 | (*yyvsp[-2].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3497 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3498 | int NumElements = ATy->getNumElements(); |
| 3499 | if (NumElements != -1 && NumElements != 0) |
| 3500 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
| 3501 | " arguments, but has size of " + itostr(NumElements) +"!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3502 | yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3503 | delete yyvsp[-2].TypeVal; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3504 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3505 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3506 | break; |
| 3507 | |
| 3508 | case 137: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3509 | #line 1430 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3510 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3511 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3512 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 3513 | const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3514 | if (ATy == 0) |
| 3515 | GEN_ERROR("Cannot make array constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3516 | (*yyvsp[-2].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3517 | |
| 3518 | int NumElements = ATy->getNumElements(); |
| 3519 | const Type *ETy = ATy->getElementType(); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3520 | char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); |
| 3521 | if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3522 | GEN_ERROR("Can't build string constant of size " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3523 | itostr((int)(EndStr-yyvsp[0].StrVal)) + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3524 | " when array has size " + itostr(NumElements) + "!"); |
| 3525 | std::vector<Constant*> Vals; |
| 3526 | if (ETy == Type::Int8Ty) { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3527 | for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3528 | C != (unsigned char*)EndStr; ++C) |
| 3529 | Vals.push_back(ConstantInt::get(ETy, *C)); |
| 3530 | } else { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3531 | free(yyvsp[0].StrVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3532 | GEN_ERROR("Cannot build string arrays of non byte sized elements!"); |
| 3533 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3534 | free(yyvsp[0].StrVal); |
| 3535 | yyval.ConstVal = ConstantArray::get(ATy, Vals); |
| 3536 | delete yyvsp[-2].TypeVal; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3537 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3538 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3539 | break; |
| 3540 | |
| 3541 | case 138: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3542 | #line 1459 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3543 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3544 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3545 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 3546 | const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3547 | if (PTy == 0) |
| 3548 | GEN_ERROR("Cannot make packed constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3549 | (*yyvsp[-3].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3550 | const Type *ETy = PTy->getElementType(); |
| 3551 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3552 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3553 | // Verify that we have the correct size... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3554 | if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3555 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3556 | utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3557 | itostr(NumElements) + "!"); |
| 3558 | |
| 3559 | // Verify all elements are correct type! |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3560 | for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { |
| 3561 | if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3562 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3563 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3564 | (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3565 | } |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3566 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3567 | yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector); |
| 3568 | delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3569 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3570 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3571 | break; |
| 3572 | |
| 3573 | case 139: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3574 | #line 1487 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3575 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3576 | const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3577 | if (STy == 0) |
| 3578 | GEN_ERROR("Cannot make struct constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3579 | (*yyvsp[-3].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3580 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3581 | if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3582 | GEN_ERROR("Illegal number of initializers for structure type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3583 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3584 | // Check to ensure that constants are compatible with the type initializer! |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3585 | for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) |
| 3586 | if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3587 | GEN_ERROR("Expected type '" + |
| 3588 | STy->getElementType(i)->getDescription() + |
| 3589 | "' for element #" + utostr(i) + |
| 3590 | " of structure initializer!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3591 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3592 | // Check to ensure that Type is not packed |
| 3593 | if (STy->isPacked()) |
| 3594 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3595 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3596 | yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector); |
| 3597 | delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3598 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3599 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3600 | break; |
| 3601 | |
| 3602 | case 140: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3603 | #line 1512 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3604 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3605 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3606 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 3607 | const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3608 | if (STy == 0) |
| 3609 | GEN_ERROR("Cannot make struct constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3610 | (*yyvsp[-2].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3611 | |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3612 | if (STy->getNumContainedTypes() != 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3613 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3614 | |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3615 | // Check to ensure that Type is not packed |
| 3616 | if (STy->isPacked()) |
| 3617 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3618 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3619 | yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3620 | delete yyvsp[-2].TypeVal; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3621 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3622 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3623 | break; |
| 3624 | |
| 3625 | case 141: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3626 | #line 1531 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3627 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3628 | const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3629 | if (STy == 0) |
| 3630 | GEN_ERROR("Cannot make struct constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3631 | (*yyvsp[-5].TypeVal)->getDescription() + "'!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3632 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3633 | if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes()) |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3634 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3635 | |
| 3636 | // Check to ensure that constants are compatible with the type initializer! |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3637 | for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i) |
| 3638 | if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i)) |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3639 | GEN_ERROR("Expected type '" + |
| 3640 | STy->getElementType(i)->getDescription() + |
| 3641 | "' for element #" + utostr(i) + |
| 3642 | " of structure initializer!"); |
| 3643 | |
| 3644 | // Check to ensure that Type is packed |
| 3645 | if (!STy->isPacked()) |
| 3646 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3647 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3648 | yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector); |
| 3649 | delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector; |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3650 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3651 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3652 | break; |
| 3653 | |
| 3654 | case 142: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3655 | #line 1556 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3656 | { |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3657 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3658 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); |
| 3659 | const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3660 | if (STy == 0) |
| 3661 | GEN_ERROR("Cannot make struct constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3662 | (*yyvsp[-4].TypeVal)->getDescription() + "'!"); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3663 | |
| 3664 | if (STy->getNumContainedTypes() != 0) |
| 3665 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3666 | |
| 3667 | // Check to ensure that Type is packed |
| 3668 | if (!STy->isPacked()) |
| 3669 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3670 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3671 | yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3672 | delete yyvsp[-4].TypeVal; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3673 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3674 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3675 | break; |
| 3676 | |
| 3677 | case 143: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3678 | #line 1575 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3679 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3680 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3681 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3682 | const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3683 | if (PTy == 0) |
| 3684 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3685 | (*yyvsp[-1].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3686 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3687 | yyval.ConstVal = ConstantPointerNull::get(PTy); |
| 3688 | delete yyvsp[-1].TypeVal; |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3689 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3690 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3691 | break; |
| 3692 | |
| 3693 | case 144: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3694 | #line 1587 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3695 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3696 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3697 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3698 | yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); |
| 3699 | delete yyvsp[-1].TypeVal; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3700 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3701 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3702 | break; |
| 3703 | |
| 3704 | case 145: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3705 | #line 1594 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3706 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3707 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3708 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3709 | const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3710 | if (Ty == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3711 | GEN_ERROR("Global const reference must be a pointer type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3712 | |
| 3713 | // ConstExprs can exist in the body of a function, thus creating |
| 3714 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3715 | // the context of a function, getValNonImprovising will search the functions |
| 3716 | // symbol table instead of the module symbol table for the global symbol, |
| 3717 | // which throws things all off. To get around this, we just tell |
| 3718 | // getValNonImprovising that we are at global scope here. |
| 3719 | // |
| 3720 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3721 | CurFun.CurrentFunction = 0; |
| 3722 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3723 | Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3724 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3725 | |
| 3726 | CurFun.CurrentFunction = SavedCurFn; |
| 3727 | |
| 3728 | // If this is an initializer for a constant pointer, which is referencing a |
| 3729 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3730 | // in the future with the right type of variable. |
| 3731 | // |
| 3732 | if (V == 0) { |
| 3733 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 3734 | const PointerType *PT = cast<PointerType>(Ty); |
| 3735 | |
| 3736 | // First check to see if the forward references value is already created! |
| 3737 | PerModuleInfo::GlobalRefsType::iterator I = |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3738 | CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3739 | |
| 3740 | if (I != CurModule.GlobalRefs.end()) { |
| 3741 | V = I->second; // Placeholder already exists, use it... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3742 | yyvsp[0].ValIDVal.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3743 | } else { |
| 3744 | std::string Name; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3745 | if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3746 | |
| 3747 | // Create the forward referenced global. |
| 3748 | GlobalValue *GV; |
| 3749 | if (const FunctionType *FTy = |
| 3750 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3751 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3752 | CurModule.CurrentModule); |
| 3753 | } else { |
| 3754 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3755 | GlobalValue::ExternalLinkage, 0, |
| 3756 | Name, CurModule.CurrentModule); |
| 3757 | } |
| 3758 | |
| 3759 | // Keep track of the fact that we have a forward ref to recycle it |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3760 | 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] | 3761 | V = GV; |
| 3762 | } |
| 3763 | } |
| 3764 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3765 | yyval.ConstVal = cast<GlobalValue>(V); |
| 3766 | delete yyvsp[-1].TypeVal; // Free the type handle |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3767 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3768 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3769 | break; |
| 3770 | |
| 3771 | case 146: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3772 | #line 1657 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3773 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3774 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3775 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3776 | if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3777 | GEN_ERROR("Mismatched types for constant expression: " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3778 | (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription()); |
| 3779 | yyval.ConstVal = yyvsp[0].ConstVal; |
| 3780 | delete yyvsp[-1].TypeVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3781 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3782 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3783 | break; |
| 3784 | |
| 3785 | case 147: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3786 | #line 1667 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3787 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3788 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3789 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3790 | const Type *Ty = yyvsp[-1].TypeVal->get(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3791 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 3792 | GEN_ERROR("Cannot create a null initialized value of this type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3793 | yyval.ConstVal = Constant::getNullValue(Ty); |
| 3794 | delete yyvsp[-1].TypeVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3795 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3796 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3797 | break; |
| 3798 | |
| 3799 | case 148: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3800 | #line 1677 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3801 | { // integral constants |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3802 | if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3803 | GEN_ERROR("Constant value doesn't fit in type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3804 | yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3805 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3806 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3807 | break; |
| 3808 | |
| 3809 | case 149: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3810 | #line 1683 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3811 | { // integral constants |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3812 | if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3813 | GEN_ERROR("Constant value doesn't fit in type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3814 | yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3815 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3816 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3817 | break; |
| 3818 | |
| 3819 | case 150: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3820 | #line 1689 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3821 | { // Boolean constants |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3822 | assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); |
| 3823 | yyval.ConstVal = ConstantInt::getTrue(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3824 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3825 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3826 | break; |
| 3827 | |
| 3828 | case 151: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3829 | #line 1694 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3830 | { // Boolean constants |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3831 | assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); |
| 3832 | yyval.ConstVal = ConstantInt::getFalse(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3833 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3834 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3835 | break; |
| 3836 | |
| 3837 | case 152: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3838 | #line 1699 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3839 | { // Float & Double constants |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3840 | if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal)) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3841 | GEN_ERROR("Floating point constant invalid for type!!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3842 | yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3843 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3844 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3845 | break; |
| 3846 | |
| 3847 | case 153: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3848 | #line 1707 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3849 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3850 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3851 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3852 | Constant *Val = yyvsp[-3].ConstVal; |
| 3853 | const Type *DestTy = yyvsp[-1].TypeVal->get(); |
| 3854 | if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy)) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3855 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 3856 | Val->getType()->getDescription() + "' to '" + |
| 3857 | DestTy->getDescription() + "'!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3858 | yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy); |
| 3859 | delete yyvsp[-1].TypeVal; |
| 3860 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3861 | break; |
| 3862 | |
| 3863 | case 154: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3864 | #line 1719 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3865 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3866 | if (!isa<PointerType>(yyvsp[-2].ConstVal->getType())) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3867 | GEN_ERROR("GetElementPtr requires a pointer operand!"); |
| 3868 | |
| 3869 | const Type *IdxTy = |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3870 | GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3871 | if (!IdxTy) |
| 3872 | GEN_ERROR("Index list invalid for constant getelementptr!"); |
| 3873 | |
| 3874 | std::vector<Constant*> IdxVec; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3875 | for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i) |
| 3876 | if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i])) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3877 | IdxVec.push_back(C); |
| 3878 | else |
| 3879 | GEN_ERROR("Indices to constant getelementptr must be constants!"); |
| 3880 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3881 | delete yyvsp[-1].ValueList; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3882 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3883 | yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3884 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3885 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3886 | break; |
| 3887 | |
| 3888 | case 155: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3889 | #line 1740 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3890 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3891 | if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3892 | GEN_ERROR("Select condition must be of boolean type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3893 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3894 | GEN_ERROR("Select operand types must match!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3895 | yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3896 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3897 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3898 | break; |
| 3899 | |
| 3900 | case 156: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3901 | #line 1748 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3902 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3903 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3904 | GEN_ERROR("Binary operator types must match!"); |
| 3905 | CHECK_FOR_ERROR; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3906 | yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
| 3907 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3908 | break; |
| 3909 | |
| 3910 | case 157: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3911 | #line 1754 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3912 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3913 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3914 | GEN_ERROR("Logical operator types must match!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3915 | if (!yyvsp[-3].ConstVal->getType()->isInteger()) { |
| 3916 | if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()) || |
| 3917 | !cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger()) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3918 | GEN_ERROR("Logical operator requires integral operands!"); |
| 3919 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3920 | 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] | 3921 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3922 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3923 | break; |
| 3924 | |
| 3925 | case 158: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3926 | #line 1765 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3927 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3928 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3929 | GEN_ERROR("icmp operand types must match!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3930 | yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
| 3931 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3932 | break; |
| 3933 | |
| 3934 | case 159: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3935 | #line 1770 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3936 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3937 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3938 | GEN_ERROR("fcmp operand types must match!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3939 | yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
| 3940 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3941 | break; |
| 3942 | |
| 3943 | case 160: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3944 | #line 1775 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3945 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3946 | if (yyvsp[-1].ConstVal->getType() != Type::Int8Ty) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3947 | GEN_ERROR("Shift count for shift constant must be i8 type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3948 | if (!yyvsp[-3].ConstVal->getType()->isInteger()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3949 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 3950 | CHECK_FOR_ERROR; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3951 | yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3952 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3953 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3954 | break; |
| 3955 | |
| 3956 | case 161: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3957 | #line 1784 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3958 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3959 | if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3960 | GEN_ERROR("Invalid extractelement operands!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3961 | yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3962 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3963 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3964 | break; |
| 3965 | |
| 3966 | case 162: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3967 | #line 1790 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3968 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3969 | if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3970 | GEN_ERROR("Invalid insertelement operands!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3971 | yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3972 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3973 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3974 | break; |
| 3975 | |
| 3976 | case 163: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3977 | #line 1796 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3978 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3979 | if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3980 | GEN_ERROR("Invalid shufflevector operands!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3981 | yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3982 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3983 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3984 | break; |
| 3985 | |
| 3986 | case 164: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3987 | #line 1805 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3988 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3989 | (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3990 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3991 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3992 | break; |
| 3993 | |
| 3994 | case 165: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3995 | #line 1809 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3996 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 3997 | yyval.ConstVector = new std::vector<Constant*>(); |
| 3998 | yyval.ConstVector->push_back(yyvsp[0].ConstVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3999 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4000 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4001 | break; |
| 4002 | |
| 4003 | case 166: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4004 | #line 1817 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4005 | { yyval.BoolVal = false; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4006 | break; |
| 4007 | |
| 4008 | case 167: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4009 | #line 1817 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4010 | { yyval.BoolVal = true; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4011 | break; |
| 4012 | |
| 4013 | case 168: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4014 | #line 1828 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4015 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4016 | yyval.ModuleVal = ParserResult = CurModule.CurrentModule; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4017 | CurModule.ModuleDone(); |
| 4018 | CHECK_FOR_ERROR; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4019 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4020 | break; |
| 4021 | |
| 4022 | case 169: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4023 | #line 1833 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4024 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4025 | yyval.ModuleVal = ParserResult = CurModule.CurrentModule; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4026 | CurModule.ModuleDone(); |
| 4027 | CHECK_FOR_ERROR; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4028 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4029 | break; |
| 4030 | |
| 4031 | case 172: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4032 | #line 1846 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4033 | { CurFun.isDeclare = false; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4034 | break; |
| 4035 | |
| 4036 | case 173: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4037 | #line 1846 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4038 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4039 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4040 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4041 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4042 | break; |
| 4043 | |
| 4044 | case 174: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4045 | #line 1850 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4046 | { CurFun.isDeclare = true; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4047 | break; |
| 4048 | |
| 4049 | case 175: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4050 | #line 1850 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4051 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4052 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4053 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4054 | break; |
| 4055 | |
| 4056 | case 176: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4057 | #line 1853 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4058 | { |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4059 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4060 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4061 | break; |
| 4062 | |
| 4063 | case 177: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4064 | #line 1856 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4065 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4066 | // Emit an error if there are any unresolved types left. |
| 4067 | if (!CurModule.LateResolveTypes.empty()) { |
| 4068 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4069 | if (DID.Type == ValID::NameVal) { |
| 4070 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4071 | } else { |
| 4072 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4073 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4074 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4075 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4076 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4077 | break; |
| 4078 | |
| 4079 | case 178: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4080 | #line 1868 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4081 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4082 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4083 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4084 | // Eagerly resolve types. This is not an optimization, this is a |
| 4085 | // requirement that is due to the fact that we could have this: |
| 4086 | // |
| 4087 | // %list = type { %list * } |
| 4088 | // %list = type { %list * } ; repeated type decl |
| 4089 | // |
| 4090 | // If types are not resolved eagerly, then the two types will not be |
| 4091 | // determined to be the same type! |
| 4092 | // |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4093 | ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4094 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4095 | if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4096 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4097 | // If this is a named type that is not a redefinition, add it to the slot |
| 4098 | // table. |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4099 | CurModule.Types.push_back(*yyvsp[0].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4100 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4101 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4102 | delete yyvsp[0].TypeVal; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4103 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4104 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4105 | break; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4106 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4107 | case 179: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4108 | #line 1892 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4109 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4110 | ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4111 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4112 | if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4113 | CHECK_FOR_ERROR |
| 4114 | // If this is a named type that is not a redefinition, add it to the slot |
| 4115 | // table. |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4116 | CurModule.Types.push_back(yyvsp[0].PrimType); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4117 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4118 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4119 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4120 | break; |
| 4121 | |
| 4122 | case 180: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4123 | #line 1903 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4124 | { /* "Externally Visible" Linkage */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4125 | if (yyvsp[0].ConstVal == 0) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4126 | GEN_ERROR("Global value initializer is not a constant!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4127 | CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, |
| 4128 | yyvsp[-2].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4129 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4130 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4131 | break; |
| 4132 | |
| 4133 | case 181: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4134 | #line 1909 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4135 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4136 | CurGV = 0; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4137 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4138 | break; |
| 4139 | |
| 4140 | case 182: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4141 | #line 1912 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4142 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4143 | if (yyvsp[0].ConstVal == 0) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4144 | GEN_ERROR("Global value initializer is not a constant!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4145 | CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, yyvsp[-3].Linkage, yyvsp[-2].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4146 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4147 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4148 | break; |
| 4149 | |
| 4150 | case 183: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4151 | #line 1917 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4152 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4153 | CurGV = 0; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4154 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4155 | break; |
| 4156 | |
| 4157 | case 184: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4158 | #line 1920 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4159 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4160 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4161 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 4162 | CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, yyvsp[-3].Linkage, yyvsp[-2].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4163 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4164 | delete yyvsp[0].TypeVal; |
| 4165 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4166 | break; |
| 4167 | |
| 4168 | case 185: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4169 | #line 1926 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4170 | { |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4171 | CurGV = 0; |
| 4172 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4173 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4174 | break; |
| 4175 | |
| 4176 | case 186: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4177 | #line 1930 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4178 | { |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4179 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4180 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4181 | break; |
| 4182 | |
| 4183 | case 187: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4184 | #line 1933 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4185 | { |
Reid Spencer | 218ded2 | 2007-01-05 17:07:23 +0000 | [diff] [blame] | 4186 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4187 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4188 | break; |
| 4189 | |
| 4190 | case 188: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4191 | #line 1939 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4192 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4193 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4194 | char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); |
| 4195 | std::string NewAsm(yyvsp[0].StrVal, EndStr); |
| 4196 | free(yyvsp[0].StrVal); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4197 | |
| 4198 | if (AsmSoFar.empty()) |
| 4199 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4200 | else |
| 4201 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4202 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4203 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4204 | break; |
| 4205 | |
| 4206 | case 189: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4207 | #line 1952 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4208 | { yyval.Endianness = Module::BigEndian; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4209 | break; |
| 4210 | |
| 4211 | case 190: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4212 | #line 1953 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4213 | { yyval.Endianness = Module::LittleEndian; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4214 | break; |
| 4215 | |
| 4216 | case 191: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4217 | #line 1955 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4218 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4219 | CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4220 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4221 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4222 | break; |
| 4223 | |
| 4224 | case 192: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4225 | #line 1959 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4226 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4227 | if (yyvsp[0].UInt64Val == 32) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4228 | CurModule.CurrentModule->setPointerSize(Module::Pointer32); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4229 | else if (yyvsp[0].UInt64Val == 64) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4230 | CurModule.CurrentModule->setPointerSize(Module::Pointer64); |
| 4231 | else |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4232 | GEN_ERROR("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!"); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4233 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4234 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4235 | break; |
| 4236 | |
| 4237 | case 193: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4238 | #line 1968 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4239 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4240 | CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); |
| 4241 | free(yyvsp[0].StrVal); |
| 4242 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4243 | break; |
| 4244 | |
| 4245 | case 194: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4246 | #line 1972 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4247 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4248 | CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); |
| 4249 | free(yyvsp[0].StrVal); |
| 4250 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4251 | break; |
| 4252 | |
| 4253 | case 196: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4254 | #line 1979 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4255 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4256 | CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); |
| 4257 | free(yyvsp[0].StrVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4258 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4259 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4260 | break; |
| 4261 | |
| 4262 | case 197: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4263 | #line 1984 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4264 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4265 | CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); |
| 4266 | free(yyvsp[0].StrVal); |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 4267 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4268 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4269 | break; |
| 4270 | |
| 4271 | case 198: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4272 | #line 1989 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4273 | { |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 4274 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4275 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4276 | break; |
| 4277 | |
| 4278 | case 202: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4279 | #line 1999 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4280 | { yyval.StrVal = 0; } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4281 | break; |
| 4282 | |
| 4283 | case 203: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4284 | #line 2001 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4285 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4286 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4287 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 4288 | if (*yyvsp[-2].TypeVal == Type::VoidTy) |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4289 | GEN_ERROR("void typed arguments are invalid!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4290 | ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal; |
| 4291 | yyval.ArgList = yyvsp[-4].ArgList; |
| 4292 | yyvsp[-4].ArgList->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4293 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4294 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4295 | break; |
| 4296 | |
| 4297 | case 204: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4298 | #line 2011 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4299 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4300 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4301 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 4302 | if (*yyvsp[-2].TypeVal == Type::VoidTy) |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4303 | GEN_ERROR("void typed arguments are invalid!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4304 | ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal; |
| 4305 | yyval.ArgList = new ArgListType; |
| 4306 | yyval.ArgList->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4307 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4308 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4309 | break; |
| 4310 | |
| 4311 | case 205: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4312 | #line 2022 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4313 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4314 | yyval.ArgList = yyvsp[0].ArgList; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4315 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4316 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4317 | break; |
| 4318 | |
| 4319 | case 206: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4320 | #line 2026 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4321 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4322 | yyval.ArgList = yyvsp[-2].ArgList; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4323 | struct ArgListEntry E; |
| 4324 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4325 | E.Name = 0; |
| 4326 | E.Attrs = FunctionType::NoAttributeSet; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4327 | yyval.ArgList->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4328 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4329 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4330 | break; |
| 4331 | |
| 4332 | case 207: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4333 | #line 2035 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4334 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4335 | yyval.ArgList = new ArgListType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4336 | struct ArgListEntry E; |
| 4337 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 4338 | E.Name = 0; |
| 4339 | E.Attrs = FunctionType::NoAttributeSet; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4340 | yyval.ArgList->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4341 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4342 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4343 | break; |
| 4344 | |
| 4345 | case 208: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4346 | #line 2044 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4347 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4348 | yyval.ArgList = 0; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4349 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4350 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4351 | break; |
| 4352 | |
| 4353 | case 209: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4354 | #line 2050 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4355 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4356 | UnEscapeLexed(yyvsp[-6].StrVal); |
| 4357 | std::string FunctionName(yyvsp[-6].StrVal); |
| 4358 | free(yyvsp[-6].StrVal); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4359 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4360 | // Check the function result for abstractness if this is a define. We should |
| 4361 | // have no abstract types at this point |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4362 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal)) |
| 4363 | GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4364 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4365 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4366 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4367 | ParamAttrs.push_back(yyvsp[-2].ParamAttrs); |
| 4368 | if (yyvsp[-4].ArgList) { // If there are arguments... |
| 4369 | 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] | 4370 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4371 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 4372 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4373 | ParamTypeList.push_back(Ty); |
| 4374 | if (Ty != Type::VoidTy) |
| 4375 | ParamAttrs.push_back(I->Attrs); |
| 4376 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4377 | } |
| 4378 | |
| 4379 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4380 | if (isVarArg) ParamTypeList.pop_back(); |
| 4381 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4382 | FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4383 | ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4384 | const PointerType *PFT = PointerType::get(FT); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4385 | delete yyvsp[-7].TypeVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4386 | |
| 4387 | ValID ID; |
| 4388 | if (!FunctionName.empty()) { |
| 4389 | ID = ValID::create((char*)FunctionName.c_str()); |
| 4390 | } else { |
| 4391 | ID = ValID::create((int)CurModule.Values[PFT].size()); |
| 4392 | } |
| 4393 | |
| 4394 | Function *Fn = 0; |
| 4395 | // See if this function was forward referenced. If so, recycle the object. |
| 4396 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4397 | // Move the function to the end of the list, from whereever it was |
| 4398 | // previously inserted. |
| 4399 | Fn = cast<Function>(FWRef); |
| 4400 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4401 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4402 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4403 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4404 | // If this is the case, either we need to be a forward decl, or it needs |
| 4405 | // to be. |
| 4406 | if (!CurFun.isDeclare && !Fn->isExternal()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4407 | GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4408 | |
| 4409 | // Make sure to strip off any argument names so we can't get conflicts. |
| 4410 | if (Fn->isExternal()) |
| 4411 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4412 | AI != AE; ++AI) |
| 4413 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4414 | } else { // Not already defined? |
| 4415 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4416 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4417 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4418 | InsertValue(Fn, CurModule.Values); |
| 4419 | } |
| 4420 | |
| 4421 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4422 | |
| 4423 | if (CurFun.isDeclare) { |
| 4424 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4425 | // correctly handle cases, when pointer to function is passed as argument to |
| 4426 | // another function. |
| 4427 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4428 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4429 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4430 | Fn->setCallingConv(yyvsp[-8].UIntVal); |
| 4431 | Fn->setAlignment(yyvsp[0].UIntVal); |
| 4432 | if (yyvsp[-1].StrVal) { |
| 4433 | Fn->setSection(yyvsp[-1].StrVal); |
| 4434 | free(yyvsp[-1].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4435 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4436 | |
| 4437 | // Add all of the arguments we parsed to the function... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4438 | if (yyvsp[-4].ArgList) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4439 | if (isVarArg) { // Nuke the last entry |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4440 | 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] | 4441 | "Not a varargs marker!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4442 | delete yyvsp[-4].ArgList->back().Ty; |
| 4443 | yyvsp[-4].ArgList->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4444 | } |
| 4445 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4446 | unsigned Idx = 1; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4447 | 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] | 4448 | delete I->Ty; // Delete the typeholder... |
| 4449 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4450 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4451 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4452 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4453 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4454 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4455 | delete yyvsp[-4].ArgList; // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4456 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4457 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4458 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4459 | break; |
| 4460 | |
| 4461 | case 212: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4462 | #line 2157 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4463 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4464 | yyval.FunctionVal = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4465 | |
| 4466 | // Make sure that we keep track of the linkage type even if there was a |
| 4467 | // previous "declare". |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4468 | yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage); |
| 4469 | yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility); |
| 4470 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4471 | break; |
| 4472 | |
| 4473 | case 215: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4474 | #line 2168 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4475 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4476 | yyval.FunctionVal = yyvsp[-1].FunctionVal; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4477 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4478 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4479 | break; |
| 4480 | |
| 4481 | case 216: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4482 | #line 2173 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4483 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4484 | CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage); |
| 4485 | CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility); |
| 4486 | yyval.FunctionVal = CurFun.CurrentFunction; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4487 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4488 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4489 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4490 | break; |
| 4491 | |
| 4492 | case 217: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4493 | #line 2185 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4494 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4495 | yyval.BoolVal = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4496 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4497 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4498 | break; |
| 4499 | |
| 4500 | case 218: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4501 | #line 2189 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4502 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4503 | yyval.BoolVal = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4504 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4505 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4506 | break; |
| 4507 | |
| 4508 | case 219: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4509 | #line 2194 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4510 | { // A reference to a direct constant |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4511 | yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4512 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4513 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4514 | break; |
| 4515 | |
| 4516 | case 220: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4517 | #line 2198 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4518 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4519 | yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4520 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4521 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4522 | break; |
| 4523 | |
| 4524 | case 221: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4525 | #line 2202 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4526 | { // Perhaps it's an FP constant? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4527 | yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4528 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4529 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4530 | break; |
| 4531 | |
| 4532 | case 222: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4533 | #line 2206 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4534 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4535 | yyval.ValIDVal = ValID::create(ConstantInt::getTrue()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4536 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4537 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4538 | break; |
| 4539 | |
| 4540 | case 223: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4541 | #line 2210 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4542 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4543 | yyval.ValIDVal = ValID::create(ConstantInt::getFalse()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4544 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4545 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4546 | break; |
| 4547 | |
| 4548 | case 224: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4549 | #line 2214 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4550 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4551 | yyval.ValIDVal = ValID::createNull(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4552 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4553 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4554 | break; |
| 4555 | |
| 4556 | case 225: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4557 | #line 2218 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4558 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4559 | yyval.ValIDVal = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4560 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4561 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4562 | break; |
| 4563 | |
| 4564 | case 226: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4565 | #line 2222 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4566 | { // A vector zero constant. |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4567 | yyval.ValIDVal = ValID::createZeroInit(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4568 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4569 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4570 | break; |
| 4571 | |
| 4572 | case 227: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4573 | #line 2226 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4574 | { // Nonempty unsized packed vector |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4575 | const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); |
| 4576 | int NumElements = yyvsp[-1].ConstVector->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4577 | |
| 4578 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 4579 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4580 | HandleUpRefs( |
| 4581 | PackedType::get( |
| 4582 | ETy, |
| 4583 | NumElements) |
| 4584 | ) |
| 4585 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4586 | |
| 4587 | // Verify all elements are correct type! |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4588 | for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { |
| 4589 | if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4590 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4591 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4592 | (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4593 | } |
| 4594 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4595 | yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector)); |
| 4596 | delete PTy; delete yyvsp[-1].ConstVector; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4597 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4598 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4599 | break; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4600 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4601 | case 228: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4602 | #line 2251 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4603 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4604 | yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4605 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4606 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4607 | break; |
| 4608 | |
| 4609 | case 229: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4610 | #line 2255 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4611 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4612 | char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); |
| 4613 | std::string AsmStr = std::string(yyvsp[-2].StrVal, End); |
| 4614 | End = UnEscapeLexed(yyvsp[0].StrVal, true); |
| 4615 | std::string Constraints = std::string(yyvsp[0].StrVal, End); |
| 4616 | yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); |
| 4617 | free(yyvsp[-2].StrVal); |
| 4618 | free(yyvsp[0].StrVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4619 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4620 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4621 | break; |
| 4622 | |
| 4623 | case 230: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4624 | #line 2269 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4625 | { // Is it an integer reference...? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4626 | yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4627 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4628 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4629 | break; |
| 4630 | |
| 4631 | case 231: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4632 | #line 2273 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4633 | { // Is it a named reference...? |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4634 | yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4635 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4636 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4637 | break; |
| 4638 | |
| 4639 | case 234: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4640 | #line 2285 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4641 | { |
| 4642 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4643 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 4644 | yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); |
| 4645 | delete yyvsp[-1].TypeVal; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4646 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4647 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4648 | break; |
| 4649 | |
| 4650 | case 235: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4651 | #line 2294 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4652 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4653 | yyval.FunctionVal = yyvsp[-1].FunctionVal; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4654 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4655 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4656 | break; |
| 4657 | |
| 4658 | case 236: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4659 | #line 2298 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4660 | { // Do not allow functions with 0 basic blocks |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4661 | yyval.FunctionVal = yyvsp[-1].FunctionVal; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4662 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4663 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4664 | break; |
| 4665 | |
| 4666 | case 237: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4667 | #line 2307 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4668 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4669 | setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4670 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4671 | InsertValue(yyvsp[0].TermInstVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4672 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4673 | yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); |
| 4674 | InsertValue(yyvsp[-2].BasicBlockVal); |
| 4675 | yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4676 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4677 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4678 | break; |
| 4679 | |
| 4680 | case 238: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4681 | #line 2318 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4682 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4683 | if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4684 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4685 | if (CI2->getParent() == 0) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4686 | yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2); |
| 4687 | yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); |
| 4688 | yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4689 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4690 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4691 | break; |
| 4692 | |
| 4693 | case 239: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4694 | #line 2327 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4695 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4696 | yyval.BasicBlockVal = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4697 | CHECK_FOR_ERROR |
| 4698 | |
| 4699 | // Make sure to move the basic block to the correct location in the |
| 4700 | // function, instead of leaving it inserted wherever it was first |
| 4701 | // referenced. |
| 4702 | Function::BasicBlockListType &BBL = |
| 4703 | CurFun.CurrentFunction->getBasicBlockList(); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4704 | BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4705 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4706 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4707 | break; |
| 4708 | |
| 4709 | case 240: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4710 | #line 2339 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4711 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4712 | yyval.BasicBlockVal = getBBVal(ValID::create(yyvsp[0].StrVal), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4713 | CHECK_FOR_ERROR |
| 4714 | |
| 4715 | // Make sure to move the basic block to the correct location in the |
| 4716 | // function, instead of leaving it inserted wherever it was first |
| 4717 | // referenced. |
| 4718 | Function::BasicBlockListType &BBL = |
| 4719 | CurFun.CurrentFunction->getBasicBlockList(); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4720 | BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4721 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4722 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4723 | break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4724 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4725 | case 241: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4726 | #line 2352 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4727 | { // Return with a result... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4728 | yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4729 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4730 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4731 | break; |
| 4732 | |
| 4733 | case 242: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4734 | #line 2356 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4735 | { // Return with no result... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4736 | yyval.TermInstVal = new ReturnInst(); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4737 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4738 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4739 | break; |
| 4740 | |
| 4741 | case 243: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4742 | #line 2360 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4743 | { // Unconditional Branch... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4744 | BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4745 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4746 | yyval.TermInstVal = new BranchInst(tmpBB); |
| 4747 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4748 | break; |
| 4749 | |
| 4750 | case 244: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4751 | #line 2365 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4752 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4753 | assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?"); |
| 4754 | BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4755 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4756 | BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4757 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4758 | Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4759 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4760 | yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 4761 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4762 | break; |
| 4763 | |
| 4764 | case 245: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4765 | #line 2375 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4766 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4767 | Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4768 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4769 | BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4770 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4771 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size()); |
| 4772 | yyval.TermInstVal = S; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4773 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4774 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(), |
| 4775 | E = yyvsp[-1].JumpTable->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4776 | for (; I != E; ++I) { |
| 4777 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4778 | S->addCase(CI, I->second); |
| 4779 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4780 | GEN_ERROR("Switch case is constant, but not a simple integer!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4781 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4782 | delete yyvsp[-1].JumpTable; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4783 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4784 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4785 | break; |
| 4786 | |
| 4787 | case 246: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4788 | #line 2394 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4789 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4790 | Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4791 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4792 | BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4793 | CHECK_FOR_ERROR |
| 4794 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4795 | yyval.TermInstVal = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4796 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4797 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4798 | break; |
| 4799 | |
| 4800 | case 247: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4801 | #line 2404 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4802 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4803 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4804 | // Handle the short syntax |
| 4805 | const PointerType *PFTy = 0; |
| 4806 | const FunctionType *Ty = 0; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4807 | if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4808 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 4809 | // Pull out the types of all of the arguments... |
| 4810 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4811 | FunctionType::ParamAttrsList ParamAttrs; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4812 | ParamAttrs.push_back(yyvsp[-6].ParamAttrs); |
| 4813 | 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] | 4814 | const Type *Ty = I->Val->getType(); |
| 4815 | if (Ty == Type::VoidTy) |
| 4816 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 4817 | ParamTypes.push_back(Ty); |
| 4818 | ParamAttrs.push_back(I->Attrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4819 | } |
| 4820 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4821 | Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4822 | PFTy = PointerType::get(Ty); |
| 4823 | } |
| 4824 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4825 | 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] | 4826 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4827 | BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4828 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4829 | BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4830 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4831 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4832 | // Check the arguments |
| 4833 | ValueList Args; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4834 | if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4835 | // Make sure no arguments is a good thing! |
| 4836 | if (Ty->getNumParams() != 0) |
| 4837 | GEN_ERROR("No arguments passed to a function that " |
| 4838 | "expects arguments!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4839 | } else { // Has arguments? |
| 4840 | // Loop through FunctionType's arguments and ensure they are specified |
| 4841 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4842 | FunctionType::param_iterator I = Ty->param_begin(); |
| 4843 | FunctionType::param_iterator E = Ty->param_end(); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4844 | ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4845 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4846 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 4847 | if (ArgI->Val->getType() != *I) |
| 4848 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4849 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4850 | Args.push_back(ArgI->Val); |
| 4851 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4852 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4853 | if (Ty->isVarArg()) { |
| 4854 | if (I == E) |
| 4855 | for (; ArgI != ArgE; ++ArgI) |
| 4856 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 4857 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4858 | GEN_ERROR("Invalid number of parameters detected!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4859 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4860 | |
| 4861 | // Create the InvokeInst |
| 4862 | InvokeInst *II = new InvokeInst(V, Normal, Except, Args); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4863 | II->setCallingConv(yyvsp[-12].UIntVal); |
| 4864 | yyval.TermInstVal = II; |
| 4865 | delete yyvsp[-8].ValueRefList; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4866 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4867 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4868 | break; |
| 4869 | |
| 4870 | case 248: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4871 | #line 2470 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4872 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4873 | yyval.TermInstVal = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4874 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4875 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4876 | break; |
| 4877 | |
| 4878 | case 249: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4879 | #line 2474 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4880 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4881 | yyval.TermInstVal = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4882 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4883 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4884 | break; |
| 4885 | |
| 4886 | case 250: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4887 | #line 2481 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4888 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4889 | yyval.JumpTable = yyvsp[-5].JumpTable; |
| 4890 | Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4891 | CHECK_FOR_ERROR |
| 4892 | if (V == 0) |
| 4893 | GEN_ERROR("May only switch on a constant pool value!"); |
| 4894 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4895 | BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4896 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4897 | yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); |
| 4898 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4899 | break; |
| 4900 | |
| 4901 | case 251: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4902 | #line 2492 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4903 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4904 | yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 4905 | Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4906 | CHECK_FOR_ERROR |
| 4907 | |
| 4908 | if (V == 0) |
| 4909 | GEN_ERROR("May only switch on a constant pool value!"); |
| 4910 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4911 | BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4912 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4913 | yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); |
| 4914 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4915 | break; |
| 4916 | |
| 4917 | case 252: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4918 | #line 2505 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4919 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4920 | // Is this definition named?? if so, assign the name... |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4921 | setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4922 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4923 | InsertValue(yyvsp[0].InstVal); |
| 4924 | yyval.InstVal = yyvsp[0].InstVal; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4925 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4926 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4927 | break; |
| 4928 | |
| 4929 | case 253: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4930 | #line 2514 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4931 | { // Used for PHI nodes |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4932 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4933 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription()); |
| 4934 | yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 4935 | Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4936 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4937 | BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4938 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4939 | yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB)); |
| 4940 | delete yyvsp[-5].TypeVal; |
| 4941 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4942 | break; |
| 4943 | |
| 4944 | case 254: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4945 | #line 2525 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4946 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4947 | yyval.PHIList = yyvsp[-6].PHIList; |
| 4948 | Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4949 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4950 | BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4951 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4952 | yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB)); |
| 4953 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4954 | break; |
| 4955 | |
| 4956 | case 255: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4957 | #line 2535 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4958 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4959 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4960 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4961 | // Used for call and invoke instructions |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4962 | yyval.ValueRefList = new ValueRefList(); |
| 4963 | ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal); |
| 4964 | yyval.ValueRefList->push_back(E); |
| 4965 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4966 | break; |
| 4967 | |
| 4968 | case 256: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4969 | #line 2543 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4970 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4971 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4972 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 4973 | yyval.ValueRefList = yyvsp[-4].ValueRefList; |
| 4974 | ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal); |
| 4975 | yyval.ValueRefList->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4976 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4977 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4978 | break; |
| 4979 | |
| 4980 | case 257: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4981 | #line 2551 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4982 | { yyval.ValueRefList = new ValueRefList(); } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4983 | break; |
| 4984 | |
| 4985 | case 258: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4986 | #line 2554 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4987 | { yyval.ValueList = new std::vector<Value*>(); } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4988 | break; |
| 4989 | |
| 4990 | case 259: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4991 | #line 2555 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4992 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4993 | yyval.ValueList = yyvsp[-2].ValueList; |
| 4994 | yyval.ValueList->push_back(yyvsp[0].ValueVal); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4995 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 4996 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4997 | break; |
| 4998 | |
| 4999 | case 260: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5000 | #line 2562 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5001 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5002 | yyval.BoolVal = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5003 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5004 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5005 | break; |
| 5006 | |
| 5007 | case 261: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5008 | #line 2566 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5009 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5010 | yyval.BoolVal = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5011 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5012 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5013 | break; |
| 5014 | |
| 5015 | case 262: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5016 | #line 2571 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5017 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5018 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5019 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 5020 | if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && |
| 5021 | !isa<PackedType>((*yyvsp[-3].TypeVal).get())) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5022 | GEN_ERROR( |
| 5023 | "Arithmetic operator requires integer, FP, or packed operands!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5024 | if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) && |
| 5025 | (yyvsp[-4].BinaryOpVal == Instruction::URem || |
| 5026 | yyvsp[-4].BinaryOpVal == Instruction::SRem || |
| 5027 | yyvsp[-4].BinaryOpVal == Instruction::FRem)) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5028 | GEN_ERROR("U/S/FRem not supported on packed types!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5029 | Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5030 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5031 | Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5032 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5033 | yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2); |
| 5034 | if (yyval.InstVal == 0) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5035 | GEN_ERROR("binary operator returned null!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5036 | delete yyvsp[-3].TypeVal; |
| 5037 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5038 | break; |
| 5039 | |
| 5040 | case 263: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5041 | #line 2592 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5042 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5043 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5044 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 5045 | if (!(*yyvsp[-3].TypeVal)->isInteger()) { |
| 5046 | if (!isa<PackedType>(yyvsp[-3].TypeVal->get()) || |
| 5047 | !cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5048 | GEN_ERROR("Logical operator requires integral operands!"); |
| 5049 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5050 | Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5051 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5052 | Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5053 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5054 | yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); |
| 5055 | if (yyval.InstVal == 0) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5056 | GEN_ERROR("binary operator returned null!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5057 | delete yyvsp[-3].TypeVal; |
| 5058 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5059 | break; |
| 5060 | |
| 5061 | case 264: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5062 | #line 2609 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5063 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5064 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5065 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 5066 | if (isa<PackedType>((*yyvsp[-3].TypeVal).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 5067 | GEN_ERROR("Packed types not supported by icmp instruction"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5068 | Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5069 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5070 | Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5071 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5072 | yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2); |
| 5073 | if (yyval.InstVal == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5074 | GEN_ERROR("icmp operator returned null!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5075 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5076 | break; |
| 5077 | |
| 5078 | case 265: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5079 | #line 2622 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5080 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5081 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5082 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 5083 | if (isa<PackedType>((*yyvsp[-3].TypeVal).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 5084 | GEN_ERROR("Packed types not supported by fcmp instruction"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5085 | Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5086 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5087 | Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5088 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5089 | yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2); |
| 5090 | if (yyval.InstVal == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5091 | GEN_ERROR("fcmp operator returned null!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5092 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5093 | break; |
| 5094 | |
| 5095 | case 266: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5096 | #line 2635 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5097 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5098 | if (yyvsp[0].ValueVal->getType() != Type::Int8Ty) |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5099 | GEN_ERROR("Shift amount must be i8 type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5100 | if (!yyvsp[-2].ValueVal->getType()->isInteger()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5101 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 5102 | CHECK_FOR_ERROR; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5103 | 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] | 5104 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5105 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5106 | break; |
| 5107 | |
| 5108 | case 267: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5109 | #line 2644 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5110 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5111 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5112 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 5113 | Value* Val = yyvsp[-2].ValueVal; |
| 5114 | const Type* DestTy = yyvsp[0].TypeVal->get(); |
| 5115 | if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy)) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5116 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5117 | Val->getType()->getDescription() + "' to '" + |
| 5118 | DestTy->getDescription() + "'!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5119 | yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy); |
| 5120 | delete yyvsp[0].TypeVal; |
| 5121 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5122 | break; |
| 5123 | |
| 5124 | case 268: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5125 | #line 2656 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5126 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5127 | if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5128 | GEN_ERROR("select condition must be boolean!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5129 | if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5130 | GEN_ERROR("select value types should match!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5131 | 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] | 5132 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5133 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5134 | break; |
| 5135 | |
| 5136 | case 269: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5137 | #line 2664 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5138 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5139 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5140 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 5141 | yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); |
| 5142 | delete yyvsp[0].TypeVal; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5143 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5144 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5145 | break; |
| 5146 | |
| 5147 | case 270: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5148 | #line 2671 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5149 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5150 | if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5151 | GEN_ERROR("Invalid extractelement operands!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5152 | yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5153 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5154 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5155 | break; |
| 5156 | |
| 5157 | case 271: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5158 | #line 2677 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5159 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5160 | if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5161 | GEN_ERROR("Invalid insertelement operands!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5162 | 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] | 5163 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5164 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5165 | break; |
| 5166 | |
| 5167 | case 272: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5168 | #line 2683 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5169 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5170 | if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5171 | GEN_ERROR("Invalid shufflevector operands!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5172 | 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] | 5173 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5174 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5175 | break; |
| 5176 | |
| 5177 | case 273: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5178 | #line 2689 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5179 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5180 | const Type *Ty = yyvsp[0].PHIList->front().first->getType(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5181 | if (!Ty->isFirstClassType()) |
| 5182 | GEN_ERROR("PHI node operands must be of first class type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5183 | yyval.InstVal = new PHINode(Ty); |
| 5184 | ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size()); |
| 5185 | while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) { |
| 5186 | if (yyvsp[0].PHIList->front().first->getType() != Ty) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5187 | GEN_ERROR("All elements of a PHI node must be of the same type!"); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5188 | cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second); |
| 5189 | yyvsp[0].PHIList->pop_front(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5190 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5191 | delete yyvsp[0].PHIList; // Free the list... |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5192 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5193 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5194 | break; |
| 5195 | |
| 5196 | case 274: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5197 | #line 2705 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5198 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5199 | |
| 5200 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5201 | const PointerType *PFTy = 0; |
| 5202 | const FunctionType *Ty = 0; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5203 | if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5204 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5205 | // Pull out the types of all of the arguments... |
| 5206 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5207 | FunctionType::ParamAttrsList ParamAttrs; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5208 | ParamAttrs.push_back(yyvsp[0].ParamAttrs); |
| 5209 | 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] | 5210 | const Type *Ty = I->Val->getType(); |
| 5211 | if (Ty == Type::VoidTy) |
| 5212 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5213 | ParamTypes.push_back(Ty); |
| 5214 | ParamAttrs.push_back(I->Attrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5215 | } |
| 5216 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5217 | Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, ParamAttrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5218 | PFTy = PointerType::get(Ty); |
| 5219 | } |
| 5220 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5221 | 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] | 5222 | CHECK_FOR_ERROR |
| 5223 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5224 | // Check the arguments |
| 5225 | ValueList Args; |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5226 | if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5227 | // Make sure no arguments is a good thing! |
| 5228 | if (Ty->getNumParams() != 0) |
| 5229 | GEN_ERROR("No arguments passed to a function that " |
| 5230 | "expects arguments!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5231 | } else { // Has arguments? |
| 5232 | // Loop through FunctionType's arguments and ensure they are specified |
| 5233 | // correctly! |
| 5234 | // |
| 5235 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5236 | FunctionType::param_iterator E = Ty->param_end(); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5237 | ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5238 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5239 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5240 | if (ArgI->Val->getType() != *I) |
| 5241 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5242 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5243 | Args.push_back(ArgI->Val); |
| 5244 | } |
| 5245 | if (Ty->isVarArg()) { |
| 5246 | if (I == E) |
| 5247 | for (; ArgI != ArgE; ++ArgI) |
| 5248 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 5249 | } else if (I != E || ArgI != ArgE) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5250 | GEN_ERROR("Invalid number of parameters detected!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5251 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5252 | // Create the call node |
| 5253 | CallInst *CI = new CallInst(V, Args); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5254 | CI->setTailCall(yyvsp[-7].BoolVal); |
| 5255 | CI->setCallingConv(yyvsp[-6].UIntVal); |
| 5256 | yyval.InstVal = CI; |
| 5257 | delete yyvsp[-2].ValueRefList; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5258 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5259 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5260 | break; |
| 5261 | |
| 5262 | case 275: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5263 | #line 2767 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5264 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5265 | yyval.InstVal = yyvsp[0].InstVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5266 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5267 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5268 | break; |
| 5269 | |
| 5270 | case 276: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5271 | #line 2772 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5272 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5273 | yyval.BoolVal = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5274 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5275 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5276 | break; |
| 5277 | |
| 5278 | case 277: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5279 | #line 2776 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5280 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5281 | yyval.BoolVal = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5282 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5283 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5284 | break; |
| 5285 | |
| 5286 | case 278: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5287 | #line 2783 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5288 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5289 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5290 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 5291 | yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); |
| 5292 | delete yyvsp[-1].TypeVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5293 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5294 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5295 | break; |
| 5296 | |
| 5297 | case 279: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5298 | #line 2790 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5299 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5300 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5301 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); |
| 5302 | Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5303 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5304 | yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); |
| 5305 | delete yyvsp[-4].TypeVal; |
| 5306 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5307 | break; |
| 5308 | |
| 5309 | case 280: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5310 | #line 2798 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5311 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5312 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5313 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 5314 | yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); |
| 5315 | delete yyvsp[-1].TypeVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5316 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5317 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5318 | break; |
| 5319 | |
| 5320 | case 281: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5321 | #line 2805 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5322 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5323 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5324 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); |
| 5325 | Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5326 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5327 | yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); |
| 5328 | delete yyvsp[-4].TypeVal; |
| 5329 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5330 | break; |
| 5331 | |
| 5332 | case 282: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5333 | #line 2813 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5334 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5335 | if (!isa<PointerType>(yyvsp[0].ValueVal->getType())) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5336 | GEN_ERROR("Trying to free nonpointer type " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5337 | yyvsp[0].ValueVal->getType()->getDescription() + "!"); |
| 5338 | yyval.InstVal = new FreeInst(yyvsp[0].ValueVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5339 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5340 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5341 | break; |
| 5342 | |
| 5343 | case 283: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5344 | #line 2821 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5345 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5346 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5347 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 5348 | if (!isa<PointerType>(yyvsp[-1].TypeVal->get())) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5349 | GEN_ERROR("Can't load from nonpointer type: " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5350 | (*yyvsp[-1].TypeVal)->getDescription()); |
| 5351 | if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType()) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5352 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5353 | (*yyvsp[-1].TypeVal)->getDescription()); |
| 5354 | Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5355 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5356 | yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal); |
| 5357 | delete yyvsp[-1].TypeVal; |
| 5358 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5359 | break; |
| 5360 | |
| 5361 | case 284: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5362 | #line 2835 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5363 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5364 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5365 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 5366 | const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5367 | if (!PT) |
| 5368 | GEN_ERROR("Can't store to a nonpointer type: " + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5369 | (*yyvsp[-1].TypeVal)->getDescription()); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5370 | const Type *ElTy = PT->getElementType(); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5371 | if (ElTy != yyvsp[-3].ValueVal->getType()) |
| 5372 | GEN_ERROR("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() + |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5373 | "' into space of type '" + ElTy->getDescription() + "'!"); |
| 5374 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5375 | Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5376 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5377 | yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, tmpVal, yyvsp[-5].BoolVal); |
| 5378 | delete yyvsp[-1].TypeVal; |
| 5379 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5380 | break; |
| 5381 | |
| 5382 | case 285: |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5383 | #line 2852 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5384 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5385 | if (!UpRefs.empty()) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5386 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 5387 | if (!isa<PointerType>(yyvsp[-2].TypeVal->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5388 | GEN_ERROR("getelementptr insn requires pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5389 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5390 | if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5391 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5392 | (*yyvsp[-2].TypeVal)->getDescription()+ "'!"); |
| 5393 | Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5394 | CHECK_FOR_ERROR |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5395 | yyval.InstVal = new GetElementPtrInst(tmpVal, *yyvsp[0].ValueList); |
| 5396 | delete yyvsp[-2].TypeVal; |
| 5397 | delete yyvsp[0].ValueList; |
| 5398 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5399 | break; |
| 5400 | |
| 5401 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5402 | } |
| 5403 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5404 | /* Line 1016 of /usr/local/share/bison/yacc.c. */ |
| 5405 | #line 5406 "llvmAsmParser.tab.c" |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5406 | |
| 5407 | yyvsp -= yylen; |
| 5408 | yyssp -= yylen; |
| 5409 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5410 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5411 | #if YYDEBUG |
| 5412 | if (yydebug) |
| 5413 | { |
| 5414 | short *yyssp1 = yyss - 1; |
| 5415 | YYFPRINTF (stderr, "state stack now"); |
| 5416 | while (yyssp1 != yyssp) |
| 5417 | YYFPRINTF (stderr, " %d", *++yyssp1); |
| 5418 | YYFPRINTF (stderr, "\n"); |
| 5419 | } |
| 5420 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5421 | |
| 5422 | *++yyvsp = yyval; |
| 5423 | |
| 5424 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5425 | /* Now `shift' the result of the reduction. Determine what state |
| 5426 | that goes to, based on the state we popped back to and the rule |
| 5427 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5428 | |
| 5429 | yyn = yyr1[yyn]; |
| 5430 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5431 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5432 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5433 | yystate = yytable[yystate]; |
| 5434 | else |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5435 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5436 | |
| 5437 | goto yynewstate; |
| 5438 | |
| 5439 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5440 | /*------------------------------------. |
| 5441 | | yyerrlab -- here on detecting error | |
| 5442 | `------------------------------------*/ |
| 5443 | yyerrlab: |
| 5444 | /* If not already recovering from an error, report this error. */ |
| 5445 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5446 | { |
| 5447 | ++yynerrs; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5448 | #if YYERROR_VERBOSE |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5449 | yyn = yypact[yystate]; |
Chris Lattner | 0fab59c | 2007-01-12 18:33:30 +0000 | [diff] [blame] | 5450 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5451 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5452 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5453 | YYSIZE_T yysize = 0; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5454 | int yytype = YYTRANSLATE (yychar); |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5455 | char *yymsg; |
| 5456 | int yyx, yycount; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5457 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5458 | yycount = 0; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5459 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5460 | YYCHECK. */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5461 | for (yyx = yyn < 0 ? -yyn : 0; |
| 5462 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5463 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5464 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; |
| 5465 | yysize += yystrlen ("parse error, unexpected ") + 1; |
| 5466 | yysize += yystrlen (yytname[yytype]); |
| 5467 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5468 | if (yymsg != 0) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5469 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5470 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); |
| 5471 | yyp = yystpcpy (yyp, yytname[yytype]); |
| 5472 | |
| 5473 | if (yycount < 5) |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5474 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5475 | yycount = 0; |
| 5476 | for (yyx = yyn < 0 ? -yyn : 0; |
| 5477 | yyx < (int) (sizeof (yytname) / sizeof (char *)); |
| 5478 | yyx++) |
| 5479 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5480 | { |
| 5481 | const char *yyq = ! yycount ? ", expecting " : " or "; |
| 5482 | yyp = yystpcpy (yyp, yyq); |
| 5483 | yyp = yystpcpy (yyp, yytname[yyx]); |
| 5484 | yycount++; |
| 5485 | } |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5486 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5487 | yyerror (yymsg); |
| 5488 | YYSTACK_FREE (yymsg); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5489 | } |
| 5490 | else |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5491 | yyerror ("parse error; also virtual memory exhausted"); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5492 | } |
| 5493 | else |
| 5494 | #endif /* YYERROR_VERBOSE */ |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5495 | yyerror ("parse error"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5496 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5497 | goto yyerrlab1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5498 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5499 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5500 | /*----------------------------------------------------. |
| 5501 | | yyerrlab1 -- error raised explicitly by an action. | |
| 5502 | `----------------------------------------------------*/ |
| 5503 | yyerrlab1: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5504 | if (yyerrstatus == 3) |
| 5505 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5506 | /* If just tried and failed to reuse lookahead token after an |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5507 | error, discard it. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5508 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5509 | /* Return failure if at end of input. */ |
| 5510 | if (yychar == YYEOF) |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5511 | { |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5512 | /* Pop the error token. */ |
| 5513 | YYPOPSTACK; |
| 5514 | /* Pop the rest of the stack. */ |
| 5515 | while (yyssp > yyss) |
| 5516 | { |
| 5517 | YYDPRINTF ((stderr, "Error: popping ")); |
| 5518 | YYDSYMPRINT ((stderr, |
| 5519 | yystos[*yyssp], |
| 5520 | *yyvsp)); |
| 5521 | YYDPRINTF ((stderr, "\n")); |
| 5522 | yydestruct (yystos[*yyssp], *yyvsp); |
| 5523 | YYPOPSTACK; |
| 5524 | } |
| 5525 | YYABORT; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5526 | } |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5527 | |
| 5528 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
| 5529 | yychar, yytname[yychar1])); |
| 5530 | yydestruct (yychar1, yylval); |
| 5531 | yychar = YYEMPTY; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5532 | } |
| 5533 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5534 | /* Else will try to reuse lookahead token after shifting the error |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5535 | token. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5536 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5537 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5538 | |
| 5539 | for (;;) |
| 5540 | { |
| 5541 | yyn = yypact[yystate]; |
| 5542 | if (yyn != YYPACT_NINF) |
| 5543 | { |
| 5544 | yyn += YYTERROR; |
| 5545 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5546 | { |
| 5547 | yyn = yytable[yyn]; |
| 5548 | if (0 < yyn) |
| 5549 | break; |
| 5550 | } |
| 5551 | } |
| 5552 | |
| 5553 | /* Pop the current state because it cannot handle the error token. */ |
| 5554 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5555 | YYABORT; |
| 5556 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5557 | YYDPRINTF ((stderr, "Error: popping ")); |
| 5558 | YYDSYMPRINT ((stderr, |
| 5559 | yystos[*yyssp], *yyvsp)); |
| 5560 | YYDPRINTF ((stderr, "\n")); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5561 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5562 | yydestruct (yystos[yystate], *yyvsp); |
| 5563 | yyvsp--; |
| 5564 | yystate = *--yyssp; |
| 5565 | |
| 5566 | |
| 5567 | #if YYDEBUG |
| 5568 | if (yydebug) |
| 5569 | { |
| 5570 | short *yyssp1 = yyss - 1; |
| 5571 | YYFPRINTF (stderr, "Error: state stack now"); |
| 5572 | while (yyssp1 != yyssp) |
| 5573 | YYFPRINTF (stderr, " %d", *++yyssp1); |
| 5574 | YYFPRINTF (stderr, "\n"); |
| 5575 | } |
| 5576 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5577 | } |
| 5578 | |
| 5579 | if (yyn == YYFINAL) |
| 5580 | YYACCEPT; |
| 5581 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5582 | YYDPRINTF ((stderr, "Shifting error token, ")); |
| 5583 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5584 | *++yyvsp = yylval; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5585 | |
| 5586 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5587 | yystate = yyn; |
| 5588 | goto yynewstate; |
| 5589 | |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 5590 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5591 | /*-------------------------------------. |
| 5592 | | yyacceptlab -- YYACCEPT comes here. | |
| 5593 | `-------------------------------------*/ |
| 5594 | yyacceptlab: |
| 5595 | yyresult = 0; |
| 5596 | goto yyreturn; |
| 5597 | |
| 5598 | /*-----------------------------------. |
| 5599 | | yyabortlab -- YYABORT comes here. | |
| 5600 | `-----------------------------------*/ |
| 5601 | yyabortlab: |
| 5602 | yyresult = 1; |
| 5603 | goto yyreturn; |
| 5604 | |
| 5605 | #ifndef yyoverflow |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5606 | /*----------------------------------------------. |
| 5607 | | yyoverflowlab -- parser overflow comes here. | |
| 5608 | `----------------------------------------------*/ |
| 5609 | yyoverflowlab: |
| 5610 | yyerror ("parser stack overflow"); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5611 | yyresult = 2; |
| 5612 | /* Fall through. */ |
Chris Lattner | b25c4ca | 2007-01-15 02:12:07 +0000 | [diff] [blame] | 5613 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5614 | |
| 5615 | yyreturn: |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5616 | #ifndef yyoverflow |
| 5617 | if (yyss != yyssa) |
| 5618 | YYSTACK_FREE (yyss); |
| 5619 | #endif |
| 5620 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5621 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5622 | |
| 5623 | |
Jeff Cohen | 361c3ef | 2007-01-21 19:19:31 +0000 | [diff] [blame] | 5624 | #line 2869 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5625 | |
| 5626 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5627 | // common code from the two 'RunVMAsmParser' functions |
| 5628 | static Module* RunParser(Module * M) { |
| 5629 | |
| 5630 | llvmAsmlineno = 1; // Reset the current line number... |
| 5631 | CurModule.CurrentModule = M; |
| 5632 | #if YYDEBUG |
| 5633 | yydebug = Debug; |
| 5634 | #endif |
| 5635 | |
| 5636 | // Check to make sure the parser succeeded |
| 5637 | if (yyparse()) { |
| 5638 | if (ParserResult) |
| 5639 | delete ParserResult; |
| 5640 | return 0; |
| 5641 | } |
| 5642 | |
| 5643 | // Check to make sure that parsing produced a result |
| 5644 | if (!ParserResult) |
| 5645 | return 0; |
| 5646 | |
| 5647 | // Reset ParserResult variable while saving its value for the result. |
| 5648 | Module *Result = ParserResult; |
| 5649 | ParserResult = 0; |
| 5650 | |
| 5651 | return Result; |
| 5652 | } |
| 5653 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5654 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5655 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5656 | // TODO: column number in exception |
| 5657 | if (TheParseError) |
| 5658 | TheParseError->setError(CurFilename, message, LineNo); |
| 5659 | TriggerError = 1; |
| 5660 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5661 | |
| 5662 | int yyerror(const char *ErrorMsg) { |
| 5663 | std::string where |
| 5664 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5665 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5666 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5667 | if (yychar == YYEMPTY || yychar == 0) |
| 5668 | errMsg += "end-of-file."; |
| 5669 | else |
| 5670 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5671 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5672 | return 0; |
| 5673 | } |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 5674 | |