| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 2.1.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3 | /* Skeleton parser for Yacc-like parsing with Bison, | 
|  | 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | 
| Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 5 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 6 | This program is free software; you can redistribute it and/or modify | 
|  | 7 | it under the terms of the GNU General Public License as published by | 
|  | 8 | the Free Software Foundation; either version 2, or (at your option) | 
|  | 9 | any later version. | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 10 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 11 | This program is distributed in the hope that it will be useful, | 
|  | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 14 | GNU General Public License for more details. | 
|  | 15 |  | 
|  | 16 | You should have received a copy of the GNU General Public License | 
|  | 17 | along with this program; if not, write to the Free Software | 
|  | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | 
|  | 19 | Boston, MA 02110-1301, USA.  */ | 
|  | 20 |  | 
|  | 21 | /* As a special exception, when this file is copied by Bison into a | 
|  | 22 | Bison output file, you may use that output file without restriction. | 
|  | 23 | This special exception was added by the Free Software Foundation | 
|  | 24 | in version 1.24 of Bison.  */ | 
|  | 25 |  | 
|  | 26 | /* Written by Richard Stallman by simplifying the original so called | 
|  | 27 | ``semantic'' parser.  */ | 
|  | 28 |  | 
|  | 29 | /* All symbols defined below should begin with yy or YY, to avoid | 
|  | 30 | infringing on user name space.  This should be done even for local | 
|  | 31 | variables, as they might otherwise be expanded by user macros. | 
|  | 32 | There are some unavoidable exceptions within include files to | 
|  | 33 | define necessary library symbols; they are noted "INFRINGES ON | 
|  | 34 | USER NAME SPACE" below.  */ | 
|  | 35 |  | 
|  | 36 | /* Identify Bison output.  */ | 
|  | 37 | #define YYBISON 1 | 
|  | 38 |  | 
|  | 39 | /* Bison version.  */ | 
|  | 40 | #define YYBISON_VERSION "2.1" | 
|  | 41 |  | 
|  | 42 | /* Skeleton name.  */ | 
|  | 43 | #define YYSKELETON_NAME "yacc.c" | 
|  | 44 |  | 
|  | 45 | /* Pure parsers.  */ | 
|  | 46 | #define YYPURE 0 | 
|  | 47 |  | 
|  | 48 | /* Using locations.  */ | 
|  | 49 | #define YYLSP_NEEDED 0 | 
|  | 50 |  | 
|  | 51 | /* Substitute the variable and function names.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 52 | #define yyparse llvmAsmparse | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 53 | #define yylex   llvmAsmlex | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 54 | #define yyerror llvmAsmerror | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 55 | #define yylval  llvmAsmlval | 
|  | 56 | #define yychar  llvmAsmchar | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 57 | #define yydebug llvmAsmdebug | 
|  | 58 | #define yynerrs llvmAsmnerrs | 
|  | 59 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 60 |  | 
|  | 61 | /* Tokens.  */ | 
|  | 62 | #ifndef YYTOKENTYPE | 
|  | 63 | # define YYTOKENTYPE | 
|  | 64 | /* Put the tokens into the symbol table, so that GDB and other debuggers | 
|  | 65 | know about them.  */ | 
|  | 66 | enum yytokentype { | 
|  | 67 | ESINT64VAL = 258, | 
|  | 68 | EUINT64VAL = 259, | 
|  | 69 | ESAPINTVAL = 260, | 
|  | 70 | EUAPINTVAL = 261, | 
|  | 71 | LOCALVAL_ID = 262, | 
|  | 72 | GLOBALVAL_ID = 263, | 
|  | 73 | FPVAL = 264, | 
|  | 74 | VOID = 265, | 
|  | 75 | INTTYPE = 266, | 
|  | 76 | FLOAT = 267, | 
|  | 77 | DOUBLE = 268, | 
|  | 78 | LABEL = 269, | 
|  | 79 | TYPE = 270, | 
|  | 80 | LOCALVAR = 271, | 
|  | 81 | GLOBALVAR = 272, | 
|  | 82 | LABELSTR = 273, | 
|  | 83 | STRINGCONSTANT = 274, | 
|  | 84 | ATSTRINGCONSTANT = 275, | 
|  | 85 | IMPLEMENTATION = 276, | 
|  | 86 | ZEROINITIALIZER = 277, | 
|  | 87 | TRUETOK = 278, | 
|  | 88 | FALSETOK = 279, | 
|  | 89 | BEGINTOK = 280, | 
|  | 90 | ENDTOK = 281, | 
|  | 91 | DECLARE = 282, | 
|  | 92 | DEFINE = 283, | 
|  | 93 | GLOBAL = 284, | 
|  | 94 | CONSTANT = 285, | 
|  | 95 | SECTION = 286, | 
|  | 96 | VOLATILE = 287, | 
|  | 97 | TO = 288, | 
|  | 98 | DOTDOTDOT = 289, | 
|  | 99 | NULL_TOK = 290, | 
|  | 100 | UNDEF = 291, | 
|  | 101 | INTERNAL = 292, | 
|  | 102 | LINKONCE = 293, | 
|  | 103 | WEAK = 294, | 
|  | 104 | APPENDING = 295, | 
|  | 105 | DLLIMPORT = 296, | 
|  | 106 | DLLEXPORT = 297, | 
|  | 107 | EXTERN_WEAK = 298, | 
|  | 108 | OPAQUE = 299, | 
|  | 109 | EXTERNAL = 300, | 
|  | 110 | TARGET = 301, | 
|  | 111 | TRIPLE = 302, | 
|  | 112 | ALIGN = 303, | 
|  | 113 | DEPLIBS = 304, | 
|  | 114 | CALL = 305, | 
|  | 115 | TAIL = 306, | 
|  | 116 | ASM_TOK = 307, | 
|  | 117 | MODULE = 308, | 
|  | 118 | SIDEEFFECT = 309, | 
|  | 119 | CC_TOK = 310, | 
|  | 120 | CCC_TOK = 311, | 
|  | 121 | FASTCC_TOK = 312, | 
|  | 122 | COLDCC_TOK = 313, | 
|  | 123 | X86_STDCALLCC_TOK = 314, | 
|  | 124 | X86_FASTCALLCC_TOK = 315, | 
|  | 125 | DATALAYOUT = 316, | 
|  | 126 | RET = 317, | 
|  | 127 | BR = 318, | 
|  | 128 | SWITCH = 319, | 
|  | 129 | INVOKE = 320, | 
|  | 130 | UNWIND = 321, | 
|  | 131 | UNREACHABLE = 322, | 
|  | 132 | ADD = 323, | 
|  | 133 | SUB = 324, | 
|  | 134 | MUL = 325, | 
|  | 135 | UDIV = 326, | 
|  | 136 | SDIV = 327, | 
|  | 137 | FDIV = 328, | 
|  | 138 | UREM = 329, | 
|  | 139 | SREM = 330, | 
|  | 140 | FREM = 331, | 
|  | 141 | AND = 332, | 
|  | 142 | OR = 333, | 
|  | 143 | XOR = 334, | 
|  | 144 | SHL = 335, | 
|  | 145 | LSHR = 336, | 
|  | 146 | ASHR = 337, | 
|  | 147 | ICMP = 338, | 
|  | 148 | FCMP = 339, | 
|  | 149 | EQ = 340, | 
|  | 150 | NE = 341, | 
|  | 151 | SLT = 342, | 
|  | 152 | SGT = 343, | 
|  | 153 | SLE = 344, | 
|  | 154 | SGE = 345, | 
|  | 155 | ULT = 346, | 
|  | 156 | UGT = 347, | 
|  | 157 | ULE = 348, | 
|  | 158 | UGE = 349, | 
|  | 159 | OEQ = 350, | 
|  | 160 | ONE = 351, | 
|  | 161 | OLT = 352, | 
|  | 162 | OGT = 353, | 
|  | 163 | OLE = 354, | 
|  | 164 | OGE = 355, | 
|  | 165 | ORD = 356, | 
|  | 166 | UNO = 357, | 
|  | 167 | UEQ = 358, | 
|  | 168 | UNE = 359, | 
|  | 169 | MALLOC = 360, | 
|  | 170 | ALLOCA = 361, | 
|  | 171 | FREE = 362, | 
|  | 172 | LOAD = 363, | 
|  | 173 | STORE = 364, | 
|  | 174 | GETELEMENTPTR = 365, | 
|  | 175 | TRUNC = 366, | 
|  | 176 | ZEXT = 367, | 
|  | 177 | SEXT = 368, | 
|  | 178 | FPTRUNC = 369, | 
|  | 179 | FPEXT = 370, | 
|  | 180 | BITCAST = 371, | 
|  | 181 | UITOFP = 372, | 
|  | 182 | SITOFP = 373, | 
|  | 183 | FPTOUI = 374, | 
|  | 184 | FPTOSI = 375, | 
|  | 185 | INTTOPTR = 376, | 
|  | 186 | PTRTOINT = 377, | 
|  | 187 | PHI_TOK = 378, | 
|  | 188 | SELECT = 379, | 
|  | 189 | VAARG = 380, | 
|  | 190 | EXTRACTELEMENT = 381, | 
|  | 191 | INSERTELEMENT = 382, | 
|  | 192 | SHUFFLEVECTOR = 383, | 
|  | 193 | NORETURN = 384, | 
|  | 194 | INREG = 385, | 
|  | 195 | SRET = 386, | 
|  | 196 | DEFAULT = 387, | 
|  | 197 | HIDDEN = 388 | 
|  | 198 | }; | 
|  | 199 | #endif | 
|  | 200 | /* Tokens.  */ | 
|  | 201 | #define ESINT64VAL 258 | 
|  | 202 | #define EUINT64VAL 259 | 
|  | 203 | #define ESAPINTVAL 260 | 
|  | 204 | #define EUAPINTVAL 261 | 
|  | 205 | #define LOCALVAL_ID 262 | 
|  | 206 | #define GLOBALVAL_ID 263 | 
|  | 207 | #define FPVAL 264 | 
|  | 208 | #define VOID 265 | 
|  | 209 | #define INTTYPE 266 | 
|  | 210 | #define FLOAT 267 | 
|  | 211 | #define DOUBLE 268 | 
|  | 212 | #define LABEL 269 | 
|  | 213 | #define TYPE 270 | 
|  | 214 | #define LOCALVAR 271 | 
|  | 215 | #define GLOBALVAR 272 | 
|  | 216 | #define LABELSTR 273 | 
|  | 217 | #define STRINGCONSTANT 274 | 
|  | 218 | #define ATSTRINGCONSTANT 275 | 
|  | 219 | #define IMPLEMENTATION 276 | 
|  | 220 | #define ZEROINITIALIZER 277 | 
|  | 221 | #define TRUETOK 278 | 
|  | 222 | #define FALSETOK 279 | 
|  | 223 | #define BEGINTOK 280 | 
|  | 224 | #define ENDTOK 281 | 
|  | 225 | #define DECLARE 282 | 
|  | 226 | #define DEFINE 283 | 
|  | 227 | #define GLOBAL 284 | 
|  | 228 | #define CONSTANT 285 | 
|  | 229 | #define SECTION 286 | 
|  | 230 | #define VOLATILE 287 | 
|  | 231 | #define TO 288 | 
|  | 232 | #define DOTDOTDOT 289 | 
|  | 233 | #define NULL_TOK 290 | 
|  | 234 | #define UNDEF 291 | 
|  | 235 | #define INTERNAL 292 | 
|  | 236 | #define LINKONCE 293 | 
|  | 237 | #define WEAK 294 | 
|  | 238 | #define APPENDING 295 | 
|  | 239 | #define DLLIMPORT 296 | 
|  | 240 | #define DLLEXPORT 297 | 
|  | 241 | #define EXTERN_WEAK 298 | 
|  | 242 | #define OPAQUE 299 | 
|  | 243 | #define EXTERNAL 300 | 
|  | 244 | #define TARGET 301 | 
|  | 245 | #define TRIPLE 302 | 
|  | 246 | #define ALIGN 303 | 
|  | 247 | #define DEPLIBS 304 | 
|  | 248 | #define CALL 305 | 
|  | 249 | #define TAIL 306 | 
|  | 250 | #define ASM_TOK 307 | 
|  | 251 | #define MODULE 308 | 
|  | 252 | #define SIDEEFFECT 309 | 
|  | 253 | #define CC_TOK 310 | 
|  | 254 | #define CCC_TOK 311 | 
|  | 255 | #define FASTCC_TOK 312 | 
|  | 256 | #define COLDCC_TOK 313 | 
|  | 257 | #define X86_STDCALLCC_TOK 314 | 
|  | 258 | #define X86_FASTCALLCC_TOK 315 | 
|  | 259 | #define DATALAYOUT 316 | 
|  | 260 | #define RET 317 | 
|  | 261 | #define BR 318 | 
|  | 262 | #define SWITCH 319 | 
|  | 263 | #define INVOKE 320 | 
|  | 264 | #define UNWIND 321 | 
|  | 265 | #define UNREACHABLE 322 | 
|  | 266 | #define ADD 323 | 
|  | 267 | #define SUB 324 | 
|  | 268 | #define MUL 325 | 
|  | 269 | #define UDIV 326 | 
|  | 270 | #define SDIV 327 | 
|  | 271 | #define FDIV 328 | 
|  | 272 | #define UREM 329 | 
|  | 273 | #define SREM 330 | 
|  | 274 | #define FREM 331 | 
|  | 275 | #define AND 332 | 
|  | 276 | #define OR 333 | 
|  | 277 | #define XOR 334 | 
|  | 278 | #define SHL 335 | 
|  | 279 | #define LSHR 336 | 
|  | 280 | #define ASHR 337 | 
|  | 281 | #define ICMP 338 | 
|  | 282 | #define FCMP 339 | 
|  | 283 | #define EQ 340 | 
|  | 284 | #define NE 341 | 
|  | 285 | #define SLT 342 | 
|  | 286 | #define SGT 343 | 
|  | 287 | #define SLE 344 | 
|  | 288 | #define SGE 345 | 
|  | 289 | #define ULT 346 | 
|  | 290 | #define UGT 347 | 
|  | 291 | #define ULE 348 | 
|  | 292 | #define UGE 349 | 
|  | 293 | #define OEQ 350 | 
|  | 294 | #define ONE 351 | 
|  | 295 | #define OLT 352 | 
|  | 296 | #define OGT 353 | 
|  | 297 | #define OLE 354 | 
|  | 298 | #define OGE 355 | 
|  | 299 | #define ORD 356 | 
|  | 300 | #define UNO 357 | 
|  | 301 | #define UEQ 358 | 
|  | 302 | #define UNE 359 | 
|  | 303 | #define MALLOC 360 | 
|  | 304 | #define ALLOCA 361 | 
|  | 305 | #define FREE 362 | 
|  | 306 | #define LOAD 363 | 
|  | 307 | #define STORE 364 | 
|  | 308 | #define GETELEMENTPTR 365 | 
|  | 309 | #define TRUNC 366 | 
|  | 310 | #define ZEXT 367 | 
|  | 311 | #define SEXT 368 | 
|  | 312 | #define FPTRUNC 369 | 
|  | 313 | #define FPEXT 370 | 
|  | 314 | #define BITCAST 371 | 
|  | 315 | #define UITOFP 372 | 
|  | 316 | #define SITOFP 373 | 
|  | 317 | #define FPTOUI 374 | 
|  | 318 | #define FPTOSI 375 | 
|  | 319 | #define INTTOPTR 376 | 
|  | 320 | #define PTRTOINT 377 | 
|  | 321 | #define PHI_TOK 378 | 
|  | 322 | #define SELECT 379 | 
|  | 323 | #define VAARG 380 | 
|  | 324 | #define EXTRACTELEMENT 381 | 
|  | 325 | #define INSERTELEMENT 382 | 
|  | 326 | #define SHUFFLEVECTOR 383 | 
|  | 327 | #define NORETURN 384 | 
|  | 328 | #define INREG 385 | 
|  | 329 | #define SRET 386 | 
|  | 330 | #define DEFAULT 387 | 
|  | 331 | #define HIDDEN 388 | 
|  | 332 |  | 
|  | 333 |  | 
|  | 334 |  | 
|  | 335 |  | 
|  | 336 | /* Copy the first part of user declarations.  */ | 
|  | 337 | #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 338 |  | 
|  | 339 | #include "ParserInternals.h" | 
|  | 340 | #include "llvm/CallingConv.h" | 
| Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 341 | #include "llvm/InlineAsm.h" | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 342 | #include "llvm/Instructions.h" | 
|  | 343 | #include "llvm/Module.h" | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 344 | #include "llvm/ValueSymbolTable.h" | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 345 | #include "llvm/Support/GetElementPtrTypeIterator.h" | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 346 | #include "llvm/Support/CommandLine.h" | 
| Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 347 | #include "llvm/ADT/SmallVector.h" | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 348 | #include "llvm/ADT/STLExtras.h" | 
| Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 349 | #include "llvm/Support/MathExtras.h" | 
| Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 350 | #include "llvm/Support/Streams.h" | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 351 | #include <algorithm> | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 352 | #include <list> | 
| Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 353 | #include <map> | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 354 | #include <utility> | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 355 | #ifndef NDEBUG | 
|  | 356 | #define YYDEBUG 1 | 
|  | 357 | #endif | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 358 |  | 
| Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 359 | // The following is a gross hack. In order to rid the libAsmParser library of | 
|  | 360 | // exceptions, we have to have a way of getting the yyparse function to go into | 
|  | 361 | // an error situation. So, whenever we want an error to occur, the GenerateError | 
|  | 362 | // function (see bottom of file) sets TriggerError. Then, at the end of each | 
|  | 363 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR | 
|  | 364 | // (a goto) to put YACC in error state. Furthermore, several calls to | 
|  | 365 | // GenerateError are made from inside productions and they must simulate the | 
|  | 366 | // previous exception behavior by exiting the production immediately. We have | 
|  | 367 | // replaced these with the GEN_ERROR macro which calls GeneratError and then | 
|  | 368 | // immediately invokes YYERROR. This would be so much cleaner if it was a | 
|  | 369 | // recursive descent parser. | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 370 | static bool TriggerError = false; | 
| Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 371 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 372 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } | 
|  | 373 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 374 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit | 
|  | 375 | int yylex();                       // declaration" of xxx warnings. | 
|  | 376 | int yyparse(); | 
|  | 377 |  | 
|  | 378 | namespace llvm { | 
|  | 379 | std::string CurFilename; | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 380 | #if YYDEBUG | 
|  | 381 | static cl::opt<bool> | 
|  | 382 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), | 
|  | 383 | cl::Hidden, cl::init(false)); | 
|  | 384 | #endif | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 385 | } | 
|  | 386 | using namespace llvm; | 
|  | 387 |  | 
|  | 388 | static Module *ParserResult; | 
|  | 389 |  | 
|  | 390 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output | 
|  | 391 | // relating to upreferences in the input stream. | 
|  | 392 | // | 
|  | 393 | //#define DEBUG_UPREFS 1 | 
|  | 394 | #ifdef DEBUG_UPREFS | 
| Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 395 | #define UR_OUT(X) cerr << X | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 396 | #else | 
|  | 397 | #define UR_OUT(X) | 
|  | 398 | #endif | 
|  | 399 |  | 
|  | 400 | #define YYERROR_VERBOSE 1 | 
|  | 401 |  | 
| Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 402 | static GlobalVariable *CurGV; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 403 |  | 
|  | 404 |  | 
|  | 405 | // This contains info used when building the body of a function.  It is | 
|  | 406 | // destroyed when the function is completed. | 
|  | 407 | // | 
|  | 408 | typedef std::vector<Value *> ValueList;           // Numbered defs | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 409 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 410 | static void | 
|  | 411 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, | 
|  | 412 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); | 
|  | 413 |  | 
|  | 414 | static struct PerModuleInfo { | 
|  | 415 | Module *CurrentModule; | 
|  | 416 | std::map<const Type *, ValueList> Values; // Module level numbered definitions | 
|  | 417 | std::map<const Type *,ValueList> LateResolveValues; | 
| Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 418 | std::vector<PATypeHolder>    Types; | 
|  | 419 | std::map<ValID, PATypeHolder> LateResolveTypes; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 420 |  | 
|  | 421 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember | 
| Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 422 | /// how they were referenced and on which line of the input they came from so | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 423 | /// that we can resolve them later and print error messages as appropriate. | 
|  | 424 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; | 
|  | 425 |  | 
|  | 426 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward | 
|  | 427 | // references to global values.  Global values may be referenced before they | 
|  | 428 | // are defined, and if so, the temporary object that they represent is held | 
|  | 429 | // here.  This is used for forward references of GlobalValues. | 
|  | 430 | // | 
|  | 431 | typedef std::map<std::pair<const PointerType *, | 
|  | 432 | ValID>, GlobalValue*> GlobalRefsType; | 
|  | 433 | GlobalRefsType GlobalRefs; | 
|  | 434 |  | 
|  | 435 | void ModuleDone() { | 
|  | 436 | // If we could not resolve some functions at function compilation time | 
|  | 437 | // (calls to functions before they are defined), resolve them now...  Types | 
|  | 438 | // are resolved when the constant pool has been completely parsed. | 
|  | 439 | // | 
|  | 440 | ResolveDefinitions(LateResolveValues); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 441 | if (TriggerError) | 
|  | 442 | return; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 443 |  | 
|  | 444 | // Check to make sure that all global value forward references have been | 
|  | 445 | // resolved! | 
|  | 446 | // | 
|  | 447 | if (!GlobalRefs.empty()) { | 
|  | 448 | std::string UndefinedReferences = "Unresolved global references exist:\n"; | 
|  | 449 |  | 
|  | 450 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); | 
|  | 451 | I != E; ++I) { | 
|  | 452 | UndefinedReferences += "  " + I->first.first->getDescription() + " " + | 
|  | 453 | I->first.second.getName() + "\n"; | 
|  | 454 | } | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 455 | GenerateError(UndefinedReferences); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 456 | return; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 457 | } | 
|  | 458 |  | 
|  | 459 | Values.clear();         // Clear out function local definitions | 
|  | 460 | Types.clear(); | 
|  | 461 | CurrentModule = 0; | 
|  | 462 | } | 
|  | 463 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 464 | // GetForwardRefForGlobal - Check to see if there is a forward reference | 
|  | 465 | // for this global.  If so, remove it from the GlobalRefs map and return it. | 
|  | 466 | // If not, just return null. | 
|  | 467 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { | 
|  | 468 | // Check to see if there is a forward reference to this global variable... | 
|  | 469 | // if there is, eliminate it and patch the reference to use the new def'n. | 
|  | 470 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); | 
|  | 471 | GlobalValue *Ret = 0; | 
|  | 472 | if (I != GlobalRefs.end()) { | 
|  | 473 | Ret = I->second; | 
|  | 474 | GlobalRefs.erase(I); | 
|  | 475 | } | 
|  | 476 | return Ret; | 
|  | 477 | } | 
| Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 478 |  | 
|  | 479 | bool TypeIsUnresolved(PATypeHolder* PATy) { | 
|  | 480 | // If it isn't abstract, its resolved | 
|  | 481 | const Type* Ty = PATy->get(); | 
|  | 482 | if (!Ty->isAbstract()) | 
|  | 483 | return false; | 
|  | 484 | // Traverse the type looking for abstract types. If it isn't abstract then | 
|  | 485 | // we don't need to traverse that leg of the type. | 
|  | 486 | std::vector<const Type*> WorkList, SeenList; | 
|  | 487 | WorkList.push_back(Ty); | 
|  | 488 | while (!WorkList.empty()) { | 
|  | 489 | const Type* Ty = WorkList.back(); | 
|  | 490 | SeenList.push_back(Ty); | 
|  | 491 | WorkList.pop_back(); | 
|  | 492 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { | 
|  | 493 | // Check to see if this is an unresolved type | 
|  | 494 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); | 
|  | 495 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); | 
|  | 496 | for ( ; I != E; ++I) { | 
|  | 497 | if (I->second.get() == OpTy) | 
|  | 498 | return true; | 
|  | 499 | } | 
|  | 500 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { | 
|  | 501 | const Type* TheTy = SeqTy->getElementType(); | 
|  | 502 | if (TheTy->isAbstract() && TheTy != Ty) { | 
|  | 503 | std::vector<const Type*>::iterator I = SeenList.begin(), | 
|  | 504 | E = SeenList.end(); | 
|  | 505 | for ( ; I != E; ++I) | 
|  | 506 | if (*I == TheTy) | 
|  | 507 | break; | 
|  | 508 | if (I == E) | 
|  | 509 | WorkList.push_back(TheTy); | 
|  | 510 | } | 
|  | 511 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { | 
|  | 512 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { | 
|  | 513 | const Type* TheTy = StrTy->getElementType(i); | 
|  | 514 | if (TheTy->isAbstract() && TheTy != Ty) { | 
|  | 515 | std::vector<const Type*>::iterator I = SeenList.begin(), | 
|  | 516 | E = SeenList.end(); | 
|  | 517 | for ( ; I != E; ++I) | 
|  | 518 | if (*I == TheTy) | 
|  | 519 | break; | 
|  | 520 | if (I == E) | 
|  | 521 | WorkList.push_back(TheTy); | 
|  | 522 | } | 
|  | 523 | } | 
|  | 524 | } | 
|  | 525 | } | 
|  | 526 | return false; | 
|  | 527 | } | 
|  | 528 |  | 
|  | 529 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 530 | } CurModule; | 
|  | 531 |  | 
|  | 532 | static struct PerFunctionInfo { | 
|  | 533 | Function *CurrentFunction;     // Pointer to current function being created | 
|  | 534 |  | 
| Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 535 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 536 | std::map<const Type*, ValueList> LateResolveValues; | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 537 | bool isDeclare;                   // Is this function a forward declararation? | 
| Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 538 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 539 | GlobalValue::VisibilityTypes Visibility; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 540 |  | 
|  | 541 | /// BBForwardRefs - When we see forward references to basic blocks, keep | 
|  | 542 | /// track of them here. | 
|  | 543 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; | 
|  | 544 | std::vector<BasicBlock*> NumberedBlocks; | 
|  | 545 | unsigned NextBBNum; | 
|  | 546 |  | 
|  | 547 | inline PerFunctionInfo() { | 
|  | 548 | CurrentFunction = 0; | 
|  | 549 | isDeclare = false; | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 550 | Linkage = GlobalValue::ExternalLinkage; | 
|  | 551 | Visibility = GlobalValue::DefaultVisibility; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 552 | } | 
|  | 553 |  | 
|  | 554 | inline void FunctionStart(Function *M) { | 
|  | 555 | CurrentFunction = M; | 
|  | 556 | NextBBNum = 0; | 
|  | 557 | } | 
|  | 558 |  | 
|  | 559 | void FunctionDone() { | 
|  | 560 | NumberedBlocks.clear(); | 
|  | 561 |  | 
|  | 562 | // Any forward referenced blocks left? | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 563 | if (!BBForwardRefs.empty()) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 564 | GenerateError("Undefined reference to label " + | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 565 | BBForwardRefs.begin()->first->getName()); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 566 | return; | 
|  | 567 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 568 |  | 
|  | 569 | // Resolve all forward references now. | 
|  | 570 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); | 
|  | 571 |  | 
|  | 572 | Values.clear();         // Clear out function local definitions | 
|  | 573 | CurrentFunction = 0; | 
|  | 574 | isDeclare = false; | 
| Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 575 | Linkage = GlobalValue::ExternalLinkage; | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 576 | Visibility = GlobalValue::DefaultVisibility; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 577 | } | 
|  | 578 | } CurFun;  // Info for the current function... | 
|  | 579 |  | 
|  | 580 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } | 
|  | 581 |  | 
|  | 582 |  | 
|  | 583 | //===----------------------------------------------------------------------===// | 
|  | 584 | //               Code to handle definitions of all the types | 
|  | 585 | //===----------------------------------------------------------------------===// | 
|  | 586 |  | 
|  | 587 | static int InsertValue(Value *V, | 
|  | 588 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { | 
|  | 589 | if (V->hasName()) return -1;           // Is this a numbered definition? | 
|  | 590 |  | 
|  | 591 | // Yes, insert the value into the value table... | 
|  | 592 | ValueList &List = ValueTab[V->getType()]; | 
|  | 593 | List.push_back(V); | 
|  | 594 | return List.size()-1; | 
|  | 595 | } | 
|  | 596 |  | 
|  | 597 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { | 
|  | 598 | switch (D.Type) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 599 | case ValID::LocalID:               // Is it a numbered definition? | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 600 | // Module constants occupy the lowest numbered slots... | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 601 | if (D.Num < CurModule.Types.size()) | 
|  | 602 | return CurModule.Types[D.Num]; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 603 | break; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 604 | case ValID::LocalName:                 // Is it a named definition? | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 605 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { | 
|  | 606 | D.destroy();  // Free old strdup'd memory... | 
|  | 607 | return N; | 
|  | 608 | } | 
|  | 609 | break; | 
|  | 610 | default: | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 611 | GenerateError("Internal parser error: Invalid symbol type reference"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 612 | return 0; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 613 | } | 
|  | 614 |  | 
|  | 615 | // If we reached here, we referenced either a symbol that we don't know about | 
|  | 616 | // or an id number that hasn't been read yet.  We may be referencing something | 
|  | 617 | // forward, so just create an entry to be resolved later and get to it... | 
|  | 618 | // | 
|  | 619 | if (DoNotImprovise) return 0;  // Do we just want a null to be returned? | 
|  | 620 |  | 
|  | 621 |  | 
|  | 622 | if (inFunctionScope()) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 623 | if (D.Type == ValID::LocalName) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 624 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 625 | return 0; | 
|  | 626 | } else { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 627 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 628 | return 0; | 
|  | 629 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 630 | } | 
|  | 631 |  | 
| Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 632 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 633 | if (I != CurModule.LateResolveTypes.end()) | 
| Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 634 | return I->second; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 635 |  | 
| Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 636 | Type *Typ = OpaqueType::get(); | 
|  | 637 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); | 
|  | 638 | return Typ; | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 639 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 640 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 641 | // getValNonImprovising - Look up the value specified by the provided type and | 
|  | 642 | // the provided ValID.  If the value exists and has already been defined, return | 
|  | 643 | // it.  Otherwise return null. | 
|  | 644 | // | 
|  | 645 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 646 | if (isa<FunctionType>(Ty)) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 647 | GenerateError("Functions are not values and " | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 648 | "must be referenced as pointers"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 649 | return 0; | 
|  | 650 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 651 |  | 
|  | 652 | switch (D.Type) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 653 | case ValID::LocalID: {                 // Is it a numbered definition? | 
|  | 654 | // Module constants occupy the lowest numbered slots. | 
|  | 655 | std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty); | 
|  | 656 | // Make sure that our type is within bounds. | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 657 | if (VI == CurFun.Values.end()) return 0; | 
|  | 658 |  | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 659 | // Check that the number is within bounds. | 
|  | 660 | if (D.Num >= VI->second.size()) return 0; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 661 |  | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 662 | return VI->second[D.Num]; | 
|  | 663 | } | 
|  | 664 | case ValID::GlobalID: {                 // Is it a numbered definition? | 
|  | 665 | unsigned Num = D.Num; | 
|  | 666 |  | 
|  | 667 | // Module constants occupy the lowest numbered slots... | 
|  | 668 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 669 | if (VI == CurModule.Values.end()) | 
|  | 670 | return 0; | 
|  | 671 | if (D.Num >= VI->second.size()) | 
|  | 672 | return 0; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 673 | return VI->second[Num]; | 
|  | 674 | } | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 675 |  | 
|  | 676 | case ValID::LocalName: {                // Is it a named definition? | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 677 | if (!inFunctionScope()) | 
|  | 678 | return 0; | 
|  | 679 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); | 
|  | 680 | Value *N = SymTab.lookup(D.Name); | 
|  | 681 | if (N == 0) | 
|  | 682 | return 0; | 
|  | 683 | if (N->getType() != Ty) | 
|  | 684 | return 0; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 685 |  | 
|  | 686 | D.destroy();  // Free old strdup'd memory... | 
|  | 687 | return N; | 
|  | 688 | } | 
|  | 689 | case ValID::GlobalName: {                // Is it a named definition? | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 690 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); | 
|  | 691 | Value *N = SymTab.lookup(D.Name); | 
|  | 692 | if (N == 0) | 
|  | 693 | return 0; | 
|  | 694 | if (N->getType() != Ty) | 
|  | 695 | return 0; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 696 |  | 
|  | 697 | D.destroy();  // Free old strdup'd memory... | 
|  | 698 | return N; | 
|  | 699 | } | 
|  | 700 |  | 
|  | 701 | // Check to make sure that "Ty" is an integral type, and that our | 
|  | 702 | // value will fit into the specified type... | 
|  | 703 | case ValID::ConstSIntVal:    // Is it a constant pool reference?? | 
| Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 704 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 705 | GenerateError("Signed integral constant '" + | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 706 | itostr(D.ConstPool64) + "' is invalid for type '" + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 707 | Ty->getDescription() + "'"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 708 | return 0; | 
|  | 709 | } | 
| Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 710 | return ConstantInt::get(Ty, D.ConstPool64); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 711 |  | 
|  | 712 | case ValID::ConstUIntVal:     // Is it an unsigned const pool reference? | 
| Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 713 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { | 
|  | 714 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 715 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 716 | "' is invalid or out of range"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 717 | return 0; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 718 | } else {     // This is really a signed reference.  Transmogrify. | 
| Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 719 | return ConstantInt::get(Ty, D.ConstPool64); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 720 | } | 
|  | 721 | } else { | 
| Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 722 | return ConstantInt::get(Ty, D.UConstPool64); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 723 | } | 
|  | 724 |  | 
|  | 725 | case ValID::ConstFPVal:        // Is it a floating point const pool reference? | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 726 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 727 | GenerateError("FP constant invalid for type"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 728 | return 0; | 
|  | 729 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 730 | return ConstantFP::get(Ty, D.ConstPoolFP); | 
|  | 731 |  | 
|  | 732 | case ValID::ConstNullVal:      // Is it a null value? | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 733 | if (!isa<PointerType>(Ty)) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 734 | GenerateError("Cannot create a a non pointer null"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 735 | return 0; | 
|  | 736 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 737 | return ConstantPointerNull::get(cast<PointerType>(Ty)); | 
|  | 738 |  | 
|  | 739 | case ValID::ConstUndefVal:      // Is it an undef value? | 
|  | 740 | return UndefValue::get(Ty); | 
|  | 741 |  | 
| Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 742 | case ValID::ConstZeroVal:      // Is it a zero value? | 
|  | 743 | return Constant::getNullValue(Ty); | 
|  | 744 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 745 | case ValID::ConstantVal:       // Fully resolved constant? | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 746 | if (D.ConstantValue->getType() != Ty) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 747 | GenerateError("Constant expression type different from required type"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 748 | return 0; | 
|  | 749 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 750 | return D.ConstantValue; | 
|  | 751 |  | 
| Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 752 | case ValID::InlineAsmVal: {    // Inline asm expression | 
|  | 753 | const PointerType *PTy = dyn_cast<PointerType>(Ty); | 
|  | 754 | const FunctionType *FTy = | 
|  | 755 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 756 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 757 | GenerateError("Invalid type for asm constraint string"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 758 | return 0; | 
|  | 759 | } | 
| Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 760 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, | 
|  | 761 | D.IAD->HasSideEffects); | 
|  | 762 | D.destroy();   // Free InlineAsmDescriptor. | 
|  | 763 | return IA; | 
|  | 764 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 765 | default: | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 766 | assert(0 && "Unhandled case!"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 767 | return 0; | 
|  | 768 | }   // End of switch | 
|  | 769 |  | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 770 | assert(0 && "Unhandled case!"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 771 | return 0; | 
|  | 772 | } | 
|  | 773 |  | 
|  | 774 | // getVal - This function is identical to getValNonImprovising, except that if a | 
|  | 775 | // value is not already defined, it "improvises" by creating a placeholder var | 
|  | 776 | // that looks and acts just like the requested variable.  When the value is | 
|  | 777 | // defined later, all uses of the placeholder variable are replaced with the | 
|  | 778 | // real thing. | 
|  | 779 | // | 
|  | 780 | static Value *getVal(const Type *Ty, const ValID &ID) { | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 781 | if (Ty == Type::LabelTy) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 782 | GenerateError("Cannot use a basic block here"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 783 | return 0; | 
|  | 784 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 785 |  | 
|  | 786 | // See if the value has already been defined. | 
|  | 787 | Value *V = getValNonImprovising(Ty, ID); | 
|  | 788 | if (V) return V; | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 789 | if (TriggerError) return 0; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 790 |  | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 791 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 792 | GenerateError("Invalid use of a composite type"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 793 | return 0; | 
|  | 794 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 795 |  | 
|  | 796 | // If we reached here, we referenced either a symbol that we don't know about | 
|  | 797 | // or an id number that hasn't been read yet.  We may be referencing something | 
|  | 798 | // forward, so just create an entry to be resolved later and get to it... | 
|  | 799 | // | 
|  | 800 | V = new Argument(Ty); | 
|  | 801 |  | 
|  | 802 | // Remember where this forward reference came from.  FIXME, shouldn't we try | 
|  | 803 | // to recycle these things?? | 
|  | 804 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, | 
|  | 805 | llvmAsmlineno))); | 
|  | 806 |  | 
|  | 807 | if (inFunctionScope()) | 
|  | 808 | InsertValue(V, CurFun.LateResolveValues); | 
|  | 809 | else | 
|  | 810 | InsertValue(V, CurModule.LateResolveValues); | 
|  | 811 | return V; | 
|  | 812 | } | 
|  | 813 |  | 
|  | 814 | /// getBBVal - This is used for two purposes: | 
|  | 815 | ///  * If isDefinition is true, a new basic block with the specified ID is being | 
|  | 816 | ///    defined. | 
|  | 817 | ///  * If isDefinition is true, this is a reference to a basic block, which may | 
|  | 818 | ///    or may not be a forward reference. | 
|  | 819 | /// | 
|  | 820 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 821 | assert(inFunctionScope() && "Can't get basic block at global scope!"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 822 |  | 
|  | 823 | std::string Name; | 
|  | 824 | BasicBlock *BB = 0; | 
|  | 825 | switch (ID.Type) { | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 826 | default: | 
|  | 827 | GenerateError("Illegal label reference " + ID.getName()); | 
|  | 828 | return 0; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 829 | case ValID::LocalID:                // Is it a numbered definition? | 
|  | 830 | if (ID.Num >= CurFun.NumberedBlocks.size()) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 831 | CurFun.NumberedBlocks.resize(ID.Num+1); | 
|  | 832 | BB = CurFun.NumberedBlocks[ID.Num]; | 
|  | 833 | break; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 834 | case ValID::LocalName:                  // Is it a named definition? | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 835 | Name = ID.Name; | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 836 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); | 
|  | 837 | if (N && N->getType()->getTypeID() == Type::LabelTyID) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 838 | BB = cast<BasicBlock>(N); | 
|  | 839 | break; | 
|  | 840 | } | 
|  | 841 |  | 
|  | 842 | // See if the block has already been defined. | 
|  | 843 | if (BB) { | 
|  | 844 | // If this is the definition of the block, make sure the existing value was | 
|  | 845 | // just a forward reference.  If it was a forward reference, there will be | 
|  | 846 | // an entry for it in the PlaceHolderInfo map. | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 847 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 848 | // The existing value was a definition, not a forward reference. | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 849 | GenerateError("Redefinition of label " + ID.getName()); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 850 | return 0; | 
|  | 851 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 852 |  | 
|  | 853 | ID.destroy();                       // Free strdup'd memory. | 
|  | 854 | return BB; | 
|  | 855 | } | 
|  | 856 |  | 
|  | 857 | // Otherwise this block has not been seen before. | 
|  | 858 | BB = new BasicBlock("", CurFun.CurrentFunction); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 859 | if (ID.Type == ValID::LocalName) { | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 860 | BB->setName(ID.Name); | 
|  | 861 | } else { | 
|  | 862 | CurFun.NumberedBlocks[ID.Num] = BB; | 
|  | 863 | } | 
|  | 864 |  | 
|  | 865 | // If this is not a definition, keep track of it so we can use it as a forward | 
|  | 866 | // reference. | 
|  | 867 | if (!isDefinition) { | 
|  | 868 | // Remember where this forward reference came from. | 
|  | 869 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); | 
|  | 870 | } else { | 
|  | 871 | // The forward declaration could have been inserted anywhere in the | 
|  | 872 | // function: insert it into the correct place now. | 
|  | 873 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); | 
|  | 874 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); | 
|  | 875 | } | 
|  | 876 | ID.destroy(); | 
|  | 877 | return BB; | 
|  | 878 | } | 
|  | 879 |  | 
|  | 880 |  | 
|  | 881 | //===----------------------------------------------------------------------===// | 
|  | 882 | //              Code to handle forward references in instructions | 
|  | 883 | //===----------------------------------------------------------------------===// | 
|  | 884 | // | 
|  | 885 | // This code handles the late binding needed with statements that reference | 
|  | 886 | // values not defined yet... for example, a forward branch, or the PHI node for | 
|  | 887 | // a loop body. | 
|  | 888 | // | 
|  | 889 | // This keeps a table (CurFun.LateResolveValues) of all such forward references | 
|  | 890 | // and back patchs after we are done. | 
|  | 891 | // | 
|  | 892 |  | 
|  | 893 | // ResolveDefinitions - If we could not resolve some defs at parsing | 
|  | 894 | // time (forward branches, phi functions for loops, etc...) resolve the | 
|  | 895 | // defs now... | 
|  | 896 | // | 
|  | 897 | static void | 
|  | 898 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, | 
|  | 899 | std::map<const Type*,ValueList> *FutureLateResolvers) { | 
|  | 900 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved | 
|  | 901 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), | 
|  | 902 | E = LateResolvers.end(); LRI != E; ++LRI) { | 
|  | 903 | ValueList &List = LRI->second; | 
|  | 904 | while (!List.empty()) { | 
|  | 905 | Value *V = List.back(); | 
|  | 906 | List.pop_back(); | 
|  | 907 |  | 
|  | 908 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = | 
|  | 909 | CurModule.PlaceHolderInfo.find(V); | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 910 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 911 |  | 
|  | 912 | ValID &DID = PHI->second.first; | 
|  | 913 |  | 
|  | 914 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 915 | if (TriggerError) | 
|  | 916 | return; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 917 | if (TheRealValue) { | 
|  | 918 | V->replaceAllUsesWith(TheRealValue); | 
|  | 919 | delete V; | 
|  | 920 | CurModule.PlaceHolderInfo.erase(PHI); | 
|  | 921 | } else if (FutureLateResolvers) { | 
|  | 922 | // Functions have their unresolved items forwarded to the module late | 
|  | 923 | // resolver table | 
|  | 924 | InsertValue(V, *FutureLateResolvers); | 
|  | 925 | } else { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 926 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 927 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 928 | "' of type '" + V->getType()->getDescription() + "'", | 
|  | 929 | PHI->second.second); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 930 | return; | 
|  | 931 | } else { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 932 | GenerateError("Reference to an invalid definition: #" + | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 933 | itostr(DID.Num) + " of type '" + | 
|  | 934 | V->getType()->getDescription() + "'", | 
|  | 935 | PHI->second.second); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 936 | return; | 
|  | 937 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 938 | } | 
|  | 939 | } | 
|  | 940 | } | 
|  | 941 |  | 
|  | 942 | LateResolvers.clear(); | 
|  | 943 | } | 
|  | 944 |  | 
|  | 945 | // ResolveTypeTo - A brand new type was just declared.  This means that (if | 
|  | 946 | // name is not null) things referencing Name can be resolved.  Otherwise, things | 
|  | 947 | // refering to the number can be resolved.  Do this now. | 
|  | 948 | // | 
|  | 949 | static void ResolveTypeTo(char *Name, const Type *ToTy) { | 
|  | 950 | ValID D; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 951 | if (Name) D = ValID::createLocalName(Name); | 
|  | 952 | else      D = ValID::createLocalID(CurModule.Types.size()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 953 |  | 
| Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 954 | std::map<ValID, PATypeHolder>::iterator I = | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 955 | CurModule.LateResolveTypes.find(D); | 
|  | 956 | if (I != CurModule.LateResolveTypes.end()) { | 
| Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 957 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 958 | CurModule.LateResolveTypes.erase(I); | 
|  | 959 | } | 
|  | 960 | } | 
|  | 961 |  | 
|  | 962 | // setValueName - Set the specified value to the name given.  The name may be | 
|  | 963 | // null potentially, in which case this is a noop.  The string passed in is | 
|  | 964 | // assumed to be a malloc'd string buffer, and is free'd by this function. | 
|  | 965 | // | 
|  | 966 | static void setValueName(Value *V, char *NameStr) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 967 | if (!NameStr) return; | 
|  | 968 | std::string Name(NameStr);      // Copy string | 
|  | 969 | free(NameStr);                  // Free old string | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 970 |  | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 971 | if (V->getType() == Type::VoidTy) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 972 | GenerateError("Can't assign name '" + Name+"' to value with void type"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 973 | return; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 974 | } | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 975 |  | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 976 | assert(inFunctionScope() && "Must be in function scope!"); | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 977 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); | 
|  | 978 | if (ST.lookup(Name)) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 979 | GenerateError("Redefinition of value '" + Name + "' of type '" + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 980 | V->getType()->getDescription() + "'"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 981 | return; | 
|  | 982 | } | 
|  | 983 |  | 
|  | 984 | // Set the name. | 
|  | 985 | V->setName(Name); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 986 | } | 
|  | 987 |  | 
|  | 988 | /// ParseGlobalVariable - Handle parsing of a global.  If Initializer is null, | 
|  | 989 | /// this is a declaration, otherwise it is a definition. | 
| Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 990 | static GlobalVariable * | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 991 | ParseGlobalVariable(char *NameStr, | 
|  | 992 | GlobalValue::LinkageTypes Linkage, | 
|  | 993 | GlobalValue::VisibilityTypes Visibility, | 
| Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 994 | bool isConstantGlobal, const Type *Ty, | 
|  | 995 | Constant *Initializer) { | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 996 | if (isa<FunctionType>(Ty)) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 997 | GenerateError("Cannot declare global vars of function type"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 998 | return 0; | 
|  | 999 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1000 |  | 
|  | 1001 | const PointerType *PTy = PointerType::get(Ty); | 
|  | 1002 |  | 
|  | 1003 | std::string Name; | 
|  | 1004 | if (NameStr) { | 
|  | 1005 | Name = NameStr;      // Copy string | 
|  | 1006 | free(NameStr);       // Free old string | 
|  | 1007 | } | 
|  | 1008 |  | 
|  | 1009 | // See if this global value was forward referenced.  If so, recycle the | 
|  | 1010 | // object. | 
|  | 1011 | ValID ID; | 
|  | 1012 | if (!Name.empty()) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1013 | ID = ValID::createGlobalName((char*)Name.c_str()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1014 | } else { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1015 | ID = ValID::createGlobalID(CurModule.Values[PTy].size()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1016 | } | 
|  | 1017 |  | 
|  | 1018 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { | 
|  | 1019 | // Move the global to the end of the list, from whereever it was | 
|  | 1020 | // previously inserted. | 
|  | 1021 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); | 
|  | 1022 | CurModule.CurrentModule->getGlobalList().remove(GV); | 
|  | 1023 | CurModule.CurrentModule->getGlobalList().push_back(GV); | 
|  | 1024 | GV->setInitializer(Initializer); | 
|  | 1025 | GV->setLinkage(Linkage); | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1026 | GV->setVisibility(Visibility); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1027 | GV->setConstant(isConstantGlobal); | 
|  | 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 |  | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1032 | // If this global has a name | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1033 | if (!Name.empty()) { | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1034 | // if the global we're parsing has an initializer (is a definition) and | 
|  | 1035 | // has external linkage. | 
|  | 1036 | if (Initializer && Linkage != GlobalValue::InternalLinkage) | 
|  | 1037 | // If there is already a global with external linkage with this name | 
|  | 1038 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { | 
|  | 1039 | // If we allow this GVar to get created, it will be renamed in the | 
|  | 1040 | // symbol table because it conflicts with an existing GVar. We can't | 
|  | 1041 | // allow redefinition of GVars whose linking indicates that their name | 
|  | 1042 | // must stay the same. Issue the error. | 
|  | 1043 | GenerateError("Redefinition of global variable named '" + Name + | 
|  | 1044 | "' of type '" + Ty->getDescription() + "'"); | 
|  | 1045 | return 0; | 
|  | 1046 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1047 | } | 
|  | 1048 |  | 
|  | 1049 | // Otherwise there is no existing GV to use, create one now. | 
|  | 1050 | GlobalVariable *GV = | 
|  | 1051 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, | 
|  | 1052 | CurModule.CurrentModule); | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1053 | GV->setVisibility(Visibility); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1054 | InsertValue(GV, CurModule.Values); | 
| Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1055 | return GV; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1056 | } | 
|  | 1057 |  | 
|  | 1058 | // setTypeName - Set the specified type to the name given.  The name may be | 
|  | 1059 | // null potentially, in which case this is a noop.  The string passed in is | 
|  | 1060 | // assumed to be a malloc'd string buffer, and is freed by this function. | 
|  | 1061 | // | 
|  | 1062 | // This function returns true if the type has already been defined, but is | 
|  | 1063 | // allowed to be redefined in the specified context.  If the name is a new name | 
|  | 1064 | // for the type plane, it is inserted and false is returned. | 
|  | 1065 | static bool setTypeName(const Type *T, char *NameStr) { | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1066 | assert(!inFunctionScope() && "Can't give types function-local names!"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1067 | if (NameStr == 0) return false; | 
|  | 1068 |  | 
|  | 1069 | std::string Name(NameStr);      // Copy string | 
|  | 1070 | free(NameStr);                  // Free old string | 
|  | 1071 |  | 
|  | 1072 | // We don't allow assigning names to void type | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1073 | if (T == Type::VoidTy) { | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1074 | GenerateError("Can't assign name '" + Name + "' to the void type"); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1075 | return false; | 
|  | 1076 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1077 |  | 
|  | 1078 | // Set the type name, checking for conflicts as we do so. | 
|  | 1079 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); | 
|  | 1080 |  | 
|  | 1081 | if (AlreadyExists) {   // Inserting a name that is already defined??? | 
|  | 1082 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1083 | assert(Existing && "Conflict but no matching type?!"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1084 |  | 
|  | 1085 | // There is only one case where this is allowed: when we are refining an | 
|  | 1086 | // opaque type.  In this case, Existing will be an opaque type. | 
|  | 1087 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { | 
|  | 1088 | // We ARE replacing an opaque type! | 
|  | 1089 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); | 
|  | 1090 | return true; | 
|  | 1091 | } | 
|  | 1092 |  | 
|  | 1093 | // Otherwise, this is an attempt to redefine a type. That's okay if | 
|  | 1094 | // the redefinition is identical to the original. This will be so if | 
|  | 1095 | // Existing and T point to the same Type object. In this one case we | 
|  | 1096 | // allow the equivalent redefinition. | 
|  | 1097 | if (Existing == T) return true;  // Yes, it's equal. | 
|  | 1098 |  | 
|  | 1099 | // Any other kind of (non-equivalent) redefinition is an error. | 
| Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1100 | GenerateError("Redefinition of type named '" + Name + "' of type '" + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1101 | T->getDescription() + "'"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1102 | } | 
|  | 1103 |  | 
|  | 1104 | return false; | 
|  | 1105 | } | 
|  | 1106 |  | 
|  | 1107 | //===----------------------------------------------------------------------===// | 
|  | 1108 | // Code for handling upreferences in type names... | 
|  | 1109 | // | 
|  | 1110 |  | 
|  | 1111 | // TypeContains - Returns true if Ty directly contains E in it. | 
|  | 1112 | // | 
|  | 1113 | static bool TypeContains(const Type *Ty, const Type *E) { | 
|  | 1114 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), | 
|  | 1115 | E) != Ty->subtype_end(); | 
|  | 1116 | } | 
|  | 1117 |  | 
|  | 1118 | namespace { | 
|  | 1119 | struct UpRefRecord { | 
|  | 1120 | // NestingLevel - The number of nesting levels that need to be popped before | 
|  | 1121 | // this type is resolved. | 
|  | 1122 | unsigned NestingLevel; | 
|  | 1123 |  | 
|  | 1124 | // LastContainedTy - This is the type at the current binding level for the | 
|  | 1125 | // type.  Every time we reduce the nesting level, this gets updated. | 
|  | 1126 | const Type *LastContainedTy; | 
|  | 1127 |  | 
|  | 1128 | // UpRefTy - This is the actual opaque type that the upreference is | 
|  | 1129 | // represented with. | 
|  | 1130 | OpaqueType *UpRefTy; | 
|  | 1131 |  | 
|  | 1132 | UpRefRecord(unsigned NL, OpaqueType *URTy) | 
|  | 1133 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} | 
|  | 1134 | }; | 
|  | 1135 | } | 
|  | 1136 |  | 
|  | 1137 | // UpRefs - A list of the outstanding upreferences that need to be resolved. | 
|  | 1138 | static std::vector<UpRefRecord> UpRefs; | 
|  | 1139 |  | 
|  | 1140 | /// HandleUpRefs - Every time we finish a new layer of types, this function is | 
|  | 1141 | /// called.  It loops through the UpRefs vector, which is a list of the | 
|  | 1142 | /// currently active types.  For each type, if the up reference is contained in | 
|  | 1143 | /// the newly completed type, we decrement the level count.  When the level | 
|  | 1144 | /// count reaches zero, the upreferenced type is the type that is passed in: | 
|  | 1145 | /// thus we can complete the cycle. | 
|  | 1146 | /// | 
|  | 1147 | static PATypeHolder HandleUpRefs(const Type *ty) { | 
| Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1148 | // If Ty isn't abstract, or if there are no up-references in it, then there is | 
|  | 1149 | // nothing to resolve here. | 
|  | 1150 | if (!ty->isAbstract() || UpRefs.empty()) return ty; | 
|  | 1151 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1152 | PATypeHolder Ty(ty); | 
|  | 1153 | UR_OUT("Type '" << Ty->getDescription() << | 
|  | 1154 | "' newly formed.  Resolving upreferences.\n" << | 
|  | 1155 | UpRefs.size() << " upreferences active!\n"); | 
|  | 1156 |  | 
|  | 1157 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes | 
|  | 1158 | // to zero), we resolve them all together before we resolve them to Ty.  At | 
|  | 1159 | // the end of the loop, if there is anything to resolve to Ty, it will be in | 
|  | 1160 | // this variable. | 
|  | 1161 | OpaqueType *TypeToResolve = 0; | 
|  | 1162 |  | 
|  | 1163 | for (unsigned i = 0; i != UpRefs.size(); ++i) { | 
|  | 1164 | UR_OUT("  UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " | 
|  | 1165 | << UpRefs[i].second->getDescription() << ") = " | 
|  | 1166 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); | 
|  | 1167 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { | 
|  | 1168 | // Decrement level of upreference | 
|  | 1169 | unsigned Level = --UpRefs[i].NestingLevel; | 
|  | 1170 | UpRefs[i].LastContainedTy = Ty; | 
|  | 1171 | UR_OUT("  Uplevel Ref Level = " << Level << "\n"); | 
|  | 1172 | if (Level == 0) {                     // Upreference should be resolved! | 
|  | 1173 | if (!TypeToResolve) { | 
|  | 1174 | TypeToResolve = UpRefs[i].UpRefTy; | 
|  | 1175 | } else { | 
|  | 1176 | UR_OUT("  * Resolving upreference for " | 
|  | 1177 | << UpRefs[i].second->getDescription() << "\n"; | 
|  | 1178 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); | 
|  | 1179 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); | 
|  | 1180 | UR_OUT("  * Type '" << OldName << "' refined upreference to: " | 
|  | 1181 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); | 
|  | 1182 | } | 
|  | 1183 | UpRefs.erase(UpRefs.begin()+i);     // Remove from upreference list... | 
|  | 1184 | --i;                                // Do not skip the next element... | 
|  | 1185 | } | 
|  | 1186 | } | 
|  | 1187 | } | 
|  | 1188 |  | 
|  | 1189 | if (TypeToResolve) { | 
|  | 1190 | UR_OUT("  * Resolving upreference for " | 
|  | 1191 | << UpRefs[i].second->getDescription() << "\n"; | 
|  | 1192 | std::string OldName = TypeToResolve->getDescription()); | 
|  | 1193 | TypeToResolve->refineAbstractTypeTo(Ty); | 
|  | 1194 | } | 
|  | 1195 |  | 
|  | 1196 | return Ty; | 
|  | 1197 | } | 
|  | 1198 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1199 | //===----------------------------------------------------------------------===// | 
|  | 1200 | //            RunVMAsmParser - Define an interface to this parser | 
|  | 1201 | //===----------------------------------------------------------------------===// | 
|  | 1202 | // | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1203 | static Module* RunParser(Module * M); | 
|  | 1204 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1205 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { | 
|  | 1206 | set_scan_file(F); | 
|  | 1207 |  | 
|  | 1208 | CurFilename = Filename; | 
|  | 1209 | return RunParser(new Module(CurFilename)); | 
|  | 1210 | } | 
|  | 1211 |  | 
|  | 1212 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { | 
|  | 1213 | set_scan_string(AsmString); | 
|  | 1214 |  | 
|  | 1215 | CurFilename = "from_memory"; | 
|  | 1216 | if (M == NULL) { | 
|  | 1217 | return RunParser(new Module (CurFilename)); | 
|  | 1218 | } else { | 
|  | 1219 | return RunParser(M); | 
|  | 1220 | } | 
|  | 1221 | } | 
|  | 1222 |  | 
|  | 1223 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1224 |  | 
|  | 1225 | /* Enabling traces.  */ | 
|  | 1226 | #ifndef YYDEBUG | 
|  | 1227 | # define YYDEBUG 0 | 
|  | 1228 | #endif | 
|  | 1229 |  | 
|  | 1230 | /* Enabling verbose error messages.  */ | 
|  | 1231 | #ifdef YYERROR_VERBOSE | 
|  | 1232 | # undef YYERROR_VERBOSE | 
|  | 1233 | # define YYERROR_VERBOSE 1 | 
|  | 1234 | #else | 
|  | 1235 | # define YYERROR_VERBOSE 0 | 
|  | 1236 | #endif | 
|  | 1237 |  | 
|  | 1238 | /* Enabling the token table.  */ | 
|  | 1239 | #ifndef YYTOKEN_TABLE | 
|  | 1240 | # define YYTOKEN_TABLE 0 | 
|  | 1241 | #endif | 
|  | 1242 |  | 
|  | 1243 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) | 
|  | 1244 | #line 901 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 1245 | typedef union YYSTYPE { | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1246 | llvm::Module                           *ModuleVal; | 
|  | 1247 | llvm::Function                         *FunctionVal; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1248 | llvm::BasicBlock                       *BasicBlockVal; | 
|  | 1249 | llvm::TerminatorInst                   *TermInstVal; | 
|  | 1250 | llvm::Instruction                      *InstVal; | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1251 | llvm::Constant                         *ConstVal; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1252 |  | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1253 | const llvm::Type                       *PrimType; | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1254 | std::list<llvm::PATypeHolder>          *TypeList; | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1255 | llvm::PATypeHolder                     *TypeVal; | 
|  | 1256 | llvm::Value                            *ValueVal; | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1257 | std::vector<llvm::Value*>              *ValueList; | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1258 | llvm::ArgListType                      *ArgList; | 
|  | 1259 | llvm::TypeWithAttrs                     TypeWithAttrs; | 
|  | 1260 | llvm::TypeWithAttrsList                *TypeWithAttrsList; | 
|  | 1261 | llvm::ValueRefList                     *ValueRefList; | 
|  | 1262 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1263 | // Represent the RHS of PHI node | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1264 | std::list<std::pair<llvm::Value*, | 
|  | 1265 | llvm::BasicBlock*> > *PHIList; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1266 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1267 | std::vector<llvm::Constant*>           *ConstVector; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1268 |  | 
|  | 1269 | llvm::GlobalValue::LinkageTypes         Linkage; | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1270 | llvm::GlobalValue::VisibilityTypes      Visibility; | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1271 | llvm::FunctionType::ParameterAttributes ParamAttrs; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1272 | llvm::APInt                       *APIntVal; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1273 | int64_t                           SInt64Val; | 
|  | 1274 | uint64_t                          UInt64Val; | 
|  | 1275 | int                               SIntVal; | 
|  | 1276 | unsigned                          UIntVal; | 
|  | 1277 | double                            FPVal; | 
|  | 1278 | bool                              BoolVal; | 
|  | 1279 |  | 
|  | 1280 | char                             *StrVal;   // This memory is strdup'd! | 
| Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1281 | llvm::ValID                       ValIDVal; // strdup'd memory maybe! | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1282 |  | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1283 | llvm::Instruction::BinaryOps      BinaryOpVal; | 
|  | 1284 | llvm::Instruction::TermOps        TermOpVal; | 
|  | 1285 | llvm::Instruction::MemoryOps      MemOpVal; | 
|  | 1286 | llvm::Instruction::CastOps        CastOpVal; | 
|  | 1287 | llvm::Instruction::OtherOps       OtherOpVal; | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1288 | llvm::ICmpInst::Predicate         IPredicate; | 
|  | 1289 | llvm::FCmpInst::Predicate         FPredicate; | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1290 | } YYSTYPE; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1291 | /* Line 196 of yacc.c.  */ | 
|  | 1292 | #line 1293 "llvmAsmParser.tab.c" | 
|  | 1293 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 
|  | 1294 | # define YYSTYPE_IS_DECLARED 1 | 
|  | 1295 | # define YYSTYPE_IS_TRIVIAL 1 | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1296 | #endif | 
|  | 1297 |  | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1298 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1299 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1300 | /* Copy the second part of user declarations.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1301 |  | 
|  | 1302 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1303 | /* Line 219 of yacc.c.  */ | 
|  | 1304 | #line 1305 "llvmAsmParser.tab.c" | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1305 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1306 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | 
|  | 1307 | # define YYSIZE_T __SIZE_TYPE__ | 
|  | 1308 | #endif | 
|  | 1309 | #if ! defined (YYSIZE_T) && defined (size_t) | 
|  | 1310 | # define YYSIZE_T size_t | 
|  | 1311 | #endif | 
|  | 1312 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) | 
|  | 1313 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | 
|  | 1314 | # define YYSIZE_T size_t | 
|  | 1315 | #endif | 
|  | 1316 | #if ! defined (YYSIZE_T) | 
|  | 1317 | # define YYSIZE_T unsigned int | 
|  | 1318 | #endif | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1319 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1320 | #ifndef YY_ | 
|  | 1321 | # if YYENABLE_NLS | 
|  | 1322 | #  if ENABLE_NLS | 
|  | 1323 | #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | 
|  | 1324 | #   define YY_(msgid) dgettext ("bison-runtime", msgid) | 
|  | 1325 | #  endif | 
|  | 1326 | # endif | 
|  | 1327 | # ifndef YY_ | 
|  | 1328 | #  define YY_(msgid) msgid | 
|  | 1329 | # endif | 
|  | 1330 | #endif | 
|  | 1331 |  | 
|  | 1332 | #if ! defined (yyoverflow) || YYERROR_VERBOSE | 
|  | 1333 |  | 
|  | 1334 | /* The parser invokes alloca or malloc; define the necessary symbols.  */ | 
|  | 1335 |  | 
|  | 1336 | # ifdef YYSTACK_USE_ALLOCA | 
|  | 1337 | #  if YYSTACK_USE_ALLOCA | 
|  | 1338 | #   ifdef __GNUC__ | 
|  | 1339 | #    define YYSTACK_ALLOC __builtin_alloca | 
|  | 1340 | #   else | 
|  | 1341 | #    define YYSTACK_ALLOC alloca | 
|  | 1342 | #    if defined (__STDC__) || defined (__cplusplus) | 
|  | 1343 | #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 
|  | 1344 | #     define YYINCLUDED_STDLIB_H | 
|  | 1345 | #    endif | 
|  | 1346 | #   endif | 
|  | 1347 | #  endif | 
|  | 1348 | # endif | 
|  | 1349 |  | 
|  | 1350 | # ifdef YYSTACK_ALLOC | 
|  | 1351 | /* Pacify GCC's `empty if-body' warning. */ | 
|  | 1352 | #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | 
|  | 1353 | #  ifndef YYSTACK_ALLOC_MAXIMUM | 
|  | 1354 | /* The OS might guarantee only one guard page at the bottom of the stack, | 
|  | 1355 | and a page size can be as small as 4096 bytes.  So we cannot safely | 
|  | 1356 | invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number | 
|  | 1357 | to allow for a few compiler-allocated temporary stack slots.  */ | 
|  | 1358 | #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ | 
|  | 1359 | #  endif | 
|  | 1360 | # else | 
|  | 1361 | #  define YYSTACK_ALLOC YYMALLOC | 
|  | 1362 | #  define YYSTACK_FREE YYFREE | 
|  | 1363 | #  ifndef YYSTACK_ALLOC_MAXIMUM | 
|  | 1364 | #   define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) | 
|  | 1365 | #  endif | 
|  | 1366 | #  ifdef __cplusplus | 
|  | 1367 | extern "C" { | 
|  | 1368 | #  endif | 
|  | 1369 | #  ifndef YYMALLOC | 
|  | 1370 | #   define YYMALLOC malloc | 
|  | 1371 | #   if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ | 
|  | 1372 | && (defined (__STDC__) || defined (__cplusplus))) | 
|  | 1373 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | 
|  | 1374 | #   endif | 
|  | 1375 | #  endif | 
|  | 1376 | #  ifndef YYFREE | 
|  | 1377 | #   define YYFREE free | 
|  | 1378 | #   if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ | 
|  | 1379 | && (defined (__STDC__) || defined (__cplusplus))) | 
|  | 1380 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | 
|  | 1381 | #   endif | 
|  | 1382 | #  endif | 
|  | 1383 | #  ifdef __cplusplus | 
|  | 1384 | } | 
|  | 1385 | #  endif | 
|  | 1386 | # endif | 
|  | 1387 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ | 
|  | 1388 |  | 
|  | 1389 |  | 
|  | 1390 | #if (! defined (yyoverflow) \ | 
|  | 1391 | && (! defined (__cplusplus) \ | 
|  | 1392 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) | 
|  | 1393 |  | 
|  | 1394 | /* A type that is properly aligned for any stack member.  */ | 
|  | 1395 | union yyalloc | 
|  | 1396 | { | 
|  | 1397 | short int yyss; | 
|  | 1398 | YYSTYPE yyvs; | 
|  | 1399 | }; | 
|  | 1400 |  | 
|  | 1401 | /* The size of the maximum gap between one aligned stack and the next.  */ | 
|  | 1402 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | 
|  | 1403 |  | 
|  | 1404 | /* The size of an array large to enough to hold all stacks, each with | 
|  | 1405 | N elements.  */ | 
|  | 1406 | # define YYSTACK_BYTES(N) \ | 
|  | 1407 | ((N) * (sizeof (short int) + sizeof (YYSTYPE))			\ | 
|  | 1408 | + YYSTACK_GAP_MAXIMUM) | 
|  | 1409 |  | 
|  | 1410 | /* Copy COUNT objects from FROM to TO.  The source and destination do | 
|  | 1411 | not overlap.  */ | 
|  | 1412 | # ifndef YYCOPY | 
|  | 1413 | #  if defined (__GNUC__) && 1 < __GNUC__ | 
|  | 1414 | #   define YYCOPY(To, From, Count) \ | 
|  | 1415 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | 
|  | 1416 | #  else | 
|  | 1417 | #   define YYCOPY(To, From, Count)		\ | 
|  | 1418 | do					\ | 
|  | 1419 | {					\ | 
|  | 1420 | YYSIZE_T yyi;				\ | 
|  | 1421 | for (yyi = 0; yyi < (Count); yyi++)	\ | 
|  | 1422 | (To)[yyi] = (From)[yyi];		\ | 
|  | 1423 | }					\ | 
|  | 1424 | while (0) | 
|  | 1425 | #  endif | 
|  | 1426 | # endif | 
|  | 1427 |  | 
|  | 1428 | /* Relocate STACK from its old location to the new one.  The | 
|  | 1429 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | 
|  | 1430 | elements in the stack, and YYPTR gives the new location of the | 
|  | 1431 | stack.  Advance YYPTR to a properly aligned location for the next | 
|  | 1432 | stack.  */ | 
|  | 1433 | # define YYSTACK_RELOCATE(Stack)					\ | 
|  | 1434 | do									\ | 
|  | 1435 | {									\ | 
|  | 1436 | YYSIZE_T yynewbytes;						\ | 
|  | 1437 | YYCOPY (&yyptr->Stack, Stack, yysize);				\ | 
|  | 1438 | Stack = &yyptr->Stack;						\ | 
|  | 1439 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 
|  | 1440 | yyptr += yynewbytes / sizeof (*yyptr);				\ | 
|  | 1441 | }									\ | 
|  | 1442 | while (0) | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 1443 |  | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1444 | #endif | 
|  | 1445 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1446 | #if defined (__STDC__) || defined (__cplusplus) | 
|  | 1447 | typedef signed char yysigned_char; | 
| Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1448 | #else | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1449 | typedef short int yysigned_char; | 
| Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1450 | #endif | 
|  | 1451 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1452 | /* YYFINAL -- State number of the termination state. */ | 
|  | 1453 | #define YYFINAL  40 | 
|  | 1454 | /* YYLAST -- Last index in YYTABLE.  */ | 
|  | 1455 | #define YYLAST   1429 | 
|  | 1456 |  | 
|  | 1457 | /* YYNTOKENS -- Number of terminals. */ | 
|  | 1458 | #define YYNTOKENS  148 | 
|  | 1459 | /* YYNNTS -- Number of nonterminals. */ | 
|  | 1460 | #define YYNNTS  78 | 
|  | 1461 | /* YYNRULES -- Number of rules. */ | 
|  | 1462 | #define YYNRULES  286 | 
|  | 1463 | /* YYNRULES -- Number of states. */ | 
|  | 1464 | #define YYNSTATES  559 | 
|  | 1465 |  | 
|  | 1466 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */ | 
|  | 1467 | #define YYUNDEFTOK  2 | 
|  | 1468 | #define YYMAXUTOK   388 | 
|  | 1469 |  | 
|  | 1470 | #define YYTRANSLATE(YYX)						\ | 
|  | 1471 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 
|  | 1472 |  | 
|  | 1473 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */ | 
|  | 1474 | static const unsigned char yytranslate[] = | 
|  | 1475 | { | 
|  | 1476 | 0,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1477 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1478 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1479 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1480 | 138,   139,   136,     2,   135,     2,     2,     2,     2,     2, | 
|  | 1481 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1482 | 143,   134,   144,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1483 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1484 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1485 | 2,   140,   137,   142,     2,     2,     2,     2,     2,   147, | 
|  | 1486 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1487 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1488 | 141,     2,     2,   145,     2,   146,     2,     2,     2,     2, | 
|  | 1489 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1490 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1491 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1492 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1493 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1494 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1495 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1496 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1497 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1498 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1499 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1500 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1501 | 2,     2,     2,     2,     2,     2,     1,     2,     3,     4, | 
|  | 1502 | 5,     6,     7,     8,     9,    10,    11,    12,    13,    14, | 
|  | 1503 | 15,    16,    17,    18,    19,    20,    21,    22,    23,    24, | 
|  | 1504 | 25,    26,    27,    28,    29,    30,    31,    32,    33,    34, | 
|  | 1505 | 35,    36,    37,    38,    39,    40,    41,    42,    43,    44, | 
|  | 1506 | 45,    46,    47,    48,    49,    50,    51,    52,    53,    54, | 
|  | 1507 | 55,    56,    57,    58,    59,    60,    61,    62,    63,    64, | 
|  | 1508 | 65,    66,    67,    68,    69,    70,    71,    72,    73,    74, | 
|  | 1509 | 75,    76,    77,    78,    79,    80,    81,    82,    83,    84, | 
|  | 1510 | 85,    86,    87,    88,    89,    90,    91,    92,    93,    94, | 
|  | 1511 | 95,    96,    97,    98,    99,   100,   101,   102,   103,   104, | 
|  | 1512 | 105,   106,   107,   108,   109,   110,   111,   112,   113,   114, | 
|  | 1513 | 115,   116,   117,   118,   119,   120,   121,   122,   123,   124, | 
|  | 1514 | 125,   126,   127,   128,   129,   130,   131,   132,   133 | 
|  | 1515 | }; | 
|  | 1516 |  | 
|  | 1517 | #if YYDEBUG | 
|  | 1518 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | 
|  | 1519 | YYRHS.  */ | 
|  | 1520 | static const unsigned short int yyprhs[] = | 
|  | 1521 | { | 
|  | 1522 | 0,     0,     3,     5,     7,     9,    11,    13,    15,    17, | 
|  | 1523 | 19,    21,    23,    25,    27,    29,    31,    33,    35,    37, | 
|  | 1524 | 39,    41,    43,    45,    47,    49,    51,    53,    55,    57, | 
|  | 1525 | 59,    61,    63,    65,    67,    69,    71,    73,    75,    77, | 
|  | 1526 | 79,    81,    83,    85,    87,    89,    91,    93,    95,    97, | 
|  | 1527 | 99,   101,   103,   105,   107,   109,   111,   113,   115,   117, | 
|  | 1528 | 119,   121,   122,   125,   126,   128,   130,   133,   134,   136, | 
|  | 1529 | 138,   140,   142,   144,   146,   148,   150,   151,   153,   154, | 
|  | 1530 | 156,   158,   159,   161,   163,   165,   167,   168,   170,   172, | 
|  | 1531 | 174,   176,   178,   181,   183,   185,   187,   189,   190,   193, | 
|  | 1532 | 195,   197,   198,   201,   202,   205,   206,   210,   213,   214, | 
|  | 1533 | 216,   217,   221,   223,   226,   228,   230,   232,   234,   236, | 
|  | 1534 | 238,   241,   243,   246,   252,   258,   264,   270,   274,   277, | 
|  | 1535 | 283,   288,   291,   293,   295,   297,   301,   303,   307,   309, | 
|  | 1536 | 310,   312,   316,   321,   325,   329,   334,   339,   343,   350, | 
|  | 1537 | 356,   359,   362,   365,   368,   371,   374,   377,   380,   383, | 
|  | 1538 | 386,   389,   392,   399,   405,   414,   421,   428,   436,   444, | 
|  | 1539 | 451,   460,   469,   473,   475,   477,   479,   481,   482,   484, | 
|  | 1540 | 487,   488,   492,   493,   497,   501,   503,   507,   511,   512, | 
|  | 1541 | 519,   520,   528,   529,   537,   540,   544,   546,   550,   554, | 
|  | 1542 | 558,   562,   564,   565,   571,   575,   577,   581,   583,   584, | 
|  | 1543 | 594,   596,   598,   603,   605,   607,   610,   614,   615,   617, | 
|  | 1544 | 619,   621,   623,   625,   627,   629,   631,   633,   637,   639, | 
|  | 1545 | 645,   647,   649,   651,   653,   655,   657,   660,   663,   666, | 
|  | 1546 | 670,   673,   674,   676,   679,   682,   686,   696,   706,   715, | 
|  | 1547 | 730,   732,   734,   741,   747,   750,   757,   765,   769,   775, | 
|  | 1548 | 776,   777,   781,   784,   786,   792,   798,   805,   812,   817, | 
|  | 1549 | 824,   829,   834,   841,   848,   851,   860,   862,   864,   865, | 
|  | 1550 | 869,   876,   880,   887,   890,   895,   902 | 
|  | 1551 | }; | 
|  | 1552 |  | 
|  | 1553 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | 
|  | 1554 | static const short int yyrhs[] = | 
|  | 1555 | { | 
|  | 1556 | 188,     0,    -1,    68,    -1,    69,    -1,    70,    -1,    71, | 
|  | 1557 | -1,    72,    -1,    73,    -1,    74,    -1,    75,    -1,    76, | 
|  | 1558 | -1,    80,    -1,    81,    -1,    82,    -1,    77,    -1,    78, | 
|  | 1559 | -1,    79,    -1,   111,    -1,   112,    -1,   113,    -1,   114, | 
|  | 1560 | -1,   115,    -1,   116,    -1,   117,    -1,   118,    -1,   119, | 
|  | 1561 | -1,   120,    -1,   121,    -1,   122,    -1,    85,    -1,    86, | 
|  | 1562 | -1,    87,    -1,    88,    -1,    89,    -1,    90,    -1,    91, | 
|  | 1563 | -1,    92,    -1,    93,    -1,    94,    -1,    95,    -1,    96, | 
|  | 1564 | -1,    97,    -1,    98,    -1,    99,    -1,   100,    -1,   101, | 
|  | 1565 | -1,   102,    -1,   103,    -1,   104,    -1,    91,    -1,    92, | 
|  | 1566 | -1,    93,    -1,    94,    -1,    23,    -1,    24,    -1,    11, | 
|  | 1567 | -1,    12,    -1,    13,    -1,    16,    -1,    19,    -1,   156, | 
|  | 1568 | -1,    -1,   156,   134,    -1,    -1,    17,    -1,    20,    -1, | 
|  | 1569 | 159,   134,    -1,    -1,    37,    -1,    39,    -1,    38,    -1, | 
|  | 1570 | 40,    -1,    42,    -1,    41,    -1,    43,    -1,    45,    -1, | 
|  | 1571 | -1,   133,    -1,    -1,    41,    -1,    43,    -1,    -1,    37, | 
|  | 1572 | -1,    38,    -1,    39,    -1,    42,    -1,    -1,    56,    -1, | 
|  | 1573 | 57,    -1,    58,    -1,    59,    -1,    60,    -1,    55,     4, | 
|  | 1574 | -1,   112,    -1,   113,    -1,   130,    -1,   131,    -1,    -1, | 
|  | 1575 | 168,   167,    -1,   129,    -1,   167,    -1,    -1,   170,   169, | 
|  | 1576 | -1,    -1,    48,     4,    -1,    -1,   135,    48,     4,    -1, | 
|  | 1577 | 31,    19,    -1,    -1,   173,    -1,    -1,   135,   176,   175, | 
|  | 1578 | -1,   173,    -1,    48,     4,    -1,    11,    -1,    12,    -1, | 
|  | 1579 | 13,    -1,    14,    -1,    44,    -1,   177,    -1,   178,   136, | 
|  | 1580 | -1,   210,    -1,   137,     4,    -1,   178,   138,   182,   139, | 
|  | 1581 | 170,    -1,    10,   138,   182,   139,   170,    -1,   140,     4, | 
|  | 1582 | 141,   178,   142,    -1,   143,     4,   141,   178,   144,    -1, | 
|  | 1583 | 145,   183,   146,    -1,   145,   146,    -1,   143,   145,   183, | 
|  | 1584 | 146,   144,    -1,   143,   145,   146,   144,    -1,   178,   168, | 
|  | 1585 | -1,   178,    -1,    10,    -1,   179,    -1,   181,   135,   179, | 
|  | 1586 | -1,   181,    -1,   181,   135,    34,    -1,    34,    -1,    -1, | 
|  | 1587 | 178,    -1,   183,   135,   178,    -1,   178,   140,   186,   142, | 
|  | 1588 | -1,   178,   140,   142,    -1,   178,   147,    19,    -1,   178, | 
|  | 1589 | 143,   186,   144,    -1,   178,   145,   186,   146,    -1,   178, | 
|  | 1590 | 145,   146,    -1,   178,   143,   145,   186,   146,   144,    -1, | 
|  | 1591 | 178,   143,   145,   146,   144,    -1,   178,    35,    -1,   178, | 
|  | 1592 | 36,    -1,   178,   210,    -1,   178,   185,    -1,   178,    22, | 
|  | 1593 | -1,   154,     3,    -1,   154,     5,    -1,   154,     4,    -1, | 
|  | 1594 | 154,     6,    -1,    11,    23,    -1,    11,    24,    -1,   155, | 
|  | 1595 | 9,    -1,   151,   138,   184,    33,   178,   139,    -1,   110, | 
|  | 1596 | 138,   184,   221,   139,    -1,   124,   138,   184,   135,   184, | 
|  | 1597 | 135,   184,   139,    -1,   149,   138,   184,   135,   184,   139, | 
|  | 1598 | -1,   150,   138,   184,   135,   184,   139,    -1,    83,   152, | 
|  | 1599 | 138,   184,   135,   184,   139,    -1,    84,   153,   138,   184, | 
|  | 1600 | 135,   184,   139,    -1,   126,   138,   184,   135,   184,   139, | 
|  | 1601 | -1,   127,   138,   184,   135,   184,   135,   184,   139,    -1, | 
|  | 1602 | 128,   138,   184,   135,   184,   135,   184,   139,    -1,   186, | 
|  | 1603 | 135,   184,    -1,   184,    -1,    29,    -1,    30,    -1,   189, | 
|  | 1604 | -1,    -1,   190,    -1,   189,   190,    -1,    -1,    28,   191, | 
|  | 1605 | 206,    -1,    -1,    27,   192,   207,    -1,    53,    52,   196, | 
|  | 1606 | -1,    21,    -1,   158,    15,   178,    -1,   158,    15,    10, | 
|  | 1607 | -1,    -1,   160,   163,   187,   184,   193,   175,    -1,    -1, | 
|  | 1608 | 160,   161,   163,   187,   184,   194,   175,    -1,    -1,   160, | 
|  | 1609 | 162,   163,   187,   178,   195,   175,    -1,    46,   197,    -1, | 
|  | 1610 | 49,   134,   198,    -1,    19,    -1,    47,   134,    19,    -1, | 
|  | 1611 | 61,   134,    19,    -1,   140,   199,   142,    -1,   199,   135, | 
|  | 1612 | 19,    -1,    19,    -1,    -1,   200,   135,   178,   168,   157, | 
|  | 1613 | -1,   178,   168,   157,    -1,   200,    -1,   200,   135,    34, | 
|  | 1614 | -1,    34,    -1,    -1,   166,   180,   159,   138,   201,   139, | 
|  | 1615 | 170,   174,   171,    -1,    25,    -1,   145,    -1,   165,   163, | 
|  | 1616 | 202,   203,    -1,    26,    -1,   146,    -1,   213,   205,    -1, | 
|  | 1617 | 164,   163,   202,    -1,    -1,    54,    -1,     3,    -1,     4, | 
|  | 1618 | -1,     9,    -1,    23,    -1,    24,    -1,    35,    -1,    36, | 
|  | 1619 | -1,    22,    -1,   143,   186,   144,    -1,   185,    -1,    52, | 
|  | 1620 | 208,    19,   135,    19,    -1,     7,    -1,     8,    -1,   156, | 
|  | 1621 | -1,   159,    -1,   210,    -1,   209,    -1,   178,   211,    -1, | 
|  | 1622 | 213,   214,    -1,   204,   214,    -1,   215,   158,   216,    -1, | 
|  | 1623 | 215,   218,    -1,    -1,    18,    -1,    62,   212,    -1,    62, | 
|  | 1624 | 10,    -1,    63,    14,   211,    -1,    63,    11,   211,   135, | 
|  | 1625 | 14,   211,   135,    14,   211,    -1,    64,   154,   211,   135, | 
|  | 1626 | 14,   211,   140,   217,   142,    -1,    64,   154,   211,   135, | 
|  | 1627 | 14,   211,   140,   142,    -1,    65,   166,   180,   211,   138, | 
|  | 1628 | 220,   139,   170,    33,    14,   211,    66,    14,   211,    -1, | 
|  | 1629 | 66,    -1,    67,    -1,   217,   154,   209,   135,    14,   211, | 
|  | 1630 | -1,   154,   209,   135,    14,   211,    -1,   158,   223,    -1, | 
|  | 1631 | 178,   140,   211,   135,   211,   142,    -1,   219,   135,   140, | 
|  | 1632 | 211,   135,   211,   142,    -1,   178,   211,   168,    -1,   220, | 
|  | 1633 | 135,   178,   211,   168,    -1,    -1,    -1,   221,   135,   212, | 
|  | 1634 | -1,    51,    50,    -1,    50,    -1,   149,   178,   211,   135, | 
|  | 1635 | 211,    -1,   150,   178,   211,   135,   211,    -1,    83,   152, | 
|  | 1636 | 178,   211,   135,   211,    -1,    84,   153,   178,   211,   135, | 
|  | 1637 | 211,    -1,   151,   212,    33,   178,    -1,   124,   212,   135, | 
|  | 1638 | 212,   135,   212,    -1,   125,   212,   135,   178,    -1,   126, | 
|  | 1639 | 212,   135,   212,    -1,   127,   212,   135,   212,   135,   212, | 
|  | 1640 | -1,   128,   212,   135,   212,   135,   212,    -1,   123,   219, | 
|  | 1641 | -1,   222,   166,   180,   211,   138,   220,   139,   170,    -1, | 
|  | 1642 | 225,    -1,    32,    -1,    -1,   105,   178,   172,    -1,   105, | 
|  | 1643 | 178,   135,    11,   211,   172,    -1,   106,   178,   172,    -1, | 
|  | 1644 | 106,   178,   135,    11,   211,   172,    -1,   107,   212,    -1, | 
|  | 1645 | 224,   108,   178,   211,    -1,   224,   109,   212,   135,   178, | 
|  | 1646 | 211,    -1,   110,   178,   211,   221,    -1 | 
|  | 1647 | }; | 
|  | 1648 |  | 
|  | 1649 | /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */ | 
|  | 1650 | static const unsigned short int yyrline[] = | 
|  | 1651 | { | 
|  | 1652 | 0,  1055,  1055,  1055,  1055,  1055,  1055,  1055,  1055,  1055, | 
|  | 1653 | 1055,  1056,  1056,  1056,  1056,  1056,  1056,  1057,  1057,  1057, | 
|  | 1654 | 1057,  1057,  1057,  1058,  1058,  1058,  1058,  1058,  1058,  1061, | 
|  | 1655 | 1061,  1062,  1062,  1063,  1063,  1064,  1064,  1065,  1065,  1069, | 
|  | 1656 | 1069,  1070,  1070,  1071,  1071,  1072,  1072,  1073,  1073,  1074, | 
|  | 1657 | 1074,  1075,  1075,  1076,  1077,  1082,  1083,  1083,  1085,  1085, | 
|  | 1658 | 1086,  1086,  1090,  1094,  1099,  1099,  1101,  1105,  1111,  1112, | 
|  | 1659 | 1113,  1114,  1115,  1119,  1120,  1121,  1125,  1126,  1130,  1131, | 
|  | 1660 | 1132,  1136,  1137,  1138,  1139,  1140,  1143,  1144,  1145,  1146, | 
|  | 1661 | 1147,  1148,  1149,  1156,  1157,  1158,  1159,  1162,  1163,  1168, | 
|  | 1662 | 1169,  1172,  1173,  1180,  1181,  1187,  1188,  1196,  1204,  1205, | 
|  | 1663 | 1210,  1211,  1212,  1217,  1230,  1230,  1230,  1230,  1233,  1237, | 
|  | 1664 | 1241,  1248,  1253,  1261,  1279,  1297,  1302,  1314,  1324,  1328, | 
|  | 1665 | 1338,  1345,  1352,  1359,  1364,  1369,  1376,  1377,  1384,  1391, | 
|  | 1666 | 1399,  1404,  1415,  1443,  1459,  1488,  1516,  1541,  1560,  1586, | 
|  | 1667 | 1606,  1618,  1625,  1691,  1701,  1711,  1723,  1735,  1743,  1755, | 
|  | 1668 | 1760,  1765,  1773,  1785,  1807,  1815,  1821,  1832,  1837,  1842, | 
|  | 1669 | 1848,  1854,  1863,  1867,  1875,  1875,  1886,  1891,  1899,  1900, | 
|  | 1670 | 1904,  1904,  1908,  1908,  1911,  1914,  1926,  1950,  1961,  1961, | 
|  | 1671 | 1971,  1971,  1979,  1979,  1989,  1992,  1998,  2011,  2015,  2020, | 
|  | 1672 | 2022,  2027,  2032,  2041,  2051,  2062,  2066,  2075,  2084,  2089, | 
|  | 1673 | 2201,  2201,  2203,  2212,  2212,  2214,  2219,  2231,  2235,  2240, | 
|  | 1674 | 2244,  2248,  2252,  2256,  2260,  2264,  2268,  2272,  2297,  2301, | 
|  | 1675 | 2315,  2319,  2323,  2327,  2333,  2333,  2339,  2348,  2352,  2361, | 
|  | 1676 | 2371,  2380,  2392,  2405,  2409,  2413,  2418,  2428,  2447,  2456, | 
|  | 1677 | 2523,  2527,  2534,  2545,  2558,  2568,  2579,  2589,  2597,  2605, | 
|  | 1678 | 2608,  2609,  2616,  2620,  2625,  2646,  2663,  2676,  2689,  2701, | 
|  | 1679 | 2709,  2716,  2722,  2728,  2734,  2749,  2813,  2818,  2822,  2829, | 
|  | 1680 | 2836,  2844,  2851,  2859,  2867,  2881,  2898 | 
|  | 1681 | }; | 
|  | 1682 | #endif | 
|  | 1683 |  | 
|  | 1684 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE | 
|  | 1685 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | 
|  | 1686 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | 
|  | 1687 | static const char *const yytname[] = | 
|  | 1688 | { | 
|  | 1689 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", | 
|  | 1690 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", | 
|  | 1691 | "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR", | 
|  | 1692 | "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION", | 
|  | 1693 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", | 
|  | 1694 | "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", | 
|  | 1695 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", | 
|  | 1696 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", | 
|  | 1697 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL", | 
|  | 1698 | "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK", | 
|  | 1699 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", | 
|  | 1700 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", | 
|  | 1701 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", | 
|  | 1702 | "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", | 
|  | 1703 | "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", | 
|  | 1704 | "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", | 
|  | 1705 | "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", | 
|  | 1706 | "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", | 
|  | 1707 | "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", | 
|  | 1708 | "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT", | 
|  | 1709 | "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", | 
|  | 1710 | "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", | 
|  | 1711 | "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType", | 
|  | 1712 | "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName", | 
|  | 1713 | "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage", | 
|  | 1714 | "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", | 
|  | 1715 | "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr", | 
|  | 1716 | "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection", | 
|  | 1717 | "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", | 
|  | 1718 | "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI", | 
|  | 1719 | "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module", | 
|  | 1720 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", | 
|  | 1721 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", | 
|  | 1722 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", | 
|  | 1723 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", | 
|  | 1724 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", | 
|  | 1725 | "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", | 
|  | 1726 | "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal", | 
|  | 1727 | "OptVolatile", "MemoryInst", 0 | 
|  | 1728 | }; | 
|  | 1729 | #endif | 
|  | 1730 |  | 
|  | 1731 | # ifdef YYPRINT | 
|  | 1732 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | 
|  | 1733 | token YYLEX-NUM.  */ | 
|  | 1734 | static const unsigned short int yytoknum[] = | 
|  | 1735 | { | 
|  | 1736 | 0,   256,   257,   258,   259,   260,   261,   262,   263,   264, | 
|  | 1737 | 265,   266,   267,   268,   269,   270,   271,   272,   273,   274, | 
|  | 1738 | 275,   276,   277,   278,   279,   280,   281,   282,   283,   284, | 
|  | 1739 | 285,   286,   287,   288,   289,   290,   291,   292,   293,   294, | 
|  | 1740 | 295,   296,   297,   298,   299,   300,   301,   302,   303,   304, | 
|  | 1741 | 305,   306,   307,   308,   309,   310,   311,   312,   313,   314, | 
|  | 1742 | 315,   316,   317,   318,   319,   320,   321,   322,   323,   324, | 
|  | 1743 | 325,   326,   327,   328,   329,   330,   331,   332,   333,   334, | 
|  | 1744 | 335,   336,   337,   338,   339,   340,   341,   342,   343,   344, | 
|  | 1745 | 345,   346,   347,   348,   349,   350,   351,   352,   353,   354, | 
|  | 1746 | 355,   356,   357,   358,   359,   360,   361,   362,   363,   364, | 
|  | 1747 | 365,   366,   367,   368,   369,   370,   371,   372,   373,   374, | 
|  | 1748 | 375,   376,   377,   378,   379,   380,   381,   382,   383,   384, | 
|  | 1749 | 385,   386,   387,   388,    61,    44,    42,    92,    40,    41, | 
|  | 1750 | 91,   120,    93,    60,    62,   123,   125,    99 | 
|  | 1751 | }; | 
|  | 1752 | # endif | 
|  | 1753 |  | 
|  | 1754 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */ | 
|  | 1755 | static const unsigned char yyr1[] = | 
|  | 1756 | { | 
|  | 1757 | 0,   148,   149,   149,   149,   149,   149,   149,   149,   149, | 
|  | 1758 | 149,   150,   150,   150,   150,   150,   150,   151,   151,   151, | 
|  | 1759 | 151,   151,   151,   151,   151,   151,   151,   151,   151,   152, | 
|  | 1760 | 152,   152,   152,   152,   152,   152,   152,   152,   152,   153, | 
|  | 1761 | 153,   153,   153,   153,   153,   153,   153,   153,   153,   153, | 
|  | 1762 | 153,   153,   153,   153,   153,   154,   155,   155,   156,   156, | 
|  | 1763 | 157,   157,   158,   158,   159,   159,   160,   160,   161,   161, | 
|  | 1764 | 161,   161,   161,   162,   162,   162,   163,   163,   164,   164, | 
|  | 1765 | 164,   165,   165,   165,   165,   165,   166,   166,   166,   166, | 
|  | 1766 | 166,   166,   166,   167,   167,   167,   167,   168,   168,   169, | 
|  | 1767 | 169,   170,   170,   171,   171,   172,   172,   173,   174,   174, | 
|  | 1768 | 175,   175,   176,   176,   177,   177,   177,   177,   178,   178, | 
|  | 1769 | 178,   178,   178,   178,   178,   178,   178,   178,   178,   178, | 
|  | 1770 | 178,   179,   180,   180,   181,   181,   182,   182,   182,   182, | 
|  | 1771 | 183,   183,   184,   184,   184,   184,   184,   184,   184,   184, | 
|  | 1772 | 184,   184,   184,   184,   184,   184,   184,   184,   184,   184, | 
|  | 1773 | 184,   184,   185,   185,   185,   185,   185,   185,   185,   185, | 
|  | 1774 | 185,   185,   186,   186,   187,   187,   188,   188,   189,   189, | 
|  | 1775 | 191,   190,   192,   190,   190,   190,   190,   190,   193,   190, | 
|  | 1776 | 194,   190,   195,   190,   190,   190,   196,   197,   197,   198, | 
|  | 1777 | 199,   199,   199,   200,   200,   201,   201,   201,   201,   202, | 
|  | 1778 | 203,   203,   204,   205,   205,   206,   207,   208,   208,   209, | 
|  | 1779 | 209,   209,   209,   209,   209,   209,   209,   209,   209,   209, | 
|  | 1780 | 210,   210,   210,   210,   211,   211,   212,   213,   213,   214, | 
|  | 1781 | 215,   215,   215,   216,   216,   216,   216,   216,   216,   216, | 
|  | 1782 | 216,   216,   217,   217,   218,   219,   219,   220,   220,   220, | 
|  | 1783 | 221,   221,   222,   222,   223,   223,   223,   223,   223,   223, | 
|  | 1784 | 223,   223,   223,   223,   223,   223,   223,   224,   224,   225, | 
|  | 1785 | 225,   225,   225,   225,   225,   225,   225 | 
|  | 1786 | }; | 
|  | 1787 |  | 
|  | 1788 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */ | 
|  | 1789 | static const unsigned char yyr2[] = | 
|  | 1790 | { | 
|  | 1791 | 0,     2,     1,     1,     1,     1,     1,     1,     1,     1, | 
|  | 1792 | 1,     1,     1,     1,     1,     1,     1,     1,     1,     1, | 
|  | 1793 | 1,     1,     1,     1,     1,     1,     1,     1,     1,     1, | 
|  | 1794 | 1,     1,     1,     1,     1,     1,     1,     1,     1,     1, | 
|  | 1795 | 1,     1,     1,     1,     1,     1,     1,     1,     1,     1, | 
|  | 1796 | 1,     1,     1,     1,     1,     1,     1,     1,     1,     1, | 
|  | 1797 | 1,     0,     2,     0,     1,     1,     2,     0,     1,     1, | 
|  | 1798 | 1,     1,     1,     1,     1,     1,     0,     1,     0,     1, | 
|  | 1799 | 1,     0,     1,     1,     1,     1,     0,     1,     1,     1, | 
|  | 1800 | 1,     1,     2,     1,     1,     1,     1,     0,     2,     1, | 
|  | 1801 | 1,     0,     2,     0,     2,     0,     3,     2,     0,     1, | 
|  | 1802 | 0,     3,     1,     2,     1,     1,     1,     1,     1,     1, | 
|  | 1803 | 2,     1,     2,     5,     5,     5,     5,     3,     2,     5, | 
|  | 1804 | 4,     2,     1,     1,     1,     3,     1,     3,     1,     0, | 
|  | 1805 | 1,     3,     4,     3,     3,     4,     4,     3,     6,     5, | 
|  | 1806 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|  | 1807 | 2,     2,     6,     5,     8,     6,     6,     7,     7,     6, | 
|  | 1808 | 8,     8,     3,     1,     1,     1,     1,     0,     1,     2, | 
|  | 1809 | 0,     3,     0,     3,     3,     1,     3,     3,     0,     6, | 
|  | 1810 | 0,     7,     0,     7,     2,     3,     1,     3,     3,     3, | 
|  | 1811 | 3,     1,     0,     5,     3,     1,     3,     1,     0,     9, | 
|  | 1812 | 1,     1,     4,     1,     1,     2,     3,     0,     1,     1, | 
|  | 1813 | 1,     1,     1,     1,     1,     1,     1,     3,     1,     5, | 
|  | 1814 | 1,     1,     1,     1,     1,     1,     2,     2,     2,     3, | 
|  | 1815 | 2,     0,     1,     2,     2,     3,     9,     9,     8,    14, | 
|  | 1816 | 1,     1,     6,     5,     2,     6,     7,     3,     5,     0, | 
|  | 1817 | 0,     3,     2,     1,     5,     5,     6,     6,     4,     6, | 
|  | 1818 | 4,     4,     6,     6,     2,     8,     1,     1,     0,     3, | 
|  | 1819 | 6,     3,     6,     2,     4,     6,     4 | 
|  | 1820 | }; | 
|  | 1821 |  | 
|  | 1822 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 
|  | 1823 | STATE-NUM when YYTABLE doesn't specify something else to do.  Zero | 
|  | 1824 | means the default is an error.  */ | 
|  | 1825 | static const unsigned short int yydefact[] = | 
|  | 1826 | { | 
|  | 1827 | 67,    58,    64,    59,    65,   185,   182,   180,     0,     0, | 
|  | 1828 | 0,     0,     0,     0,    76,     0,    67,   178,    78,    81, | 
|  | 1829 | 0,     0,   194,     0,     0,    62,     0,    66,    68,    70, | 
|  | 1830 | 69,    71,    73,    72,    74,    75,    77,    76,    76,     0, | 
|  | 1831 | 1,   179,    79,    80,    76,   183,    82,    83,    84,    85, | 
|  | 1832 | 76,   241,   181,   241,     0,     0,   202,   195,   196,   184, | 
|  | 1833 | 230,   231,   187,   114,   115,   116,   117,   118,     0,     0, | 
|  | 1834 | 0,     0,   232,   233,   119,   186,   121,     0,     0,   174, | 
|  | 1835 | 175,     0,    86,    86,   242,   238,    63,   213,   214,   215, | 
|  | 1836 | 237,   197,   198,   201,     0,   139,   122,     0,     0,     0, | 
|  | 1837 | 0,   128,   140,     0,   120,   139,     0,     0,   114,   115, | 
|  | 1838 | 116,     0,     0,     0,   188,     0,    87,    88,    89,    90, | 
|  | 1839 | 91,     0,   216,     0,   278,   240,     0,   199,   138,    97, | 
|  | 1840 | 134,   136,     0,     0,     0,     0,     0,     0,   127,     0, | 
|  | 1841 | 190,   192,   159,   160,   155,   157,   156,   158,   161,   154, | 
|  | 1842 | 150,   151,     2,     3,     4,     5,     6,     7,     8,     9, | 
|  | 1843 | 10,    14,    15,    16,    11,    12,    13,     0,     0,     0, | 
|  | 1844 | 17,    18,    19,    20,    21,    22,    23,    24,    25,    26, | 
|  | 1845 | 27,    28,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 1846 | 0,     0,     0,   153,   152,   110,    92,   133,   132,     0, | 
|  | 1847 | 210,   211,   212,   277,   263,     0,     0,     0,     0,    86, | 
|  | 1848 | 250,   251,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 1849 | 0,     0,     0,     0,     0,     0,     0,   239,    86,   254, | 
|  | 1850 | 0,   276,   200,   131,     0,   101,     0,     0,   130,     0, | 
|  | 1851 | 141,   101,   110,   110,    29,    30,    31,    32,    33,    34, | 
|  | 1852 | 35,    36,    37,    38,     0,    53,    54,    49,    50,    51, | 
|  | 1853 | 52,    39,    40,    41,    42,    43,    44,    45,    46,    47, | 
|  | 1854 | 48,     0,     0,     0,     0,     0,     0,   143,   173,     0, | 
|  | 1855 | 0,     0,   147,     0,   144,     0,     0,     0,     0,   189, | 
|  | 1856 | 0,   262,   244,     0,   243,     0,     0,    55,     0,     0, | 
|  | 1857 | 0,     0,   105,   105,   283,     0,     0,   274,     0,     0, | 
|  | 1858 | 0,     0,     0,     0,     0,     0,     0,     0,     0,    93, | 
|  | 1859 | 94,    95,    96,    98,   137,   135,   124,   125,   126,   129, | 
|  | 1860 | 123,   191,   193,     0,     0,   260,     0,     0,     0,     0, | 
|  | 1861 | 0,   142,   128,   140,     0,   145,   146,     0,     0,     0, | 
|  | 1862 | 0,     0,   112,   110,   208,   219,   220,   221,   226,   222, | 
|  | 1863 | 223,   224,   225,   217,     0,   228,   235,   234,   236,     0, | 
|  | 1864 | 245,     0,     0,     0,     0,     0,   279,     0,   281,   260, | 
|  | 1865 | 0,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 1866 | 0,     0,     0,    99,   100,   102,     0,     0,     0,     0, | 
|  | 1867 | 0,     0,     0,   172,   149,     0,     0,     0,     0,   107, | 
|  | 1868 | 113,   111,   207,    97,   205,     0,   218,     0,     0,     0, | 
|  | 1869 | 0,     0,     0,     0,     0,     0,     0,   286,     0,     0, | 
|  | 1870 | 0,   270,   271,     0,     0,     0,     0,   268,     0,   284, | 
|  | 1871 | 0,     0,     0,     0,   163,     0,     0,     0,     0,   148, | 
|  | 1872 | 0,     0,     0,    61,     0,   101,     0,   227,     0,     0, | 
|  | 1873 | 259,     0,     0,   105,   106,   105,     0,     0,     0,     0, | 
|  | 1874 | 0,   264,   265,   259,     0,     0,     0,   261,     0,   169, | 
|  | 1875 | 0,     0,   165,   166,   162,    60,   204,   206,    97,   108, | 
|  | 1876 | 0,     0,     0,     0,     0,   266,   267,     0,   280,   282, | 
|  | 1877 | 0,     0,   269,   272,   273,     0,   285,   167,   168,     0, | 
|  | 1878 | 0,     0,    61,   109,   103,   229,     0,     0,    97,     0, | 
|  | 1879 | 101,   255,     0,   101,   164,   170,   171,   203,     0,   209, | 
|  | 1880 | 0,   248,     0,     0,   257,     0,     0,   256,   275,   104, | 
|  | 1881 | 246,     0,   247,     0,    97,     0,     0,     0,   258,     0, | 
|  | 1882 | 0,     0,     0,   253,     0,     0,   252,     0,   249 | 
|  | 1883 | }; | 
|  | 1884 |  | 
|  | 1885 | /* YYDEFGOTO[NTERM-NUM]. */ | 
|  | 1886 | static const short int yydefgoto[] = | 
|  | 1887 | { | 
|  | 1888 | -1,   190,   191,   192,   254,   271,   111,   112,    72,   486, | 
|  | 1889 | 12,    73,    14,    37,    38,    39,    44,    50,   121,   323, | 
|  | 1890 | 233,   395,   326,   529,   376,   352,   514,   289,   353,    74, | 
|  | 1891 | 113,   130,   199,   131,   132,   103,   278,   365,   279,    81, | 
|  | 1892 | 15,    16,    17,    19,    18,   195,   242,   243,    59,    22, | 
|  | 1893 | 57,    94,   414,   415,   122,   202,    51,    89,    52,    45, | 
|  | 1894 | 417,   366,    76,   368,   294,    53,    85,    86,   227,   533, | 
|  | 1895 | 125,   307,   494,   398,   228,   229,   230,   231 | 
|  | 1896 | }; | 
|  | 1897 |  | 
|  | 1898 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 
|  | 1899 | STATE-NUM.  */ | 
|  | 1900 | #define YYPACT_NINF -440 | 
|  | 1901 | static const short int yypact[] = | 
|  | 1902 | { | 
|  | 1903 | 406,  -440,  -440,  -440,  -440,  -440,  -440,  -440,    -2,  -101, | 
|  | 1904 | 21,   -55,    80,   -20,    15,   132,   556,  -440,   253,   197, | 
|  | 1905 | -7,    87,  -440,    20,   207,  -440,   893,  -440,  -440,  -440, | 
|  | 1906 | -440,  -440,  -440,  -440,  -440,  -440,  -440,    97,    97,   125, | 
|  | 1907 | -440,  -440,  -440,  -440,    97,  -440,  -440,  -440,  -440,  -440, | 
|  | 1908 | 97,   235,  -440,     6,   240,   248,   258,  -440,  -440,  -440, | 
|  | 1909 | -440,  -440,   134,  -440,  -440,  -440,  -440,  -440,   269,   277, | 
|  | 1910 | 11,   123,  -440,  -440,  -440,    33,  -440,   125,   125,  -440, | 
|  | 1911 | -440,  1055,   128,   128,  -440,  -440,    47,  -440,  -440,  -440, | 
|  | 1912 | -440,  -440,  -440,  -440,   -57,   939,  -440,   154,   156,   488, | 
|  | 1913 | 134,  -440,    33,  -112,  -440,   939,  1055,  1149,    38,   281, | 
|  | 1914 | 289,   239,   293,   850,  -440,   299,  -440,  -440,  -440,  -440, | 
|  | 1915 | -440,  1168,  -440,     2,  1301,  -440,   285,  -440,  -440,    33, | 
|  | 1916 | -440,   170,   167,  1149,  1149,   164,   -97,  1149,  -440,   171, | 
|  | 1917 | -440,    33,  -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440, | 
|  | 1918 | -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440, | 
|  | 1919 | -440,  -440,  -440,  -440,  -440,  -440,  -440,   254,   446,   174, | 
|  | 1920 | -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440, | 
|  | 1921 | -440,  -440,   175,   176,   177,   178,   109,  1203,   676,   290, | 
|  | 1922 | 181,   182,   183,  -440,  -440,   187,  -440,   134,    33,    93, | 
|  | 1923 | -440,  -440,  -440,  -440,  -440,   273,  1217,   127,   313,   128, | 
|  | 1924 | -440,  -440,   254,   446,  1149,  1149,  1149,  1149,  1149,  1149, | 
|  | 1925 | 1149,  1149,  1149,  1149,  1149,  1149,  1149,  -440,   128,  -440, | 
|  | 1926 | 70,  -440,  -440,   -29,  1098,  -440,    72,   -39,  -440,   184, | 
|  | 1927 | 33,  -440,   187,   187,  -440,  -440,  -440,  -440,  -440,  -440, | 
|  | 1928 | -440,  -440,  -440,  -440,   188,  -440,  -440,  -440,  -440,  -440, | 
|  | 1929 | -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440,  -440, | 
|  | 1930 | -440,   196,  1055,  1055,  1055,  1055,  1055,  -440,  -440,    22, | 
|  | 1931 | 771,   -44,  -440,   -59,  -440,  1055,  1055,  1055,    -9,  -440, | 
|  | 1932 | 198,  -440,   134,   591,  -440,   728,   728,  -440,   728,  1168, | 
|  | 1933 | 1149,  1149,   112,   147,  -440,   591,    75,   190,   200,   214, | 
|  | 1934 | 215,   217,   219,   591,   591,   322,  1168,  1149,  1149,  -440, | 
|  | 1935 | -440,  -440,  -440,  -440,  -440,  -440,   -41,  -440,  -440,  -440, | 
|  | 1936 | -41,  -440,  -440,  1055,  1055,  -440,   230,   231,   232,   233, | 
|  | 1937 | 1055,  -440,   225,   850,   -43,  -440,  -440,   236,   241,   337, | 
|  | 1938 | 355,   371,  -440,   187,  1114,  -440,  -440,  -440,  -440,  -440, | 
|  | 1939 | -440,  -440,  -440,   323,  1055,  -440,  -440,  -440,  -440,   243, | 
|  | 1940 | -440,   244,   728,   591,   591,    17,  -440,    19,  -440,  -440, | 
|  | 1941 | 728,   242,  1149,  1149,  1149,  1149,  1149,   245,   246,  1149, | 
|  | 1942 | 728,   591,   249,  -440,  -440,  -440,   252,   255,   -24,  1055, | 
|  | 1943 | 1055,  1055,  1055,  -440,  -440,   247,  1055,  1055,  1149,  -440, | 
|  | 1944 | -440,  -440,  -440,    33,   257,   260,  -440,   375,   -37,   383, | 
|  | 1945 | 386,   264,   268,   272,   728,   400,   728,   275,   282,   728, | 
|  | 1946 | 284,    33,  -440,   295,   296,   728,   728,    33,   270,  -440, | 
|  | 1947 | 1149,  1055,  1055,  1149,  -440,   297,   298,   301,   303,  -440, | 
|  | 1948 | 300,   302,   150,    32,  1133,  -440,   305,  -440,   728,   728, | 
|  | 1949 | 1149,   728,   728,   307,  -440,   307,   728,   311,  1149,  1149, | 
|  | 1950 | 1149,  -440,  -440,  1149,   591,   308,   310,  -440,  1055,  -440, | 
|  | 1951 | 1055,  1055,  -440,  -440,  -440,  -440,  -440,  -440,    33,    46, | 
|  | 1952 | 397,   315,   314,   591,    26,  -440,  -440,   376,  -440,  -440, | 
|  | 1953 | 309,   728,  -440,  -440,  -440,    89,  -440,  -440,  -440,   317, | 
|  | 1954 | 319,   321,    32,  -440,   413,  -440,   449,     7,  -440,  1149, | 
|  | 1955 | -440,  -440,   324,  -440,  -440,  -440,  -440,  -440,   460,  -440, | 
|  | 1956 | 728,  -440,   976,     9,   -29,   591,   149,  -440,   -41,  -440, | 
|  | 1957 | -440,   330,  -440,   976,  -440,   453,   454,   336,   -29,   728, | 
|  | 1958 | 728,   461,   412,  -440,   728,   465,  -440,   728,  -440 | 
|  | 1959 | }; | 
|  | 1960 |  | 
|  | 1961 | /* YYPGOTO[NTERM-NUM].  */ | 
|  | 1962 | static const short int yypgoto[] = | 
|  | 1963 | { | 
|  | 1964 | -440,   358,   359,   361,   274,   276,  -206,  -440,     0,   -19, | 
|  | 1965 | 401,    13,  -440,  -440,  -440,    31,  -440,  -440,  -178,  -309, | 
|  | 1966 | -394,  -440,  -236,  -440,  -297,    -1,  -440,  -207,  -440,  -440, | 
|  | 1967 | -25,   263,  -252,  -440,   387,   404,   -69,  -110,  -162,   160, | 
|  | 1968 | -440,  -440,   490,  -440,  -440,  -440,  -440,  -440,  -440,  -440, | 
|  | 1969 | -440,  -440,  -440,  -440,   426,  -440,  -440,  -440,  -440,  -440, | 
|  | 1970 | -440,  -439,   -73,   100,  -212,  -440,   457,  -440,  -440,  -440, | 
|  | 1971 | -440,  -440,    40,   135,  -440,  -440,  -440,  -440 | 
|  | 1972 | }; | 
|  | 1973 |  | 
|  | 1974 | /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If | 
|  | 1975 | positive, shift that token.  If negative, reduce the rule which | 
|  | 1976 | number is the opposite.  If zero, do what YYDEFACT says. | 
|  | 1977 | If YYTABLE_NINF, syntax error.  */ | 
|  | 1978 | #define YYTABLE_NINF -178 | 
|  | 1979 | static const short int yytable[] = | 
|  | 1980 | { | 
|  | 1981 | 11,    75,   298,   193,   304,   330,   378,   308,   309,   310, | 
|  | 1982 | 311,   312,   114,    13,   315,    98,    11,   394,   297,   453, | 
|  | 1983 | 297,   394,   350,   137,    84,   281,   283,   200,   424,    13, | 
|  | 1984 | 426,   299,    87,    23,   138,   331,   332,   140,   137,   351, | 
|  | 1985 | 194,   -55,   -55,   -55,   -55,    20,   102,   372,     1,   239, | 
|  | 1986 | 316,     3,    28,    29,    30,    31,    32,    33,    34,    21, | 
|  | 1987 | 35,   142,   143,     1,   390,   425,     3,   425,    77,    78, | 
|  | 1988 | 129,   319,   320,    24,   102,    82,   340,   350,   126,    25, | 
|  | 1989 | 129,    83,   141,   319,   320,   127,    11,   346,   393,   321, | 
|  | 1990 | 322,   340,   340,   541,   512,    26,   198,   104,   340,   105, | 
|  | 1991 | 345,   321,   322,   405,   547,   328,   392,   457,   236,   237, | 
|  | 1992 | 2,   443,   240,     4,    27,   444,    60,    61,   344,   100, | 
|  | 1993 | 108,   109,   110,    66,   534,     1,     2,    54,     3,     4, | 
|  | 1994 | 60,    61,    40,   100,    63,    64,    65,    66,   295,     1, | 
|  | 1995 | 2,   296,     3,     4,   319,   320,   411,   201,    36,   531, | 
|  | 1996 | 548,   542,    88,    67,    79,    80,    99,   340,   319,   320, | 
|  | 1997 | 56,   519,   321,   322,   341,   520,   498,    67,   499,   104, | 
|  | 1998 | 430,   105,   432,   433,   434,   393,   321,   322,   317,   318, | 
|  | 1999 | 394,   293,   545,   115,   116,   117,   118,   119,   120,   302, | 
|  | 2000 | 303,   293,   305,   306,   293,   293,   293,   293,   293,   313, | 
|  | 2001 | 314,   293,   418,   335,   336,   337,   338,   339,   104,   129, | 
|  | 2002 | 105,   104,   290,   105,   327,   380,   347,   348,   349,   489, | 
|  | 2003 | 367,    55,   367,   367,   519,   367,    58,   394,   523,   394, | 
|  | 2004 | 36,   477,   367,   193,    46,    47,    48,   106,   107,    49, | 
|  | 2005 | 367,   367,   144,   145,   146,   147,    68,   375,   104,    69, | 
|  | 2006 | 105,   277,    70,    84,    71,   343,   502,   503,   504,    91, | 
|  | 2007 | 68,   319,   320,    69,   396,   397,    70,    92,    71,   101, | 
|  | 2008 | 194,   403,    95,    96,   198,   373,   374,    93,   393,   321, | 
|  | 2009 | 322,    97,   377,   104,   536,   105,   104,   538,   105,   484, | 
|  | 2010 | -56,   198,   391,   293,    42,   133,    43,   134,   -57,   367, | 
|  | 2011 | 367,   367,   148,   196,   232,   234,   235,   367,   238,   284, | 
|  | 2012 | 241,   532,   272,   273,   274,   275,   276,   367,   367,   285, | 
|  | 2013 | 286,   287,   288,   291,   297,   381,   333,   543,   329,   413, | 
|  | 2014 | 445,   446,   447,   448,   334,   382,   354,   450,   451,   244, | 
|  | 2015 | 245,   246,   247,   248,   249,   250,   251,   252,   253,   383, | 
|  | 2016 | 384,   367,   385,   367,   386,   389,   367,   293,   431,   293, | 
|  | 2017 | 293,   293,   367,   367,   437,   399,   400,   401,   402,   404, | 
|  | 2018 | 408,   406,   475,   476,   409,   410,   407,   416,   419,   420, | 
|  | 2019 | 435,   436,   429,   452,   440,   367,   367,   441,   367,   367, | 
|  | 2020 | 442,   449,   454,   367,   456,   369,   370,   458,   371,   455, | 
|  | 2021 | 459,   367,   460,   461,   464,   379,  -177,   462,   473,   509, | 
|  | 2022 | 443,   510,   511,   387,   388,   474,   515,   466,   293,   468, | 
|  | 2023 | 367,   -63,     1,     2,   425,     3,     4,     5,   367,   488, | 
|  | 2024 | 469,   470,   478,     6,     7,   493,   480,   479,   481,   482, | 
|  | 2025 | 490,   483,   497,   293,   293,   293,   501,   507,   493,   508, | 
|  | 2026 | 516,   521,     8,   485,   517,     9,   524,   367,   525,    10, | 
|  | 2027 | 526,   528,   367,   530,   539,   546,   537,   549,   550,   255, | 
|  | 2028 | 256,   551,   421,   422,   423,   554,   367,   367,   555,   557, | 
|  | 2029 | 428,   367,   224,   225,   367,   226,   300,   124,   513,   301, | 
|  | 2030 | 438,   439,   139,   527,   535,    60,    61,   325,   100,    63, | 
|  | 2031 | 64,    65,    66,   136,     1,     2,    41,     3,     4,   123, | 
|  | 2032 | 90,     0,   485,   505,   427,     0,     0,     0,     0,     0, | 
|  | 2033 | 0,     0,     0,     0,   463,     0,   465,     0,     0,   467, | 
|  | 2034 | 0,     0,    67,     0,     0,   471,   472,   257,   258,   259, | 
|  | 2035 | 260,   261,   262,   263,   264,   265,   266,   267,   268,   269, | 
|  | 2036 | 270,     0,     0,     0,     0,     0,  -176,     0,   491,   492, | 
|  | 2037 | 0,   495,   496,     0,     0,     0,   500,     0,     0,     0, | 
|  | 2038 | 0,   -63,     1,     2,   506,     3,     4,     5,     0,     0, | 
|  | 2039 | 0,     0,     0,     6,     7,     0,     0,     0,     0,     0, | 
|  | 2040 | 0,     0,     0,   518,   355,   356,     0,     0,    60,    61, | 
|  | 2041 | 357,   522,     8,     0,     0,     9,     0,     1,     2,    10, | 
|  | 2042 | 3,     4,     0,   358,   359,   360,     0,     0,     0,     0, | 
|  | 2043 | 0,     0,     0,     0,     0,    68,   361,   362,    69,     0, | 
|  | 2044 | 540,    70,     0,    71,   135,   544,     0,     0,     0,     0, | 
|  | 2045 | 0,     0,     0,   363,     0,     0,     0,     0,     0,   552, | 
|  | 2046 | 553,     0,     0,     0,   556,     0,     0,   558,     0,   152, | 
|  | 2047 | 153,   154,   155,   156,   157,   158,   159,   160,   161,   162, | 
|  | 2048 | 163,   164,   165,   166,   167,   168,     0,     0,     0,     0, | 
|  | 2049 | 0,     0,     0,    60,    61,     0,   100,   108,   109,   110, | 
|  | 2050 | 66,     0,     1,     2,     0,     3,     4,     0,     0,     0, | 
|  | 2051 | 0,   169,   170,   171,   172,   173,   174,   175,   176,   177, | 
|  | 2052 | 178,   179,   180,   181,     0,   182,     0,   183,   184,   185, | 
|  | 2053 | 67,     0,     0,     0,     0,     0,     0,   104,     0,   105, | 
|  | 2054 | 0,   355,   356,     0,   364,    60,    61,   357,     0,     0, | 
|  | 2055 | 0,     0,     0,     0,     1,     2,     0,     3,     4,     0, | 
|  | 2056 | 358,   359,   360,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2057 | 0,     0,     0,   361,   362,     0,     0,     0,     0,     0, | 
|  | 2058 | 0,     0,     0,     0,     0,     0,     0,     0,    60,    61, | 
|  | 2059 | 363,   100,   108,   109,   110,    66,     0,     1,     2,     0, | 
|  | 2060 | 3,     4,     0,     0,     0,     0,   152,   153,   154,   155, | 
|  | 2061 | 156,   157,   158,   159,   160,   161,   162,   163,   164,   165, | 
|  | 2062 | 166,   167,   168,    68,     0,    67,    69,     0,     0,    70, | 
|  | 2063 | 0,    71,   282,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2064 | 0,     0,     0,     0,     0,     0,     0,     0,   169,   170, | 
|  | 2065 | 171,   172,   173,   174,   175,   176,   177,   178,   179,   180, | 
|  | 2066 | 181,     0,   182,     0,   183,   184,   185,    60,    61,     0, | 
|  | 2067 | 0,     0,     0,     0,     0,     0,     1,     2,     0,     3, | 
|  | 2068 | 4,   364,   149,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2069 | 0,     0,     0,     0,     0,   150,   151,     0,     0,     0, | 
|  | 2070 | 0,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2071 | 60,    61,     0,    62,    63,    64,    65,    66,    68,     1, | 
|  | 2072 | 2,    69,     3,     4,    70,     0,    71,   342,   152,   153, | 
|  | 2073 | 154,   155,   156,   157,   158,   159,   160,   161,   162,   163, | 
|  | 2074 | 164,   165,   166,   167,   168,     0,     0,    67,     0,     0, | 
|  | 2075 | 0,     0,     0,     0,     0,     0,    60,    61,     0,   100, | 
|  | 2076 | 63,    64,    65,    66,     0,     1,     2,     0,     3,     4, | 
|  | 2077 | 169,   170,   171,   172,   173,   174,   175,   176,   177,   178, | 
|  | 2078 | 179,   180,   181,   128,   182,     0,   183,   184,   185,   355, | 
|  | 2079 | 356,     0,     0,    67,     0,   357,   104,     0,   105,     0, | 
|  | 2080 | 186,     0,     0,   187,     0,   188,     0,   189,   358,   359, | 
|  | 2081 | 360,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2082 | 0,   361,   362,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2083 | 0,     0,     0,     0,     0,     0,     0,     0,   363,     0, | 
|  | 2084 | 68,     0,     0,    69,     0,     0,    70,     0,    71,     0, | 
|  | 2085 | 0,     0,     0,     0,   152,   153,   154,   155,   156,   157, | 
|  | 2086 | 158,   159,   160,   161,   162,   163,   164,   165,   166,   167, | 
|  | 2087 | 168,     0,    60,    61,     0,   100,   108,   109,   110,    66, | 
|  | 2088 | 0,     1,     2,     0,     3,     4,    68,     0,     0,    69, | 
|  | 2089 | 0,     0,    70,     0,    71,     0,   169,   170,   171,   172, | 
|  | 2090 | 173,   174,   175,   176,   177,   178,   179,   180,   181,    67, | 
|  | 2091 | 182,     0,   183,   184,   185,    60,    61,     0,   100,    63, | 
|  | 2092 | 64,    65,    66,     0,     1,     2,     0,     3,     4,   364, | 
|  | 2093 | 0,    60,    61,     0,   100,    63,    64,    65,    66,     0, | 
|  | 2094 | 1,     2,   324,     3,     4,     0,     0,     0,     0,     0, | 
|  | 2095 | 60,    61,    67,   100,    63,    64,    65,    66,   412,     1, | 
|  | 2096 | 2,     0,     3,     4,     0,     0,    60,    61,    67,   100, | 
|  | 2097 | 63,    64,    65,    66,     0,     1,     2,   487,     3,     4, | 
|  | 2098 | 0,     0,     0,     0,     0,    60,    61,    67,   197,    63, | 
|  | 2099 | 64,    65,    66,     0,     1,     2,     0,     3,     4,     0, | 
|  | 2100 | 0,     0,    68,    67,     0,    69,     0,     0,    70,     0, | 
|  | 2101 | 71,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2102 | 60,    61,    67,   100,   108,   109,   110,    66,     0,     1, | 
|  | 2103 | 2,     0,     3,     4,    60,    61,     0,   292,    63,    64, | 
|  | 2104 | 65,    66,     0,     1,     2,    68,     3,     4,    69,     0, | 
|  | 2105 | 0,    70,     0,    71,     0,     0,     0,    67,     0,     0, | 
|  | 2106 | 0,    68,     0,     0,    69,     0,     0,    70,     0,    71, | 
|  | 2107 | 0,    67,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2108 | 68,     0,     0,    69,     0,     0,    70,     0,    71,     0, | 
|  | 2109 | 0,     0,     0,     0,     0,     0,    68,     0,     0,    69, | 
|  | 2110 | 0,     0,    70,     0,    71,     0,     0,     0,     0,     0, | 
|  | 2111 | 0,     0,     0,     0,     0,    68,     0,     0,    69,     0, | 
|  | 2112 | 0,    70,     0,    71,     0,     0,     0,     0,     0,     0, | 
|  | 2113 | 0,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2114 | 0,     0,     0,   203,     0,     0,     0,     0,     0,     0, | 
|  | 2115 | 68,     0,     0,    69,     0,     0,    70,     0,   280,     0, | 
|  | 2116 | 0,   204,   205,     0,    68,     0,     0,    69,     0,     0, | 
|  | 2117 | 70,     0,    71,   206,   207,   208,   209,   210,   211,   152, | 
|  | 2118 | 153,   154,   155,   156,   157,   158,   159,   160,   161,   162, | 
|  | 2119 | 163,   164,   165,   166,   212,   213,     0,     0,     0,     0, | 
|  | 2120 | 0,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|  | 2121 | 0,     0,     0,     0,     0,     0,   214,   215,   216,     0, | 
|  | 2122 | 0,   217,   170,   171,   172,   173,   174,   175,   176,   177, | 
|  | 2123 | 178,   179,   180,   181,   218,   219,   220,   221,   222,   223 | 
|  | 2124 | }; | 
|  | 2125 |  | 
|  | 2126 | static const short int yycheck[] = | 
|  | 2127 | { | 
|  | 2128 | 0,    26,   208,   113,   216,   241,   303,   219,   220,   221, | 
|  | 2129 | 222,   223,    81,     0,   226,     4,    16,   326,    11,   413, | 
|  | 2130 | 11,   330,    31,   135,    18,   187,   188,    25,    11,    16, | 
|  | 2131 | 11,   209,    26,   134,   146,   242,   243,   106,   135,    48, | 
|  | 2132 | 113,     3,     4,     5,     6,    47,    71,   299,    16,   146, | 
|  | 2133 | 228,    19,    37,    38,    39,    40,    41,    42,    43,    61, | 
|  | 2134 | 45,    23,    24,    16,   316,    48,    19,    48,    37,    38, | 
|  | 2135 | 95,   112,   113,    52,    99,    44,   135,    31,   135,   134, | 
|  | 2136 | 105,    50,   107,   112,   113,   142,    86,   146,   129,   130, | 
|  | 2137 | 131,   135,   135,   532,   488,    15,   121,   136,   135,   138, | 
|  | 2138 | 144,   130,   131,   146,   543,   144,   318,   144,   133,   134, | 
|  | 2139 | 17,   135,   137,    20,   134,   139,     7,     8,   280,    10, | 
|  | 2140 | 11,    12,    13,    14,   518,    16,    17,   134,    19,    20, | 
|  | 2141 | 7,     8,     0,    10,    11,    12,    13,    14,    11,    16, | 
|  | 2142 | 17,    14,    19,    20,   112,   113,   353,   145,   133,   142, | 
|  | 2143 | 544,   142,   146,    44,    29,    30,   145,   135,   112,   113, | 
|  | 2144 | 140,   135,   130,   131,   142,   139,   463,    44,   465,   136, | 
|  | 2145 | 382,   138,   384,   385,   386,   129,   130,   131,   108,   109, | 
|  | 2146 | 489,   206,    33,    55,    56,    57,    58,    59,    60,   214, | 
|  | 2147 | 215,   216,   217,   218,   219,   220,   221,   222,   223,   224, | 
|  | 2148 | 225,   226,   364,   272,   273,   274,   275,   276,   136,   234, | 
|  | 2149 | 138,   136,   199,   138,   142,   140,   285,   286,   287,   455, | 
|  | 2150 | 293,   134,   295,   296,   135,   298,    19,   536,   139,   538, | 
|  | 2151 | 133,   443,   305,   343,    37,    38,    39,    77,    78,    42, | 
|  | 2152 | 313,   314,     3,     4,     5,     6,   137,   135,   136,   140, | 
|  | 2153 | 138,   142,   143,    18,   145,   280,   468,   469,   470,    19, | 
|  | 2154 | 137,   112,   113,   140,   333,   334,   143,    19,   145,   146, | 
|  | 2155 | 343,   340,   138,     4,   299,   300,   301,    19,   129,   130, | 
|  | 2156 | 131,     4,   135,   136,   520,   138,   136,   523,   138,   139, | 
|  | 2157 | 9,   316,   317,   318,    41,   141,    43,   141,     9,   372, | 
|  | 2158 | 373,   374,     9,     4,    19,   135,   139,   380,   144,    19, | 
|  | 2159 | 139,   517,   138,   138,   138,   138,   138,   390,   391,   138, | 
|  | 2160 | 138,   138,   135,    50,    11,   135,   138,   533,   144,   354, | 
|  | 2161 | 399,   400,   401,   402,   138,   135,   138,   406,   407,    85, | 
|  | 2162 | 86,    87,    88,    89,    90,    91,    92,    93,    94,   135, | 
|  | 2163 | 135,   424,   135,   426,   135,    33,   429,   382,   383,   384, | 
|  | 2164 | 385,   386,   435,   436,   389,   135,   135,   135,   135,   144, | 
|  | 2165 | 33,   135,   441,   442,    19,     4,   135,    54,   135,   135, | 
|  | 2166 | 135,   135,   140,   408,   135,   458,   459,   135,   461,   462, | 
|  | 2167 | 135,   144,   135,   466,    19,   295,   296,    14,   298,   139, | 
|  | 2168 | 14,   474,   138,   135,     4,   305,     0,   135,   138,   478, | 
|  | 2169 | 135,   480,   481,   313,   314,   440,    19,   135,   443,   135, | 
|  | 2170 | 493,    15,    16,    17,    48,    19,    20,    21,   501,   454, | 
|  | 2171 | 135,   135,   135,    27,    28,   460,   135,   139,   135,   139, | 
|  | 2172 | 135,   139,   135,   468,   469,   470,   135,   139,   473,   139, | 
|  | 2173 | 135,   142,    46,   453,   140,    49,   139,   530,   139,    53, | 
|  | 2174 | 139,    48,   535,    14,     4,   135,   142,    14,    14,    23, | 
|  | 2175 | 24,   135,   372,   373,   374,    14,   549,   550,    66,    14, | 
|  | 2176 | 380,   554,   124,   124,   557,   124,   212,    86,   489,   213, | 
|  | 2177 | 390,   391,   105,   512,   519,     7,     8,   234,    10,    11, | 
|  | 2178 | 12,    13,    14,    99,    16,    17,    16,    19,    20,    83, | 
|  | 2179 | 53,    -1,   512,   473,   379,    -1,    -1,    -1,    -1,    -1, | 
|  | 2180 | -1,    -1,    -1,    -1,   424,    -1,   426,    -1,    -1,   429, | 
|  | 2181 | -1,    -1,    44,    -1,    -1,   435,   436,    91,    92,    93, | 
|  | 2182 | 94,    95,    96,    97,    98,    99,   100,   101,   102,   103, | 
|  | 2183 | 104,    -1,    -1,    -1,    -1,    -1,     0,    -1,   458,   459, | 
|  | 2184 | -1,   461,   462,    -1,    -1,    -1,   466,    -1,    -1,    -1, | 
|  | 2185 | -1,    15,    16,    17,   474,    19,    20,    21,    -1,    -1, | 
|  | 2186 | -1,    -1,    -1,    27,    28,    -1,    -1,    -1,    -1,    -1, | 
|  | 2187 | -1,    -1,    -1,   493,     3,     4,    -1,    -1,     7,     8, | 
|  | 2188 | 9,   501,    46,    -1,    -1,    49,    -1,    16,    17,    53, | 
|  | 2189 | 19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,    -1, | 
|  | 2190 | -1,    -1,    -1,    -1,    -1,   137,    35,    36,   140,    -1, | 
|  | 2191 | 530,   143,    -1,   145,   146,   535,    -1,    -1,    -1,    -1, | 
|  | 2192 | -1,    -1,    -1,    52,    -1,    -1,    -1,    -1,    -1,   549, | 
|  | 2193 | 550,    -1,    -1,    -1,   554,    -1,    -1,   557,    -1,    68, | 
|  | 2194 | 69,    70,    71,    72,    73,    74,    75,    76,    77,    78, | 
|  | 2195 | 79,    80,    81,    82,    83,    84,    -1,    -1,    -1,    -1, | 
|  | 2196 | -1,    -1,    -1,     7,     8,    -1,    10,    11,    12,    13, | 
|  | 2197 | 14,    -1,    16,    17,    -1,    19,    20,    -1,    -1,    -1, | 
|  | 2198 | -1,   110,   111,   112,   113,   114,   115,   116,   117,   118, | 
|  | 2199 | 119,   120,   121,   122,    -1,   124,    -1,   126,   127,   128, | 
|  | 2200 | 44,    -1,    -1,    -1,    -1,    -1,    -1,   136,    -1,   138, | 
|  | 2201 | -1,     3,     4,    -1,   143,     7,     8,     9,    -1,    -1, | 
|  | 2202 | -1,    -1,    -1,    -1,    16,    17,    -1,    19,    20,    -1, | 
|  | 2203 | 22,    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2204 | -1,    -1,    -1,    35,    36,    -1,    -1,    -1,    -1,    -1, | 
|  | 2205 | -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     7,     8, | 
|  | 2206 | 52,    10,    11,    12,    13,    14,    -1,    16,    17,    -1, | 
|  | 2207 | 19,    20,    -1,    -1,    -1,    -1,    68,    69,    70,    71, | 
|  | 2208 | 72,    73,    74,    75,    76,    77,    78,    79,    80,    81, | 
|  | 2209 | 82,    83,    84,   137,    -1,    44,   140,    -1,    -1,   143, | 
|  | 2210 | -1,   145,   146,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2211 | -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   110,   111, | 
|  | 2212 | 112,   113,   114,   115,   116,   117,   118,   119,   120,   121, | 
|  | 2213 | 122,    -1,   124,    -1,   126,   127,   128,     7,     8,    -1, | 
|  | 2214 | -1,    -1,    -1,    -1,    -1,    -1,    16,    17,    -1,    19, | 
|  | 2215 | 20,   143,    22,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2216 | -1,    -1,    -1,    -1,    -1,    35,    36,    -1,    -1,    -1, | 
|  | 2217 | -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2218 | 7,     8,    -1,    10,    11,    12,    13,    14,   137,    16, | 
|  | 2219 | 17,   140,    19,    20,   143,    -1,   145,   146,    68,    69, | 
|  | 2220 | 70,    71,    72,    73,    74,    75,    76,    77,    78,    79, | 
|  | 2221 | 80,    81,    82,    83,    84,    -1,    -1,    44,    -1,    -1, | 
|  | 2222 | -1,    -1,    -1,    -1,    -1,    -1,     7,     8,    -1,    10, | 
|  | 2223 | 11,    12,    13,    14,    -1,    16,    17,    -1,    19,    20, | 
|  | 2224 | 110,   111,   112,   113,   114,   115,   116,   117,   118,   119, | 
|  | 2225 | 120,   121,   122,    34,   124,    -1,   126,   127,   128,     3, | 
|  | 2226 | 4,    -1,    -1,    44,    -1,     9,   136,    -1,   138,    -1, | 
|  | 2227 | 140,    -1,    -1,   143,    -1,   145,    -1,   147,    22,    23, | 
|  | 2228 | 24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2229 | -1,    35,    36,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2230 | -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    52,    -1, | 
|  | 2231 | 137,    -1,    -1,   140,    -1,    -1,   143,    -1,   145,    -1, | 
|  | 2232 | -1,    -1,    -1,    -1,    68,    69,    70,    71,    72,    73, | 
|  | 2233 | 74,    75,    76,    77,    78,    79,    80,    81,    82,    83, | 
|  | 2234 | 84,    -1,     7,     8,    -1,    10,    11,    12,    13,    14, | 
|  | 2235 | -1,    16,    17,    -1,    19,    20,   137,    -1,    -1,   140, | 
|  | 2236 | -1,    -1,   143,    -1,   145,    -1,   110,   111,   112,   113, | 
|  | 2237 | 114,   115,   116,   117,   118,   119,   120,   121,   122,    44, | 
|  | 2238 | 124,    -1,   126,   127,   128,     7,     8,    -1,    10,    11, | 
|  | 2239 | 12,    13,    14,    -1,    16,    17,    -1,    19,    20,   143, | 
|  | 2240 | -1,     7,     8,    -1,    10,    11,    12,    13,    14,    -1, | 
|  | 2241 | 16,    17,    34,    19,    20,    -1,    -1,    -1,    -1,    -1, | 
|  | 2242 | 7,     8,    44,    10,    11,    12,    13,    14,    34,    16, | 
|  | 2243 | 17,    -1,    19,    20,    -1,    -1,     7,     8,    44,    10, | 
|  | 2244 | 11,    12,    13,    14,    -1,    16,    17,    34,    19,    20, | 
|  | 2245 | -1,    -1,    -1,    -1,    -1,     7,     8,    44,    10,    11, | 
|  | 2246 | 12,    13,    14,    -1,    16,    17,    -1,    19,    20,    -1, | 
|  | 2247 | -1,    -1,   137,    44,    -1,   140,    -1,    -1,   143,    -1, | 
|  | 2248 | 145,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2249 | 7,     8,    44,    10,    11,    12,    13,    14,    -1,    16, | 
|  | 2250 | 17,    -1,    19,    20,     7,     8,    -1,    10,    11,    12, | 
|  | 2251 | 13,    14,    -1,    16,    17,   137,    19,    20,   140,    -1, | 
|  | 2252 | -1,   143,    -1,   145,    -1,    -1,    -1,    44,    -1,    -1, | 
|  | 2253 | -1,   137,    -1,    -1,   140,    -1,    -1,   143,    -1,   145, | 
|  | 2254 | -1,    44,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2255 | 137,    -1,    -1,   140,    -1,    -1,   143,    -1,   145,    -1, | 
|  | 2256 | -1,    -1,    -1,    -1,    -1,    -1,   137,    -1,    -1,   140, | 
|  | 2257 | -1,    -1,   143,    -1,   145,    -1,    -1,    -1,    -1,    -1, | 
|  | 2258 | -1,    -1,    -1,    -1,    -1,   137,    -1,    -1,   140,    -1, | 
|  | 2259 | -1,   143,    -1,   145,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2260 | -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2261 | -1,    -1,    -1,    32,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2262 | 137,    -1,    -1,   140,    -1,    -1,   143,    -1,   145,    -1, | 
|  | 2263 | -1,    50,    51,    -1,   137,    -1,    -1,   140,    -1,    -1, | 
|  | 2264 | 143,    -1,   145,    62,    63,    64,    65,    66,    67,    68, | 
|  | 2265 | 69,    70,    71,    72,    73,    74,    75,    76,    77,    78, | 
|  | 2266 | 79,    80,    81,    82,    83,    84,    -1,    -1,    -1,    -1, | 
|  | 2267 | -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1, | 
|  | 2268 | -1,    -1,    -1,    -1,    -1,    -1,   105,   106,   107,    -1, | 
|  | 2269 | -1,   110,   111,   112,   113,   114,   115,   116,   117,   118, | 
|  | 2270 | 119,   120,   121,   122,   123,   124,   125,   126,   127,   128 | 
|  | 2271 | }; | 
|  | 2272 |  | 
|  | 2273 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 
|  | 2274 | symbol of state STATE-NUM.  */ | 
|  | 2275 | static const unsigned char yystos[] = | 
|  | 2276 | { | 
|  | 2277 | 0,    16,    17,    19,    20,    21,    27,    28,    46,    49, | 
|  | 2278 | 53,   156,   158,   159,   160,   188,   189,   190,   192,   191, | 
|  | 2279 | 47,    61,   197,   134,    52,   134,    15,   134,    37,    38, | 
|  | 2280 | 39,    40,    41,    42,    43,    45,   133,   161,   162,   163, | 
|  | 2281 | 0,   190,    41,    43,   164,   207,    37,    38,    39,    42, | 
|  | 2282 | 165,   204,   206,   213,   134,   134,   140,   198,    19,   196, | 
|  | 2283 | 7,     8,    10,    11,    12,    13,    14,    44,   137,   140, | 
|  | 2284 | 143,   145,   156,   159,   177,   178,   210,   163,   163,    29, | 
|  | 2285 | 30,   187,   163,   163,    18,   214,   215,    26,   146,   205, | 
|  | 2286 | 214,    19,    19,    19,   199,   138,     4,     4,     4,   145, | 
|  | 2287 | 10,   146,   178,   183,   136,   138,   187,   187,    11,    12, | 
|  | 2288 | 13,   154,   155,   178,   184,    55,    56,    57,    58,    59, | 
|  | 2289 | 60,   166,   202,   202,   158,   218,   135,   142,    34,   178, | 
|  | 2290 | 179,   181,   182,   141,   141,   146,   183,   135,   146,   182, | 
|  | 2291 | 184,   178,    23,    24,     3,     4,     5,     6,     9,    22, | 
|  | 2292 | 35,    36,    68,    69,    70,    71,    72,    73,    74,    75, | 
|  | 2293 | 76,    77,    78,    79,    80,    81,    82,    83,    84,   110, | 
|  | 2294 | 111,   112,   113,   114,   115,   116,   117,   118,   119,   120, | 
|  | 2295 | 121,   122,   124,   126,   127,   128,   140,   143,   145,   147, | 
|  | 2296 | 149,   150,   151,   185,   210,   193,     4,    10,   178,   180, | 
|  | 2297 | 25,   145,   203,    32,    50,    51,    62,    63,    64,    65, | 
|  | 2298 | 66,    67,    83,    84,   105,   106,   107,   110,   123,   124, | 
|  | 2299 | 125,   126,   127,   128,   149,   150,   151,   216,   222,   223, | 
|  | 2300 | 224,   225,    19,   168,   135,   139,   178,   178,   144,   146, | 
|  | 2301 | 178,   139,   194,   195,    85,    86,    87,    88,    89,    90, | 
|  | 2302 | 91,    92,    93,    94,   152,    23,    24,    91,    92,    93, | 
|  | 2303 | 94,    95,    96,    97,    98,    99,   100,   101,   102,   103, | 
|  | 2304 | 104,   153,   138,   138,   138,   138,   138,   142,   184,   186, | 
|  | 2305 | 145,   186,   146,   186,    19,   138,   138,   138,   135,   175, | 
|  | 2306 | 159,    50,    10,   178,   212,    11,    14,    11,   154,   166, | 
|  | 2307 | 152,   153,   178,   178,   212,   178,   178,   219,   212,   212, | 
|  | 2308 | 212,   212,   212,   178,   178,   212,   166,   108,   109,   112, | 
|  | 2309 | 113,   130,   131,   167,    34,   179,   170,   142,   144,   144, | 
|  | 2310 | 170,   175,   175,   138,   138,   184,   184,   184,   184,   184, | 
|  | 2311 | 135,   142,   146,   178,   186,   144,   146,   184,   184,   184, | 
|  | 2312 | 31,    48,   173,   176,   138,     3,     4,     9,    22,    23, | 
|  | 2313 | 24,    35,    36,    52,   143,   185,   209,   210,   211,   211, | 
|  | 2314 | 211,   211,   180,   178,   178,   135,   172,   135,   172,   211, | 
|  | 2315 | 140,   135,   135,   135,   135,   135,   135,   211,   211,    33, | 
|  | 2316 | 180,   178,   212,   129,   167,   169,   184,   184,   221,   135, | 
|  | 2317 | 135,   135,   135,   184,   144,   146,   135,   135,    33,    19, | 
|  | 2318 | 4,   175,    34,   178,   200,   201,    54,   208,   186,   135, | 
|  | 2319 | 135,   211,   211,   211,    11,    48,    11,   221,   211,   140, | 
|  | 2320 | 212,   178,   212,   212,   212,   135,   135,   178,   211,   211, | 
|  | 2321 | 135,   135,   135,   135,   139,   184,   184,   184,   184,   144, | 
|  | 2322 | 184,   184,   178,   168,   135,   139,    19,   144,    14,    14, | 
|  | 2323 | 138,   135,   135,   211,     4,   211,   135,   211,   135,   135, | 
|  | 2324 | 135,   211,   211,   138,   178,   184,   184,   212,   135,   139, | 
|  | 2325 | 135,   135,   139,   139,   139,   156,   157,    34,   178,   170, | 
|  | 2326 | 135,   211,   211,   178,   220,   211,   211,   135,   172,   172, | 
|  | 2327 | 211,   135,   212,   212,   212,   220,   211,   139,   139,   184, | 
|  | 2328 | 184,   184,   168,   173,   174,    19,   135,   140,   211,   135, | 
|  | 2329 | 139,   142,   211,   139,   139,   139,   139,   157,    48,   171, | 
|  | 2330 | 14,   142,   154,   217,   168,   178,   170,   142,   170,     4, | 
|  | 2331 | 211,   209,   142,   154,   211,    33,   135,   209,   168,    14, | 
|  | 2332 | 14,   135,   211,   211,    14,    66,   211,    14,   211 | 
|  | 2333 | }; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2334 |  | 
|  | 2335 | #define yyerrok		(yyerrstatus = 0) | 
|  | 2336 | #define yyclearin	(yychar = YYEMPTY) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2337 | #define YYEMPTY		(-2) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2338 | #define YYEOF		0 | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2339 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2340 | #define YYACCEPT	goto yyacceptlab | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2341 | #define YYABORT		goto yyabortlab | 
|  | 2342 | #define YYERROR		goto yyerrorlab | 
|  | 2343 |  | 
|  | 2344 |  | 
|  | 2345 | /* Like YYERROR except do call yyerror.  This remains here temporarily | 
|  | 2346 | to ease the transition to the new meaning of YYERROR, for GCC. | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2347 | Once GCC version 2 has supplanted version 1, this can go.  */ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2348 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2349 | #define YYFAIL		goto yyerrlab | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2350 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2351 | #define YYRECOVERING()  (!!yyerrstatus) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2352 |  | 
|  | 2353 | #define YYBACKUP(Token, Value)					\ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2354 | do								\ | 
|  | 2355 | if (yychar == YYEMPTY && yylen == 1)				\ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2356 | {								\ | 
|  | 2357 | yychar = (Token);						\ | 
|  | 2358 | yylval = (Value);						\ | 
|  | 2359 | yytoken = YYTRANSLATE (yychar);				\ | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2360 | YYPOPSTACK;						\ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2361 | goto yybackup;						\ | 
|  | 2362 | }								\ | 
|  | 2363 | else								\ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2364 | {								\ | 
|  | 2365 | yyerror (YY_("syntax error: cannot back up")); \ | 
|  | 2366 | YYERROR;							\ | 
|  | 2367 | }								\ | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2368 | while (0) | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2369 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2370 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2371 | #define YYTERROR	1 | 
|  | 2372 | #define YYERRCODE	256 | 
|  | 2373 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2374 |  | 
|  | 2375 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | 
|  | 2376 | If N is 0, then set CURRENT to the empty location which ends | 
|  | 2377 | the previous symbol: RHS[0] (always defined).  */ | 
|  | 2378 |  | 
|  | 2379 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | 
|  | 2380 | #ifndef YYLLOC_DEFAULT | 
|  | 2381 | # define YYLLOC_DEFAULT(Current, Rhs, N)				\ | 
|  | 2382 | do									\ | 
|  | 2383 | if (N)								\ | 
|  | 2384 | {								\ | 
|  | 2385 | (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\ | 
|  | 2386 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\ | 
|  | 2387 | (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\ | 
|  | 2388 | (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\ | 
|  | 2389 | }								\ | 
|  | 2390 | else								\ | 
|  | 2391 | {								\ | 
|  | 2392 | (Current).first_line   = (Current).last_line   =		\ | 
|  | 2393 | YYRHSLOC (Rhs, 0).last_line;				\ | 
|  | 2394 | (Current).first_column = (Current).last_column =		\ | 
|  | 2395 | YYRHSLOC (Rhs, 0).last_column;				\ | 
|  | 2396 | }								\ | 
|  | 2397 | while (0) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2398 | #endif | 
|  | 2399 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2400 |  | 
|  | 2401 | /* YY_LOCATION_PRINT -- Print the location on the stream. | 
|  | 2402 | This macro was not mandated originally: define only if we know | 
|  | 2403 | we won't break user code: when these are the locations we know.  */ | 
|  | 2404 |  | 
|  | 2405 | #ifndef YY_LOCATION_PRINT | 
|  | 2406 | # if YYLTYPE_IS_TRIVIAL | 
|  | 2407 | #  define YY_LOCATION_PRINT(File, Loc)			\ | 
|  | 2408 | fprintf (File, "%d.%d-%d.%d",			\ | 
|  | 2409 | (Loc).first_line, (Loc).first_column,	\ | 
|  | 2410 | (Loc).last_line,  (Loc).last_column) | 
|  | 2411 | # else | 
|  | 2412 | #  define YY_LOCATION_PRINT(File, Loc) ((void) 0) | 
|  | 2413 | # endif | 
|  | 2414 | #endif | 
|  | 2415 |  | 
|  | 2416 |  | 
|  | 2417 | /* YYLEX -- calling `yylex' with the right arguments.  */ | 
|  | 2418 |  | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2419 | #ifdef YYLEX_PARAM | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2420 | # define YYLEX yylex (YYLEX_PARAM) | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2421 | #else | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2422 | # define YYLEX yylex () | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2423 | #endif | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2424 |  | 
|  | 2425 | /* Enable debugging if requested.  */ | 
|  | 2426 | #if YYDEBUG | 
|  | 2427 |  | 
|  | 2428 | # ifndef YYFPRINTF | 
|  | 2429 | #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | 
|  | 2430 | #  define YYFPRINTF fprintf | 
|  | 2431 | # endif | 
|  | 2432 |  | 
|  | 2433 | # define YYDPRINTF(Args)			\ | 
|  | 2434 | do {						\ | 
|  | 2435 | if (yydebug)					\ | 
|  | 2436 | YYFPRINTF Args;				\ | 
|  | 2437 | } while (0) | 
|  | 2438 |  | 
|  | 2439 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location)		\ | 
|  | 2440 | do {								\ | 
|  | 2441 | if (yydebug)							\ | 
|  | 2442 | {								\ | 
|  | 2443 | YYFPRINTF (stderr, "%s ", Title);				\ | 
|  | 2444 | yysymprint (stderr,					\ | 
|  | 2445 | Type, Value);	\ | 
|  | 2446 | YYFPRINTF (stderr, "\n");					\ | 
|  | 2447 | }								\ | 
|  | 2448 | } while (0) | 
|  | 2449 |  | 
|  | 2450 | /*------------------------------------------------------------------. | 
|  | 2451 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | 
|  | 2452 | | TOP (included).                                                   | | 
|  | 2453 | `------------------------------------------------------------------*/ | 
|  | 2454 |  | 
|  | 2455 | #if defined (__STDC__) || defined (__cplusplus) | 
|  | 2456 | static void | 
|  | 2457 | yy_stack_print (short int *bottom, short int *top) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2458 | #else | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2459 | static void | 
|  | 2460 | yy_stack_print (bottom, top) | 
|  | 2461 | short int *bottom; | 
|  | 2462 | short int *top; | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2463 | #endif | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2464 | { | 
|  | 2465 | YYFPRINTF (stderr, "Stack now"); | 
|  | 2466 | for (/* Nothing. */; bottom <= top; ++bottom) | 
|  | 2467 | YYFPRINTF (stderr, " %d", *bottom); | 
|  | 2468 | YYFPRINTF (stderr, "\n"); | 
|  | 2469 | } | 
|  | 2470 |  | 
|  | 2471 | # define YY_STACK_PRINT(Bottom, Top)				\ | 
|  | 2472 | do {								\ | 
|  | 2473 | if (yydebug)							\ | 
|  | 2474 | yy_stack_print ((Bottom), (Top));				\ | 
|  | 2475 | } while (0) | 
|  | 2476 |  | 
|  | 2477 |  | 
|  | 2478 | /*------------------------------------------------. | 
|  | 2479 | | Report that the YYRULE is going to be reduced.  | | 
|  | 2480 | `------------------------------------------------*/ | 
|  | 2481 |  | 
|  | 2482 | #if defined (__STDC__) || defined (__cplusplus) | 
|  | 2483 | static void | 
|  | 2484 | yy_reduce_print (int yyrule) | 
|  | 2485 | #else | 
|  | 2486 | static void | 
|  | 2487 | yy_reduce_print (yyrule) | 
|  | 2488 | int yyrule; | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2489 | #endif | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2490 | { | 
|  | 2491 | int yyi; | 
|  | 2492 | unsigned long int yylno = yyrline[yyrule]; | 
|  | 2493 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", | 
|  | 2494 | yyrule - 1, yylno); | 
|  | 2495 | /* Print the symbols being reduced, and their result.  */ | 
|  | 2496 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | 
|  | 2497 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); | 
|  | 2498 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); | 
|  | 2499 | } | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2500 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2501 | # define YY_REDUCE_PRINT(Rule)		\ | 
|  | 2502 | do {					\ | 
|  | 2503 | if (yydebug)				\ | 
|  | 2504 | yy_reduce_print (Rule);		\ | 
|  | 2505 | } while (0) | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2506 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2507 | /* Nonzero means print parse trace.  It is left uninitialized so that | 
|  | 2508 | multiple parsers can coexist.  */ | 
|  | 2509 | int yydebug; | 
|  | 2510 | #else /* !YYDEBUG */ | 
|  | 2511 | # define YYDPRINTF(Args) | 
|  | 2512 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | 
|  | 2513 | # define YY_STACK_PRINT(Bottom, Top) | 
|  | 2514 | # define YY_REDUCE_PRINT(Rule) | 
|  | 2515 | #endif /* !YYDEBUG */ | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2516 |  | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2517 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2518 | /* YYINITDEPTH -- initial size of the parser's stacks.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2519 | #ifndef	YYINITDEPTH | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2520 | # define YYINITDEPTH 200 | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2521 | #endif | 
|  | 2522 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2523 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | 
|  | 2524 | if the built-in stack extension method is used). | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2525 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2526 | Do not make this value too large; the results are undefined if | 
|  | 2527 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) | 
|  | 2528 | evaluated with infinite-precision integer arithmetic.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2529 |  | 
|  | 2530 | #ifndef YYMAXDEPTH | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2531 | # define YYMAXDEPTH 10000 | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2532 | #endif | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2533 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2534 |  | 
|  | 2535 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2536 | #if YYERROR_VERBOSE | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2537 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2538 | # ifndef yystrlen | 
|  | 2539 | #  if defined (__GLIBC__) && defined (_STRING_H) | 
|  | 2540 | #   define yystrlen strlen | 
|  | 2541 | #  else | 
|  | 2542 | /* Return the length of YYSTR.  */ | 
|  | 2543 | static YYSIZE_T | 
|  | 2544 | #   if defined (__STDC__) || defined (__cplusplus) | 
|  | 2545 | yystrlen (const char *yystr) | 
|  | 2546 | #   else | 
|  | 2547 | yystrlen (yystr) | 
|  | 2548 | const char *yystr; | 
|  | 2549 | #   endif | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2550 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2551 | const char *yys = yystr; | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2552 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2553 | while (*yys++ != '\0') | 
|  | 2554 | continue; | 
|  | 2555 |  | 
|  | 2556 | return yys - yystr - 1; | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2557 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2558 | #  endif | 
|  | 2559 | # endif | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2560 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2561 | # ifndef yystpcpy | 
|  | 2562 | #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | 
|  | 2563 | #   define yystpcpy stpcpy | 
|  | 2564 | #  else | 
|  | 2565 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | 
|  | 2566 | YYDEST.  */ | 
|  | 2567 | static char * | 
|  | 2568 | #   if defined (__STDC__) || defined (__cplusplus) | 
|  | 2569 | yystpcpy (char *yydest, const char *yysrc) | 
|  | 2570 | #   else | 
|  | 2571 | yystpcpy (yydest, yysrc) | 
|  | 2572 | char *yydest; | 
|  | 2573 | const char *yysrc; | 
|  | 2574 | #   endif | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2575 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2576 | char *yyd = yydest; | 
|  | 2577 | const char *yys = yysrc; | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2578 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2579 | while ((*yyd++ = *yys++) != '\0') | 
|  | 2580 | continue; | 
|  | 2581 |  | 
|  | 2582 | return yyd - 1; | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2583 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2584 | #  endif | 
|  | 2585 | # endif | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2586 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2587 | # ifndef yytnamerr | 
|  | 2588 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary | 
|  | 2589 | quotes and backslashes, so that it's suitable for yyerror.  The | 
|  | 2590 | heuristic is that double-quoting is unnecessary unless the string | 
|  | 2591 | contains an apostrophe, a comma, or backslash (other than | 
|  | 2592 | backslash-backslash).  YYSTR is taken from yytname.  If YYRES is | 
|  | 2593 | null, do not copy; instead, return the length of what the result | 
|  | 2594 | would have been.  */ | 
|  | 2595 | static YYSIZE_T | 
|  | 2596 | yytnamerr (char *yyres, const char *yystr) | 
|  | 2597 | { | 
|  | 2598 | if (*yystr == '"') | 
|  | 2599 | { | 
|  | 2600 | size_t yyn = 0; | 
|  | 2601 | char const *yyp = yystr; | 
|  | 2602 |  | 
|  | 2603 | for (;;) | 
|  | 2604 | switch (*++yyp) | 
|  | 2605 | { | 
|  | 2606 | case '\'': | 
|  | 2607 | case ',': | 
|  | 2608 | goto do_not_strip_quotes; | 
|  | 2609 |  | 
|  | 2610 | case '\\': | 
|  | 2611 | if (*++yyp != '\\') | 
|  | 2612 | goto do_not_strip_quotes; | 
|  | 2613 | /* Fall through.  */ | 
|  | 2614 | default: | 
|  | 2615 | if (yyres) | 
|  | 2616 | yyres[yyn] = *yyp; | 
|  | 2617 | yyn++; | 
|  | 2618 | break; | 
|  | 2619 |  | 
|  | 2620 | case '"': | 
|  | 2621 | if (yyres) | 
|  | 2622 | yyres[yyn] = '\0'; | 
|  | 2623 | return yyn; | 
|  | 2624 | } | 
|  | 2625 | do_not_strip_quotes: ; | 
|  | 2626 | } | 
|  | 2627 |  | 
|  | 2628 | if (! yyres) | 
|  | 2629 | return yystrlen (yystr); | 
|  | 2630 |  | 
|  | 2631 | return yystpcpy (yyres, yystr) - yyres; | 
|  | 2632 | } | 
|  | 2633 | # endif | 
|  | 2634 |  | 
|  | 2635 | #endif /* YYERROR_VERBOSE */ | 
|  | 2636 |  | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2637 |  | 
|  | 2638 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2639 | #if YYDEBUG | 
|  | 2640 | /*--------------------------------. | 
|  | 2641 | | Print this symbol on YYOUTPUT.  | | 
|  | 2642 | `--------------------------------*/ | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 2643 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2644 | #if defined (__STDC__) || defined (__cplusplus) | 
|  | 2645 | static void | 
|  | 2646 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2647 | #else | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2648 | static void | 
|  | 2649 | yysymprint (yyoutput, yytype, yyvaluep) | 
|  | 2650 | FILE *yyoutput; | 
|  | 2651 | int yytype; | 
|  | 2652 | YYSTYPE *yyvaluep; | 
|  | 2653 | #endif | 
|  | 2654 | { | 
|  | 2655 | /* Pacify ``unused variable'' warnings.  */ | 
|  | 2656 | (void) yyvaluep; | 
|  | 2657 |  | 
|  | 2658 | if (yytype < YYNTOKENS) | 
|  | 2659 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | 
|  | 2660 | else | 
|  | 2661 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | 
|  | 2662 |  | 
|  | 2663 |  | 
|  | 2664 | # ifdef YYPRINT | 
|  | 2665 | if (yytype < YYNTOKENS) | 
|  | 2666 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | 
|  | 2667 | # endif | 
|  | 2668 | switch (yytype) | 
|  | 2669 | { | 
|  | 2670 | default: | 
|  | 2671 | break; | 
|  | 2672 | } | 
|  | 2673 | YYFPRINTF (yyoutput, ")"); | 
|  | 2674 | } | 
|  | 2675 |  | 
|  | 2676 | #endif /* ! YYDEBUG */ | 
|  | 2677 | /*-----------------------------------------------. | 
|  | 2678 | | Release the memory associated to this symbol.  | | 
|  | 2679 | `-----------------------------------------------*/ | 
|  | 2680 |  | 
|  | 2681 | #if defined (__STDC__) || defined (__cplusplus) | 
|  | 2682 | static void | 
|  | 2683 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) | 
|  | 2684 | #else | 
|  | 2685 | static void | 
|  | 2686 | yydestruct (yymsg, yytype, yyvaluep) | 
|  | 2687 | const char *yymsg; | 
|  | 2688 | int yytype; | 
|  | 2689 | YYSTYPE *yyvaluep; | 
|  | 2690 | #endif | 
|  | 2691 | { | 
|  | 2692 | /* Pacify ``unused variable'' warnings.  */ | 
|  | 2693 | (void) yyvaluep; | 
|  | 2694 |  | 
|  | 2695 | if (!yymsg) | 
|  | 2696 | yymsg = "Deleting"; | 
|  | 2697 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | 
|  | 2698 |  | 
|  | 2699 | switch (yytype) | 
|  | 2700 | { | 
|  | 2701 |  | 
|  | 2702 | default: | 
|  | 2703 | break; | 
|  | 2704 | } | 
|  | 2705 | } | 
|  | 2706 |  | 
|  | 2707 |  | 
|  | 2708 | /* Prevent warnings from -Wmissing-prototypes.  */ | 
|  | 2709 |  | 
|  | 2710 | #ifdef YYPARSE_PARAM | 
|  | 2711 | # if defined (__STDC__) || defined (__cplusplus) | 
|  | 2712 | int yyparse (void *YYPARSE_PARAM); | 
|  | 2713 | # else | 
|  | 2714 | int yyparse (); | 
|  | 2715 | # endif | 
|  | 2716 | #else /* ! YYPARSE_PARAM */ | 
|  | 2717 | #if defined (__STDC__) || defined (__cplusplus) | 
| Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2718 | int yyparse (void); | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2719 | #else | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2720 | int yyparse (); | 
|  | 2721 | #endif | 
|  | 2722 | #endif /* ! YYPARSE_PARAM */ | 
|  | 2723 |  | 
|  | 2724 |  | 
|  | 2725 |  | 
|  | 2726 | /* The look-ahead symbol.  */ | 
|  | 2727 | int yychar; | 
|  | 2728 |  | 
|  | 2729 | /* The semantic value of the look-ahead symbol.  */ | 
|  | 2730 | YYSTYPE yylval; | 
|  | 2731 |  | 
|  | 2732 | /* Number of syntax errors so far.  */ | 
|  | 2733 | int yynerrs; | 
|  | 2734 |  | 
|  | 2735 |  | 
|  | 2736 |  | 
|  | 2737 | /*----------. | 
|  | 2738 | | yyparse.  | | 
|  | 2739 | `----------*/ | 
|  | 2740 |  | 
|  | 2741 | #ifdef YYPARSE_PARAM | 
|  | 2742 | # if defined (__STDC__) || defined (__cplusplus) | 
|  | 2743 | int yyparse (void *YYPARSE_PARAM) | 
|  | 2744 | # else | 
|  | 2745 | int yyparse (YYPARSE_PARAM) | 
|  | 2746 | void *YYPARSE_PARAM; | 
|  | 2747 | # endif | 
|  | 2748 | #else /* ! YYPARSE_PARAM */ | 
|  | 2749 | #if defined (__STDC__) || defined (__cplusplus) | 
|  | 2750 | int | 
|  | 2751 | yyparse (void) | 
|  | 2752 | #else | 
|  | 2753 | int | 
|  | 2754 | yyparse () | 
|  | 2755 |  | 
|  | 2756 | #endif | 
|  | 2757 | #endif | 
|  | 2758 | { | 
|  | 2759 |  | 
|  | 2760 | int yystate; | 
|  | 2761 | int yyn; | 
|  | 2762 | int yyresult; | 
|  | 2763 | /* Number of tokens to shift before error messages enabled.  */ | 
|  | 2764 | int yyerrstatus; | 
|  | 2765 | /* Look-ahead token as an internal (translated) token number.  */ | 
|  | 2766 | int yytoken = 0; | 
|  | 2767 |  | 
|  | 2768 | /* Three stacks and their tools: | 
|  | 2769 | `yyss': related to states, | 
|  | 2770 | `yyvs': related to semantic values, | 
|  | 2771 | `yyls': related to locations. | 
|  | 2772 |  | 
|  | 2773 | Refer to the stacks thru separate pointers, to allow yyoverflow | 
|  | 2774 | to reallocate them elsewhere.  */ | 
|  | 2775 |  | 
|  | 2776 | /* The state stack.  */ | 
|  | 2777 | short int yyssa[YYINITDEPTH]; | 
|  | 2778 | short int *yyss = yyssa; | 
|  | 2779 | short int *yyssp; | 
|  | 2780 |  | 
|  | 2781 | /* The semantic value stack.  */ | 
|  | 2782 | YYSTYPE yyvsa[YYINITDEPTH]; | 
|  | 2783 | YYSTYPE *yyvs = yyvsa; | 
|  | 2784 | YYSTYPE *yyvsp; | 
|  | 2785 |  | 
|  | 2786 |  | 
|  | 2787 |  | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2788 | #define YYPOPSTACK   (yyvsp--, yyssp--) | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2789 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2790 | YYSIZE_T yystacksize = YYINITDEPTH; | 
| Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2791 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2792 | /* The variables used to return semantic value and location from the | 
|  | 2793 | action routines.  */ | 
|  | 2794 | YYSTYPE yyval; | 
| Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2795 |  | 
| Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2796 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2797 | /* When reducing, the number of symbols on the RHS of the reduced | 
|  | 2798 | rule.  */ | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2799 | int yylen; | 
| Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2800 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2801 | YYDPRINTF ((stderr, "Starting parse\n")); | 
| Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2802 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2803 | yystate = 0; | 
|  | 2804 | yyerrstatus = 0; | 
|  | 2805 | yynerrs = 0; | 
|  | 2806 | yychar = YYEMPTY;		/* Cause a token to be read.  */ | 
|  | 2807 |  | 
|  | 2808 | /* Initialize stack pointers. | 
|  | 2809 | Waste one element of value and location stack | 
|  | 2810 | so that they stay on the same level as the state stack. | 
|  | 2811 | The wasted elements are never initialized.  */ | 
|  | 2812 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2813 | yyssp = yyss; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2814 | yyvsp = yyvs; | 
|  | 2815 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2816 | goto yysetstate; | 
| Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2817 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2818 | /*------------------------------------------------------------. | 
|  | 2819 | | yynewstate -- Push a new state, which is found in yystate.  | | 
|  | 2820 | `------------------------------------------------------------*/ | 
|  | 2821 | yynewstate: | 
|  | 2822 | /* In all cases, when you get here, the value and location stacks | 
|  | 2823 | have just been pushed. so pushing a state here evens the stacks. | 
|  | 2824 | */ | 
|  | 2825 | yyssp++; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2826 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2827 | yysetstate: | 
|  | 2828 | *yyssp = yystate; | 
|  | 2829 |  | 
|  | 2830 | if (yyss + yystacksize - 1 <= yyssp) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2831 | { | 
|  | 2832 | /* Get the current used size of the three stacks, in elements.  */ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2833 | YYSIZE_T yysize = yyssp - yyss + 1; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2834 |  | 
|  | 2835 | #ifdef yyoverflow | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2836 | { | 
|  | 2837 | /* Give user a chance to reallocate the stack. Use copies of | 
|  | 2838 | these so that the &'s don't force the real ones into | 
|  | 2839 | memory.  */ | 
|  | 2840 | YYSTYPE *yyvs1 = yyvs; | 
|  | 2841 | short int *yyss1 = yyss; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2842 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2843 |  | 
|  | 2844 | /* Each stack pointer address is followed by the size of the | 
|  | 2845 | data in use in that stack, in bytes.  This used to be a | 
|  | 2846 | conditional around just the two extra args, but that might | 
|  | 2847 | be undefined if yyoverflow is a macro.  */ | 
|  | 2848 | yyoverflow (YY_("memory exhausted"), | 
|  | 2849 | &yyss1, yysize * sizeof (*yyssp), | 
|  | 2850 | &yyvs1, yysize * sizeof (*yyvsp), | 
|  | 2851 |  | 
|  | 2852 | &yystacksize); | 
|  | 2853 |  | 
|  | 2854 | yyss = yyss1; | 
|  | 2855 | yyvs = yyvs1; | 
|  | 2856 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2857 | #else /* no yyoverflow */ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2858 | # ifndef YYSTACK_RELOCATE | 
|  | 2859 | goto yyexhaustedlab; | 
|  | 2860 | # else | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2861 | /* Extend the stack our own way.  */ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2862 | if (YYMAXDEPTH <= yystacksize) | 
|  | 2863 | goto yyexhaustedlab; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2864 | yystacksize *= 2; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2865 | if (YYMAXDEPTH < yystacksize) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2866 | yystacksize = YYMAXDEPTH; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2867 |  | 
|  | 2868 | { | 
|  | 2869 | short int *yyss1 = yyss; | 
|  | 2870 | union yyalloc *yyptr = | 
|  | 2871 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 
|  | 2872 | if (! yyptr) | 
|  | 2873 | goto yyexhaustedlab; | 
|  | 2874 | YYSTACK_RELOCATE (yyss); | 
|  | 2875 | YYSTACK_RELOCATE (yyvs); | 
|  | 2876 |  | 
|  | 2877 | #  undef YYSTACK_RELOCATE | 
|  | 2878 | if (yyss1 != yyssa) | 
|  | 2879 | YYSTACK_FREE (yyss1); | 
|  | 2880 | } | 
|  | 2881 | # endif | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2882 | #endif /* no yyoverflow */ | 
|  | 2883 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2884 | yyssp = yyss + yysize - 1; | 
|  | 2885 | yyvsp = yyvs + yysize - 1; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2886 |  | 
|  | 2887 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2888 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 
|  | 2889 | (unsigned long int) yystacksize)); | 
|  | 2890 |  | 
|  | 2891 | if (yyss + yystacksize - 1 <= yyssp) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2892 | YYABORT; | 
|  | 2893 | } | 
|  | 2894 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2895 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2896 |  | 
|  | 2897 | goto yybackup; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2898 |  | 
|  | 2899 | /*-----------. | 
|  | 2900 | | yybackup.  | | 
|  | 2901 | `-----------*/ | 
|  | 2902 | yybackup: | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2903 |  | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2904 | /* Do appropriate processing given the current state.  */ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2905 | /* Read a look-ahead token if we need one and don't already have one.  */ | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2906 | /* yyresume: */ | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2907 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2908 | /* First try to decide what to do without reference to look-ahead token.  */ | 
| Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2909 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2910 | yyn = yypact[yystate]; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2911 | if (yyn == YYPACT_NINF) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2912 | goto yydefault; | 
|  | 2913 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2914 | /* Not known => get a look-ahead token if don't already have one.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2915 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2916 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2917 | if (yychar == YYEMPTY) | 
|  | 2918 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2919 | YYDPRINTF ((stderr, "Reading a token: ")); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2920 | yychar = YYLEX; | 
|  | 2921 | } | 
|  | 2922 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2923 | if (yychar <= YYEOF) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2924 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2925 | yychar = yytoken = YYEOF; | 
|  | 2926 | YYDPRINTF ((stderr, "Now at end of input.\n")); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2927 | } | 
|  | 2928 | else | 
|  | 2929 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2930 | yytoken = YYTRANSLATE (yychar); | 
|  | 2931 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2932 | } | 
|  | 2933 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2934 | /* If the proper action on seeing token YYTOKEN is to reduce or to | 
|  | 2935 | detect an error, take that action.  */ | 
|  | 2936 | yyn += yytoken; | 
|  | 2937 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2938 | goto yydefault; | 
|  | 2939 | yyn = yytable[yyn]; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2940 | if (yyn <= 0) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2941 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2942 | if (yyn == 0 || yyn == YYTABLE_NINF) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2943 | goto yyerrlab; | 
|  | 2944 | yyn = -yyn; | 
|  | 2945 | goto yyreduce; | 
|  | 2946 | } | 
|  | 2947 |  | 
|  | 2948 | if (yyn == YYFINAL) | 
|  | 2949 | YYACCEPT; | 
|  | 2950 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2951 | /* Shift the look-ahead token.  */ | 
|  | 2952 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | 
| Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2953 |  | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2954 | /* Discard the token being shifted unless it is eof.  */ | 
| Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2955 | if (yychar != YYEOF) | 
|  | 2956 | yychar = YYEMPTY; | 
|  | 2957 |  | 
| Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 2958 | *++yyvsp = yylval; | 
|  | 2959 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2960 |  | 
|  | 2961 | /* Count tokens shifted since error; after three, turn off error | 
|  | 2962 | status.  */ | 
|  | 2963 | if (yyerrstatus) | 
|  | 2964 | yyerrstatus--; | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 2965 |  | 
|  | 2966 | yystate = yyn; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2967 | goto yynewstate; | 
|  | 2968 |  | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 2969 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2970 | /*-----------------------------------------------------------. | 
|  | 2971 | | yydefault -- do the default action for the current state.  | | 
|  | 2972 | `-----------------------------------------------------------*/ | 
|  | 2973 | yydefault: | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2974 | yyn = yydefact[yystate]; | 
|  | 2975 | if (yyn == 0) | 
|  | 2976 | goto yyerrlab; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2977 | goto yyreduce; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2978 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2979 |  | 
|  | 2980 | /*-----------------------------. | 
|  | 2981 | | yyreduce -- Do a reduction.  | | 
|  | 2982 | `-----------------------------*/ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2983 | yyreduce: | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2984 | /* yyn is the number of a rule to reduce with.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2985 | yylen = yyr2[yyn]; | 
|  | 2986 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 2987 | /* If YYLEN is nonzero, implement the default value of the action: | 
|  | 2988 | `$$ = $1'. | 
|  | 2989 |  | 
|  | 2990 | Otherwise, the following line sets YYVAL to garbage. | 
|  | 2991 | This behavior is undocumented and Bison | 
|  | 2992 | users should not rely upon it.  Assigning to YYVAL | 
|  | 2993 | unconditionally makes the parser a bit smaller, and it avoids a | 
|  | 2994 | GCC warning that YYVAL may be used uninitialized.  */ | 
|  | 2995 | yyval = yyvsp[1-yylen]; | 
|  | 2996 |  | 
|  | 2997 |  | 
|  | 2998 | YY_REDUCE_PRINT (yyn); | 
|  | 2999 | switch (yyn) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3000 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3001 | case 29: | 
|  | 3002 | #line 1061 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3003 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} | 
|  | 3004 | break; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3005 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3006 | case 30: | 
|  | 3007 | #line 1061 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3008 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} | 
|  | 3009 | break; | 
| Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3010 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3011 | case 31: | 
|  | 3012 | #line 1062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3013 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} | 
|  | 3014 | break; | 
| Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3015 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3016 | case 32: | 
|  | 3017 | #line 1062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3018 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} | 
|  | 3019 | break; | 
| Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3020 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3021 | case 33: | 
|  | 3022 | #line 1063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3023 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} | 
|  | 3024 | break; | 
| Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3025 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3026 | case 34: | 
|  | 3027 | #line 1063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3028 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} | 
|  | 3029 | break; | 
|  | 3030 |  | 
|  | 3031 | case 35: | 
|  | 3032 | #line 1064 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3033 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} | 
|  | 3034 | break; | 
|  | 3035 |  | 
|  | 3036 | case 36: | 
|  | 3037 | #line 1064 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3038 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} | 
|  | 3039 | break; | 
|  | 3040 |  | 
|  | 3041 | case 37: | 
|  | 3042 | #line 1065 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3043 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} | 
|  | 3044 | break; | 
|  | 3045 |  | 
|  | 3046 | case 38: | 
|  | 3047 | #line 1065 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3048 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} | 
|  | 3049 | break; | 
|  | 3050 |  | 
|  | 3051 | case 39: | 
|  | 3052 | #line 1069 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3053 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} | 
|  | 3054 | break; | 
|  | 3055 |  | 
|  | 3056 | case 40: | 
|  | 3057 | #line 1069 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3058 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} | 
|  | 3059 | break; | 
|  | 3060 |  | 
|  | 3061 | case 41: | 
|  | 3062 | #line 1070 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3063 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} | 
|  | 3064 | break; | 
|  | 3065 |  | 
|  | 3066 | case 42: | 
|  | 3067 | #line 1070 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3068 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} | 
|  | 3069 | break; | 
|  | 3070 |  | 
|  | 3071 | case 43: | 
|  | 3072 | #line 1071 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3073 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} | 
|  | 3074 | break; | 
|  | 3075 |  | 
|  | 3076 | case 44: | 
|  | 3077 | #line 1071 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3078 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} | 
|  | 3079 | break; | 
|  | 3080 |  | 
|  | 3081 | case 45: | 
|  | 3082 | #line 1072 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3083 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} | 
|  | 3084 | break; | 
|  | 3085 |  | 
|  | 3086 | case 46: | 
|  | 3087 | #line 1072 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3088 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} | 
|  | 3089 | break; | 
|  | 3090 |  | 
|  | 3091 | case 47: | 
|  | 3092 | #line 1073 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3093 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} | 
|  | 3094 | break; | 
|  | 3095 |  | 
|  | 3096 | case 48: | 
|  | 3097 | #line 1073 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3098 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} | 
|  | 3099 | break; | 
|  | 3100 |  | 
|  | 3101 | case 49: | 
|  | 3102 | #line 1074 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3103 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} | 
|  | 3104 | break; | 
|  | 3105 |  | 
|  | 3106 | case 50: | 
|  | 3107 | #line 1074 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3108 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} | 
|  | 3109 | break; | 
|  | 3110 |  | 
|  | 3111 | case 51: | 
|  | 3112 | #line 1075 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3113 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} | 
|  | 3114 | break; | 
|  | 3115 |  | 
|  | 3116 | case 52: | 
|  | 3117 | #line 1075 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3118 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} | 
|  | 3119 | break; | 
|  | 3120 |  | 
|  | 3121 | case 53: | 
|  | 3122 | #line 1076 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3123 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} | 
|  | 3124 | break; | 
|  | 3125 |  | 
|  | 3126 | case 54: | 
|  | 3127 | #line 1077 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3128 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} | 
|  | 3129 | break; | 
|  | 3130 |  | 
|  | 3131 | case 61: | 
|  | 3132 | #line 1086 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3133 | { (yyval.StrVal) = 0; ;} | 
|  | 3134 | break; | 
|  | 3135 |  | 
|  | 3136 | case 62: | 
|  | 3137 | #line 1090 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3138 | { | 
|  | 3139 | (yyval.StrVal) = (yyvsp[-1].StrVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3140 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3141 | ;} | 
|  | 3142 | break; | 
|  | 3143 |  | 
|  | 3144 | case 63: | 
|  | 3145 | #line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3146 | { | 
|  | 3147 | (yyval.StrVal) = 0; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3148 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3149 | ;} | 
|  | 3150 | break; | 
|  | 3151 |  | 
|  | 3152 | case 66: | 
|  | 3153 | #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3154 | { | 
|  | 3155 | (yyval.StrVal) = (yyvsp[-1].StrVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3156 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3157 | ;} | 
|  | 3158 | break; | 
|  | 3159 |  | 
|  | 3160 | case 67: | 
|  | 3161 | #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3162 | { | 
|  | 3163 | (yyval.StrVal) = 0; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3164 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3165 | ;} | 
|  | 3166 | break; | 
|  | 3167 |  | 
|  | 3168 | case 68: | 
|  | 3169 | #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3170 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} | 
|  | 3171 | break; | 
|  | 3172 |  | 
|  | 3173 | case 69: | 
|  | 3174 | #line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3175 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} | 
|  | 3176 | break; | 
|  | 3177 |  | 
|  | 3178 | case 70: | 
|  | 3179 | #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3180 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} | 
|  | 3181 | break; | 
|  | 3182 |  | 
|  | 3183 | case 71: | 
|  | 3184 | #line 1114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3185 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} | 
|  | 3186 | break; | 
|  | 3187 |  | 
|  | 3188 | case 72: | 
|  | 3189 | #line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3190 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} | 
|  | 3191 | break; | 
|  | 3192 |  | 
|  | 3193 | case 73: | 
|  | 3194 | #line 1119 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3195 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} | 
|  | 3196 | break; | 
|  | 3197 |  | 
|  | 3198 | case 74: | 
|  | 3199 | #line 1120 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3200 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} | 
|  | 3201 | break; | 
|  | 3202 |  | 
|  | 3203 | case 75: | 
|  | 3204 | #line 1121 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3205 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} | 
|  | 3206 | break; | 
|  | 3207 |  | 
|  | 3208 | case 76: | 
|  | 3209 | #line 1125 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3210 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} | 
|  | 3211 | break; | 
|  | 3212 |  | 
|  | 3213 | case 77: | 
|  | 3214 | #line 1126 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3215 | { (yyval.Visibility) = GlobalValue::HiddenVisibility;  ;} | 
|  | 3216 | break; | 
|  | 3217 |  | 
|  | 3218 | case 78: | 
|  | 3219 | #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3220 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} | 
|  | 3221 | break; | 
|  | 3222 |  | 
|  | 3223 | case 79: | 
|  | 3224 | #line 1131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3225 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} | 
|  | 3226 | break; | 
|  | 3227 |  | 
|  | 3228 | case 80: | 
|  | 3229 | #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3230 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} | 
|  | 3231 | break; | 
|  | 3232 |  | 
|  | 3233 | case 81: | 
|  | 3234 | #line 1136 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3235 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} | 
|  | 3236 | break; | 
|  | 3237 |  | 
|  | 3238 | case 82: | 
|  | 3239 | #line 1137 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3240 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} | 
|  | 3241 | break; | 
|  | 3242 |  | 
|  | 3243 | case 83: | 
|  | 3244 | #line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3245 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} | 
|  | 3246 | break; | 
|  | 3247 |  | 
|  | 3248 | case 84: | 
|  | 3249 | #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3250 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} | 
|  | 3251 | break; | 
|  | 3252 |  | 
|  | 3253 | case 85: | 
|  | 3254 | #line 1140 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3255 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} | 
|  | 3256 | break; | 
|  | 3257 |  | 
|  | 3258 | case 86: | 
|  | 3259 | #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3260 | { (yyval.UIntVal) = CallingConv::C; ;} | 
|  | 3261 | break; | 
|  | 3262 |  | 
|  | 3263 | case 87: | 
|  | 3264 | #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3265 | { (yyval.UIntVal) = CallingConv::C; ;} | 
|  | 3266 | break; | 
|  | 3267 |  | 
|  | 3268 | case 88: | 
|  | 3269 | #line 1145 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3270 | { (yyval.UIntVal) = CallingConv::Fast; ;} | 
|  | 3271 | break; | 
|  | 3272 |  | 
|  | 3273 | case 89: | 
|  | 3274 | #line 1146 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3275 | { (yyval.UIntVal) = CallingConv::Cold; ;} | 
|  | 3276 | break; | 
|  | 3277 |  | 
|  | 3278 | case 90: | 
|  | 3279 | #line 1147 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3280 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} | 
|  | 3281 | break; | 
|  | 3282 |  | 
|  | 3283 | case 91: | 
|  | 3284 | #line 1148 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3285 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} | 
|  | 3286 | break; | 
|  | 3287 |  | 
|  | 3288 | case 92: | 
|  | 3289 | #line 1149 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3290 | { | 
|  | 3291 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3292 | GEN_ERROR("Calling conv too large"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3293 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3294 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3295 | ;} | 
|  | 3296 | break; | 
|  | 3297 |  | 
|  | 3298 | case 93: | 
|  | 3299 | #line 1156 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3300 | { (yyval.ParamAttrs) = FunctionType::ZExtAttribute;      ;} | 
|  | 3301 | break; | 
|  | 3302 |  | 
|  | 3303 | case 94: | 
|  | 3304 | #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3305 | { (yyval.ParamAttrs) = FunctionType::SExtAttribute;      ;} | 
|  | 3306 | break; | 
|  | 3307 |  | 
|  | 3308 | case 95: | 
|  | 3309 | #line 1158 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3310 | { (yyval.ParamAttrs) = FunctionType::InRegAttribute;     ;} | 
|  | 3311 | break; | 
|  | 3312 |  | 
|  | 3313 | case 96: | 
|  | 3314 | #line 1159 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3315 | { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;} | 
|  | 3316 | break; | 
|  | 3317 |  | 
|  | 3318 | case 97: | 
|  | 3319 | #line 1162 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3320 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} | 
|  | 3321 | break; | 
|  | 3322 |  | 
|  | 3323 | case 98: | 
|  | 3324 | #line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3325 | { | 
|  | 3326 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); | 
|  | 3327 | ;} | 
|  | 3328 | break; | 
|  | 3329 |  | 
|  | 3330 | case 99: | 
|  | 3331 | #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3332 | { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;} | 
|  | 3333 | break; | 
|  | 3334 |  | 
|  | 3335 | case 101: | 
|  | 3336 | #line 1172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3337 | { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;} | 
|  | 3338 | break; | 
|  | 3339 |  | 
|  | 3340 | case 102: | 
|  | 3341 | #line 1173 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3342 | { | 
|  | 3343 | (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs)); | 
|  | 3344 | ;} | 
|  | 3345 | break; | 
|  | 3346 |  | 
|  | 3347 | case 103: | 
|  | 3348 | #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3349 | { (yyval.UIntVal) = 0; ;} | 
|  | 3350 | break; | 
|  | 3351 |  | 
|  | 3352 | case 104: | 
|  | 3353 | #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3354 | { | 
|  | 3355 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); | 
|  | 3356 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3357 | GEN_ERROR("Alignment must be a power of two"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3358 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3359 | ;} | 
|  | 3360 | break; | 
|  | 3361 |  | 
|  | 3362 | case 105: | 
|  | 3363 | #line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3364 | { (yyval.UIntVal) = 0; ;} | 
|  | 3365 | break; | 
|  | 3366 |  | 
|  | 3367 | case 106: | 
|  | 3368 | #line 1188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3369 | { | 
|  | 3370 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); | 
|  | 3371 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3372 | GEN_ERROR("Alignment must be a power of two"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3373 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3374 | ;} | 
|  | 3375 | break; | 
|  | 3376 |  | 
|  | 3377 | case 107: | 
|  | 3378 | #line 1196 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3379 | { | 
|  | 3380 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) | 
|  | 3381 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3382 | GEN_ERROR("Invalid character in section name"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3383 | (yyval.StrVal) = (yyvsp[0].StrVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3384 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3385 | ;} | 
|  | 3386 | break; | 
|  | 3387 |  | 
|  | 3388 | case 108: | 
|  | 3389 | #line 1204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3390 | { (yyval.StrVal) = 0; ;} | 
|  | 3391 | break; | 
|  | 3392 |  | 
|  | 3393 | case 109: | 
|  | 3394 | #line 1205 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3395 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} | 
|  | 3396 | break; | 
|  | 3397 |  | 
|  | 3398 | case 110: | 
|  | 3399 | #line 1210 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3400 | {;} | 
|  | 3401 | break; | 
|  | 3402 |  | 
|  | 3403 | case 111: | 
|  | 3404 | #line 1211 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3405 | {;} | 
|  | 3406 | break; | 
|  | 3407 |  | 
|  | 3408 | case 112: | 
|  | 3409 | #line 1212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3410 | { | 
|  | 3411 | CurGV->setSection((yyvsp[0].StrVal)); | 
|  | 3412 | free((yyvsp[0].StrVal)); | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3413 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3414 | ;} | 
|  | 3415 | break; | 
|  | 3416 |  | 
|  | 3417 | case 113: | 
|  | 3418 | #line 1217 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3419 | { | 
|  | 3420 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3421 | GEN_ERROR("Alignment must be a power of two"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3422 | CurGV->setAlignment((yyvsp[0].UInt64Val)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3423 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3424 | ;} | 
|  | 3425 | break; | 
|  | 3426 |  | 
|  | 3427 | case 118: | 
|  | 3428 | #line 1233 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3429 | { | 
|  | 3430 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3431 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3432 | ;} | 
|  | 3433 | break; | 
|  | 3434 |  | 
|  | 3435 | case 119: | 
|  | 3436 | #line 1237 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3437 | { | 
|  | 3438 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3439 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3440 | ;} | 
|  | 3441 | break; | 
|  | 3442 |  | 
|  | 3443 | case 120: | 
|  | 3444 | #line 1241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3445 | {                             // Pointer type? | 
|  | 3446 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3447 | GEN_ERROR("Cannot form a pointer to a basic block"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3448 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); | 
|  | 3449 | delete (yyvsp[-1].TypeVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3450 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3451 | ;} | 
|  | 3452 | break; | 
|  | 3453 |  | 
|  | 3454 | case 121: | 
|  | 3455 | #line 1248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3456 | {            // Named types are also simple types... | 
|  | 3457 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3458 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3459 | (yyval.TypeVal) = new PATypeHolder(tmp); | 
|  | 3460 | ;} | 
|  | 3461 | break; | 
|  | 3462 |  | 
|  | 3463 | case 122: | 
|  | 3464 | #line 1253 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3465 | {                   // Type UpReference | 
|  | 3466 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3467 | OpaqueType *OT = OpaqueType::get();        // Use temporary placeholder | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3468 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT));  // Add to vector... | 
|  | 3469 | (yyval.TypeVal) = new PATypeHolder(OT); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3470 | UR_OUT("New Upreference!\n"); | 
|  | 3471 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3472 | ;} | 
|  | 3473 | break; | 
|  | 3474 |  | 
|  | 3475 | case 123: | 
|  | 3476 | #line 1261 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3477 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3478 | std::vector<const Type*> Params; | 
|  | 3479 | std::vector<FunctionType::ParameterAttributes> Attrs; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3480 | Attrs.push_back((yyvsp[0].ParamAttrs)); | 
|  | 3481 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3482 | Params.push_back(I->Ty->get()); | 
|  | 3483 | if (I->Ty->get() != Type::VoidTy) | 
|  | 3484 | Attrs.push_back(I->Attrs); | 
|  | 3485 | } | 
|  | 3486 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; | 
|  | 3487 | if (isVarArg) Params.pop_back(); | 
|  | 3488 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3489 | FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs); | 
|  | 3490 | delete (yyvsp[-2].TypeWithAttrsList);   // Delete the argument list | 
|  | 3491 | delete (yyvsp[-4].TypeVal);   // Delete the return type handle | 
|  | 3492 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3493 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3494 | ;} | 
|  | 3495 | break; | 
|  | 3496 |  | 
|  | 3497 | case 124: | 
|  | 3498 | #line 1279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3499 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3500 | std::vector<const Type*> Params; | 
|  | 3501 | std::vector<FunctionType::ParameterAttributes> Attrs; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3502 | Attrs.push_back((yyvsp[0].ParamAttrs)); | 
|  | 3503 | for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3504 | Params.push_back(I->Ty->get()); | 
|  | 3505 | if (I->Ty->get() != Type::VoidTy) | 
|  | 3506 | Attrs.push_back(I->Attrs); | 
|  | 3507 | } | 
|  | 3508 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; | 
|  | 3509 | if (isVarArg) Params.pop_back(); | 
|  | 3510 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3511 | FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs); | 
|  | 3512 | delete (yyvsp[-2].TypeWithAttrsList);      // Delete the argument list | 
|  | 3513 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3514 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3515 | ;} | 
|  | 3516 | break; | 
|  | 3517 |  | 
|  | 3518 | case 125: | 
|  | 3519 | #line 1297 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3520 | {          // Sized array type? | 
|  | 3521 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); | 
|  | 3522 | delete (yyvsp[-1].TypeVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3523 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3524 | ;} | 
|  | 3525 | break; | 
|  | 3526 |  | 
|  | 3527 | case 126: | 
|  | 3528 | #line 1302 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3529 | {          // Vector type? | 
|  | 3530 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); | 
|  | 3531 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3532 | GEN_ERROR("Unsigned result not equal to signed result"); | 
|  | 3533 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 3534 | GEN_ERROR("Element type of a VectorType must be primitive"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3535 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3536 | GEN_ERROR("Vector length should be a power of 2"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3537 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); | 
|  | 3538 | delete (yyvsp[-1].TypeVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3539 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3540 | ;} | 
|  | 3541 | break; | 
|  | 3542 |  | 
|  | 3543 | case 127: | 
|  | 3544 | #line 1314 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3545 | {                        // Structure type? | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3546 | std::vector<const Type*> Elements; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3547 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), | 
|  | 3548 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3549 | Elements.push_back(*I); | 
|  | 3550 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3551 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); | 
|  | 3552 | delete (yyvsp[-1].TypeList); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3553 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3554 | ;} | 
|  | 3555 | break; | 
|  | 3556 |  | 
|  | 3557 | case 128: | 
|  | 3558 | #line 1324 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3559 | {                                  // Empty structure type? | 
|  | 3560 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3561 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3562 | ;} | 
|  | 3563 | break; | 
|  | 3564 |  | 
|  | 3565 | case 129: | 
|  | 3566 | #line 1328 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3567 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3568 | std::vector<const Type*> Elements; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3569 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(), | 
|  | 3570 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3571 | Elements.push_back(*I); | 
|  | 3572 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3573 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); | 
|  | 3574 | delete (yyvsp[-2].TypeList); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3575 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3576 | ;} | 
|  | 3577 | break; | 
|  | 3578 |  | 
|  | 3579 | case 130: | 
|  | 3580 | #line 1338 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3581 | {                         // Empty structure type? | 
|  | 3582 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3583 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3584 | ;} | 
|  | 3585 | break; | 
|  | 3586 |  | 
|  | 3587 | case 131: | 
|  | 3588 | #line 1345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3589 | { | 
|  | 3590 | (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal); | 
|  | 3591 | (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs); | 
|  | 3592 | ;} | 
|  | 3593 | break; | 
|  | 3594 |  | 
|  | 3595 | case 132: | 
|  | 3596 | #line 1352 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3597 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3598 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3599 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); | 
|  | 3600 | if (!(*(yyvsp[0].TypeVal))->isFirstClassType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3601 | GEN_ERROR("LLVM functions cannot return aggregate types"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3602 | (yyval.TypeVal) = (yyvsp[0].TypeVal); | 
|  | 3603 | ;} | 
|  | 3604 | break; | 
|  | 3605 |  | 
|  | 3606 | case 133: | 
|  | 3607 | #line 1359 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3608 | { | 
|  | 3609 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); | 
|  | 3610 | ;} | 
|  | 3611 | break; | 
|  | 3612 |  | 
|  | 3613 | case 134: | 
|  | 3614 | #line 1364 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3615 | { | 
|  | 3616 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); | 
|  | 3617 | (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs)); | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3618 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3619 | ;} | 
|  | 3620 | break; | 
|  | 3621 |  | 
|  | 3622 | case 135: | 
|  | 3623 | #line 1369 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3624 | { | 
|  | 3625 | ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs)); | 
| Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3626 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3627 | ;} | 
|  | 3628 | break; | 
|  | 3629 |  | 
|  | 3630 | case 137: | 
|  | 3631 | #line 1377 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3632 | { | 
|  | 3633 | (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3634 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; | 
|  | 3635 | TWA.Ty = new PATypeHolder(Type::VoidTy); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3636 | (yyval.TypeWithAttrsList)->push_back(TWA); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3637 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3638 | ;} | 
|  | 3639 | break; | 
|  | 3640 |  | 
|  | 3641 | case 138: | 
|  | 3642 | #line 1384 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3643 | { | 
|  | 3644 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3645 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; | 
|  | 3646 | TWA.Ty = new PATypeHolder(Type::VoidTy); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3647 | (yyval.TypeWithAttrsList)->push_back(TWA); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3648 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3649 | ;} | 
|  | 3650 | break; | 
|  | 3651 |  | 
|  | 3652 | case 139: | 
|  | 3653 | #line 1391 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3654 | { | 
|  | 3655 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3656 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3657 | ;} | 
|  | 3658 | break; | 
|  | 3659 |  | 
|  | 3660 | case 140: | 
|  | 3661 | #line 1399 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3662 | { | 
|  | 3663 | (yyval.TypeList) = new std::list<PATypeHolder>(); | 
|  | 3664 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3665 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3666 | ;} | 
|  | 3667 | break; | 
|  | 3668 |  | 
|  | 3669 | case 141: | 
|  | 3670 | #line 1404 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3671 | { | 
|  | 3672 | ((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] | 3673 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3674 | ;} | 
|  | 3675 | break; | 
|  | 3676 |  | 
|  | 3677 | case 142: | 
|  | 3678 | #line 1415 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3679 | { // Nonempty unsized arr | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3680 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3681 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); | 
|  | 3682 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3683 | if (ATy == 0) | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3684 | GEN_ERROR("Cannot make array constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3685 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3686 | const Type *ETy = ATy->getElementType(); | 
|  | 3687 | int NumElements = ATy->getNumElements(); | 
|  | 3688 |  | 
|  | 3689 | // Verify that we have the correct size... | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3690 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3691 | GEN_ERROR("Type mismatch: constant sized array initialized with " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3692 | utostr((yyvsp[-1].ConstVector)->size()) +  " arguments, but has size of " + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3693 | itostr(NumElements) + ""); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3694 |  | 
|  | 3695 | // Verify all elements are correct type! | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3696 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { | 
|  | 3697 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3698 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + | 
|  | 3699 | ETy->getDescription() +"' as required!\nIt is of type '"+ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3700 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3701 | } | 
|  | 3702 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3703 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); | 
|  | 3704 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3705 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3706 | ;} | 
|  | 3707 | break; | 
|  | 3708 |  | 
|  | 3709 | case 143: | 
|  | 3710 | #line 1443 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3711 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3712 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3713 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
|  | 3714 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3715 | if (ATy == 0) | 
|  | 3716 | GEN_ERROR("Cannot make array constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3717 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3718 |  | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3719 | int NumElements = ATy->getNumElements(); | 
|  | 3720 | if (NumElements != -1 && NumElements != 0) | 
|  | 3721 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3722 | " arguments, but has size of " + itostr(NumElements) +""); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3723 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); | 
|  | 3724 | delete (yyvsp[-2].TypeVal); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3725 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3726 | ;} | 
|  | 3727 | break; | 
|  | 3728 |  | 
|  | 3729 | case 144: | 
|  | 3730 | #line 1459 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3731 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3732 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3733 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
|  | 3734 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3735 | if (ATy == 0) | 
|  | 3736 | GEN_ERROR("Cannot make array constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3737 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3738 |  | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3739 | int NumElements = ATy->getNumElements(); | 
|  | 3740 | const Type *ETy = ATy->getElementType(); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3741 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); | 
|  | 3742 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3743 | GEN_ERROR("Can't build string constant of size " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3744 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3745 | " when array has size " + itostr(NumElements) + ""); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3746 | std::vector<Constant*> Vals; | 
|  | 3747 | if (ETy == Type::Int8Ty) { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3748 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3749 | C != (unsigned char*)EndStr; ++C) | 
|  | 3750 | Vals.push_back(ConstantInt::get(ETy, *C)); | 
|  | 3751 | } else { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3752 | free((yyvsp[0].StrVal)); | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3753 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3754 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3755 | free((yyvsp[0].StrVal)); | 
|  | 3756 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); | 
|  | 3757 | delete (yyvsp[-2].TypeVal); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3758 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3759 | ;} | 
|  | 3760 | break; | 
|  | 3761 |  | 
|  | 3762 | case 145: | 
|  | 3763 | #line 1488 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3764 | { // Nonempty unsized arr | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3765 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3766 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); | 
|  | 3767 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3768 | if (PTy == 0) | 
|  | 3769 | GEN_ERROR("Cannot make packed constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3770 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3771 | const Type *ETy = PTy->getElementType(); | 
|  | 3772 | int NumElements = PTy->getNumElements(); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3773 |  | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3774 | // Verify that we have the correct size... | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3775 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3776 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3777 | utostr((yyvsp[-1].ConstVector)->size()) +  " arguments, but has size of " + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3778 | itostr(NumElements) + ""); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3779 |  | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3780 | // Verify all elements are correct type! | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3781 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { | 
|  | 3782 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3783 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + | 
|  | 3784 | ETy->getDescription() +"' as required!\nIt is of type '"+ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3785 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3786 | } | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3787 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3788 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector)); | 
|  | 3789 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3790 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3791 | ;} | 
|  | 3792 | break; | 
|  | 3793 |  | 
|  | 3794 | case 146: | 
|  | 3795 | #line 1516 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3796 | { | 
|  | 3797 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3798 | if (STy == 0) | 
|  | 3799 | GEN_ERROR("Cannot make struct constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3800 | (*(yyvsp[-3].TypeVal))->getDescription() + "'"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3801 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3802 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3803 | GEN_ERROR("Illegal number of initializers for structure type"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3804 |  | 
|  | 3805 | // Check to ensure that constants are compatible with the type initializer! | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3806 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) | 
|  | 3807 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3808 | GEN_ERROR("Expected type '" + | 
|  | 3809 | STy->getElementType(i)->getDescription() + | 
|  | 3810 | "' for element #" + utostr(i) + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3811 | " of structure initializer"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3812 |  | 
|  | 3813 | // Check to ensure that Type is not packed | 
|  | 3814 | if (STy->isPacked()) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3815 | GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3816 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3817 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); | 
|  | 3818 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3819 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3820 | ;} | 
|  | 3821 | break; | 
|  | 3822 |  | 
|  | 3823 | case 147: | 
|  | 3824 | #line 1541 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3825 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3826 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3827 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
|  | 3828 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3829 | if (STy == 0) | 
|  | 3830 | GEN_ERROR("Cannot make struct constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3831 | (*(yyvsp[-2].TypeVal))->getDescription() + "'"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3832 |  | 
|  | 3833 | if (STy->getNumContainedTypes() != 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3834 | GEN_ERROR("Illegal number of initializers for structure type"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3835 |  | 
|  | 3836 | // Check to ensure that Type is not packed | 
|  | 3837 | if (STy->isPacked()) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3838 | GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3839 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3840 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); | 
|  | 3841 | delete (yyvsp[-2].TypeVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3842 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3843 | ;} | 
|  | 3844 | break; | 
|  | 3845 |  | 
|  | 3846 | case 148: | 
|  | 3847 | #line 1560 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3848 | { | 
|  | 3849 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get()); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3850 | if (STy == 0) | 
|  | 3851 | GEN_ERROR("Cannot make struct constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3852 | (*(yyvsp[-5].TypeVal))->getDescription() + "'"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3853 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3854 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3855 | GEN_ERROR("Illegal number of initializers for structure type"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3856 |  | 
|  | 3857 | // Check to ensure that constants are compatible with the type initializer! | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3858 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) | 
|  | 3859 | if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i)) | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3860 | GEN_ERROR("Expected type '" + | 
|  | 3861 | STy->getElementType(i)->getDescription() + | 
|  | 3862 | "' for element #" + utostr(i) + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3863 | " of structure initializer"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3864 |  | 
|  | 3865 | // Check to ensure that Type is packed | 
|  | 3866 | if (!STy->isPacked()) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3867 | GEN_ERROR("Vector initializer to non-vector type '" + | 
|  | 3868 | STy->getDescription() + "'"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3869 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3870 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector)); | 
|  | 3871 | delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3872 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3873 | ;} | 
|  | 3874 | break; | 
|  | 3875 |  | 
|  | 3876 | case 149: | 
|  | 3877 | #line 1586 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3878 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3879 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3880 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); | 
|  | 3881 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get()); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3882 | if (STy == 0) | 
|  | 3883 | GEN_ERROR("Cannot make struct constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3884 | (*(yyvsp[-4].TypeVal))->getDescription() + "'"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3885 |  | 
|  | 3886 | if (STy->getNumContainedTypes() != 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3887 | GEN_ERROR("Illegal number of initializers for structure type"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3888 |  | 
|  | 3889 | // Check to ensure that Type is packed | 
|  | 3890 | if (!STy->isPacked()) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 3891 | GEN_ERROR("Vector initializer to non-vector type '" + | 
|  | 3892 | STy->getDescription() + "'"); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3893 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3894 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); | 
|  | 3895 | delete (yyvsp[-4].TypeVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3896 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3897 | ;} | 
|  | 3898 | break; | 
|  | 3899 |  | 
|  | 3900 | case 150: | 
|  | 3901 | #line 1606 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3902 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3903 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3904 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 3905 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3906 | if (PTy == 0) | 
|  | 3907 | GEN_ERROR("Cannot make null pointer constant with type: '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3908 | (*(yyvsp[-1].TypeVal))->getDescription() + "'"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3909 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3910 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); | 
|  | 3911 | delete (yyvsp[-1].TypeVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3912 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3913 | ;} | 
|  | 3914 | break; | 
|  | 3915 |  | 
|  | 3916 | case 151: | 
|  | 3917 | #line 1618 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3918 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3919 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3920 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 3921 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); | 
|  | 3922 | delete (yyvsp[-1].TypeVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3923 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3924 | ;} | 
|  | 3925 | break; | 
|  | 3926 |  | 
|  | 3927 | case 152: | 
|  | 3928 | #line 1625 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3929 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3930 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3931 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 3932 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3933 | if (Ty == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 3934 | GEN_ERROR("Global const reference must be a pointer type"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3935 |  | 
|  | 3936 | // ConstExprs can exist in the body of a function, thus creating | 
|  | 3937 | // GlobalValues whenever they refer to a variable.  Because we are in | 
|  | 3938 | // the context of a function, getValNonImprovising will search the functions | 
|  | 3939 | // symbol table instead of the module symbol table for the global symbol, | 
|  | 3940 | // which throws things all off.  To get around this, we just tell | 
|  | 3941 | // getValNonImprovising that we are at global scope here. | 
|  | 3942 | // | 
|  | 3943 | Function *SavedCurFn = CurFun.CurrentFunction; | 
|  | 3944 | CurFun.CurrentFunction = 0; | 
|  | 3945 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3946 | Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3947 | CHECK_FOR_ERROR | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3948 |  | 
|  | 3949 | CurFun.CurrentFunction = SavedCurFn; | 
|  | 3950 |  | 
|  | 3951 | // If this is an initializer for a constant pointer, which is referencing a | 
|  | 3952 | // (currently) undefined variable, create a stub now that shall be replaced | 
|  | 3953 | // in the future with the right type of variable. | 
|  | 3954 | // | 
|  | 3955 | if (V == 0) { | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 3956 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3957 | const PointerType *PT = cast<PointerType>(Ty); | 
|  | 3958 |  | 
|  | 3959 | // First check to see if the forward references value is already created! | 
|  | 3960 | PerModuleInfo::GlobalRefsType::iterator I = | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3961 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3962 |  | 
|  | 3963 | if (I != CurModule.GlobalRefs.end()) { | 
|  | 3964 | V = I->second;             // Placeholder already exists, use it... | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3965 | (yyvsp[0].ValIDVal).destroy(); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3966 | } else { | 
|  | 3967 | std::string Name; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3968 | if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName) | 
|  | 3969 | Name = (yyvsp[0].ValIDVal).Name; | 
|  | 3970 | else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID) | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3971 | GEN_ERROR("Invalid reference to global"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3972 |  | 
|  | 3973 | // Create the forward referenced global. | 
|  | 3974 | GlobalValue *GV; | 
|  | 3975 | if (const FunctionType *FTy = | 
|  | 3976 | dyn_cast<FunctionType>(PT->getElementType())) { | 
|  | 3977 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, | 
|  | 3978 | CurModule.CurrentModule); | 
|  | 3979 | } else { | 
|  | 3980 | GV = new GlobalVariable(PT->getElementType(), false, | 
|  | 3981 | GlobalValue::ExternalLinkage, 0, | 
|  | 3982 | Name, CurModule.CurrentModule); | 
|  | 3983 | } | 
|  | 3984 |  | 
|  | 3985 | // Keep track of the fact that we have a forward ref to recycle it | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3986 | 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] | 3987 | V = GV; | 
|  | 3988 | } | 
|  | 3989 | } | 
|  | 3990 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3991 | (yyval.ConstVal) = cast<GlobalValue>(V); | 
|  | 3992 | delete (yyvsp[-1].TypeVal);            // Free the type handle | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3993 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 3994 | ;} | 
|  | 3995 | break; | 
|  | 3996 |  | 
|  | 3997 | case 153: | 
|  | 3998 | #line 1691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 3999 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4000 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4001 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 4002 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4003 | GEN_ERROR("Mismatched types for constant expression: " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4004 | (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription()); | 
|  | 4005 | (yyval.ConstVal) = (yyvsp[0].ConstVal); | 
|  | 4006 | delete (yyvsp[-1].TypeVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4007 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4008 | ;} | 
|  | 4009 | break; | 
|  | 4010 |  | 
|  | 4011 | case 154: | 
|  | 4012 | #line 1701 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4013 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4014 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4015 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 4016 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4017 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4018 | GEN_ERROR("Cannot create a null initialized value of this type"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4019 | (yyval.ConstVal) = Constant::getNullValue(Ty); | 
|  | 4020 | delete (yyvsp[-1].TypeVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4021 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4022 | ;} | 
|  | 4023 | break; | 
|  | 4024 |  | 
|  | 4025 | case 155: | 
|  | 4026 | #line 1711 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4027 | {      // integral constants | 
|  | 4028 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4029 | GEN_ERROR("Constant value doesn't fit in type"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4030 | APInt Val(64, (yyvsp[0].SInt64Val)); | 
|  | 4031 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); | 
|  | 4032 | if (BitWidth > 64) | 
|  | 4033 | Val.sext(BitWidth); | 
|  | 4034 | else if (BitWidth < 64) | 
|  | 4035 | Val.trunc(BitWidth); | 
|  | 4036 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), Val); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4037 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4038 | ;} | 
|  | 4039 | break; | 
|  | 4040 |  | 
|  | 4041 | case 156: | 
|  | 4042 | #line 1723 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4043 | {      // arbitrary precision integer constants | 
|  | 4044 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); | 
|  | 4045 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { | 
|  | 4046 | GEN_ERROR("Constant value does not fit in type"); | 
|  | 4047 | } else if ((yyvsp[0].APIntVal)->getBitWidth() < BitWidth) | 
|  | 4048 | (yyvsp[0].APIntVal)->sext(BitWidth); | 
|  | 4049 | else if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) | 
|  | 4050 | (yyvsp[0].APIntVal)->trunc(BitWidth); | 
|  | 4051 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), *(yyvsp[0].APIntVal)); | 
|  | 4052 | delete (yyvsp[0].APIntVal); | 
|  | 4053 | CHECK_FOR_ERROR | 
|  | 4054 | ;} | 
|  | 4055 | break; | 
|  | 4056 |  | 
|  | 4057 | case 157: | 
|  | 4058 | #line 1735 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4059 | {      // integral constants | 
|  | 4060 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4061 | GEN_ERROR("Constant value doesn't fit in type"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4062 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); | 
|  | 4063 | APInt Val(BitWidth, (yyvsp[0].UInt64Val)); | 
|  | 4064 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), Val); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4065 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4066 | ;} | 
|  | 4067 | break; | 
|  | 4068 |  | 
|  | 4069 | case 158: | 
|  | 4070 | #line 1743 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4071 | {      // arbitrary precision integer constants | 
|  | 4072 | uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth(); | 
|  | 4073 | if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) { | 
|  | 4074 | GEN_ERROR("Constant value does not fit in type"); | 
|  | 4075 | } else if ((yyvsp[0].APIntVal)->getBitWidth() < BitWidth) | 
|  | 4076 | (yyvsp[0].APIntVal)->zext(BitWidth); | 
|  | 4077 | else if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) | 
|  | 4078 | (yyvsp[0].APIntVal)->trunc(BitWidth); | 
|  | 4079 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), *(yyvsp[0].APIntVal)); | 
|  | 4080 | delete (yyvsp[0].APIntVal); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4081 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4082 | ;} | 
|  | 4083 | break; | 
|  | 4084 |  | 
|  | 4085 | case 159: | 
|  | 4086 | #line 1755 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4087 | {                      // Boolean constants | 
|  | 4088 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); | 
|  | 4089 | (yyval.ConstVal) = ConstantInt::getTrue(); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4090 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4091 | ;} | 
|  | 4092 | break; | 
|  | 4093 |  | 
|  | 4094 | case 160: | 
|  | 4095 | #line 1760 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4096 | {                     // Boolean constants | 
|  | 4097 | assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?"); | 
|  | 4098 | (yyval.ConstVal) = ConstantInt::getFalse(); | 
|  | 4099 | CHECK_FOR_ERROR | 
|  | 4100 | ;} | 
|  | 4101 | break; | 
|  | 4102 |  | 
|  | 4103 | case 161: | 
|  | 4104 | #line 1765 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4105 | {                   // Float & Double constants | 
|  | 4106 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4107 | GEN_ERROR("Floating point constant invalid for type"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4108 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4109 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4110 | ;} | 
|  | 4111 | break; | 
|  | 4112 |  | 
|  | 4113 | case 162: | 
|  | 4114 | #line 1773 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4115 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4116 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4117 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 4118 | Constant *Val = (yyvsp[-3].ConstVal); | 
|  | 4119 | const Type *DestTy = (yyvsp[-1].TypeVal)->get(); | 
|  | 4120 | if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy)) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4121 | GEN_ERROR("invalid cast opcode for cast from '" + | 
|  | 4122 | Val->getType()->getDescription() + "' to '" + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4123 | DestTy->getDescription() + "'"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4124 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy); | 
|  | 4125 | delete (yyvsp[-1].TypeVal); | 
|  | 4126 | ;} | 
|  | 4127 | break; | 
|  | 4128 |  | 
|  | 4129 | case 163: | 
|  | 4130 | #line 1785 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4131 | { | 
|  | 4132 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4133 | GEN_ERROR("GetElementPtr requires a pointer operand"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4134 |  | 
|  | 4135 | const Type *IdxTy = | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4136 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(), | 
| Chris Lattner | 7d9801d | 2007-02-13 00:58:01 +0000 | [diff] [blame] | 4137 | true); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4138 | if (!IdxTy) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4139 | GEN_ERROR("Index list invalid for constant getelementptr"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4140 |  | 
| Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4141 | SmallVector<Constant*, 8> IdxVec; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4142 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) | 
|  | 4143 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4144 | IdxVec.push_back(C); | 
|  | 4145 | else | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4146 | GEN_ERROR("Indices to constant getelementptr must be constants"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4147 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4148 | delete (yyvsp[-1].ValueList); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4149 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4150 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size()); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4151 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4152 | ;} | 
|  | 4153 | break; | 
|  | 4154 |  | 
|  | 4155 | case 164: | 
|  | 4156 | #line 1807 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4157 | { | 
|  | 4158 | if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4159 | GEN_ERROR("Select condition must be of boolean type"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4160 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4161 | GEN_ERROR("Select operand types must match"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4162 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4163 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4164 | ;} | 
|  | 4165 | break; | 
|  | 4166 |  | 
|  | 4167 | case 165: | 
|  | 4168 | #line 1815 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4169 | { | 
|  | 4170 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4171 | GEN_ERROR("Binary operator types must match"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4172 | CHECK_FOR_ERROR; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4173 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
|  | 4174 | ;} | 
|  | 4175 | break; | 
|  | 4176 |  | 
|  | 4177 | case 166: | 
|  | 4178 | #line 1821 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4179 | { | 
|  | 4180 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4181 | GEN_ERROR("Logical operator types must match"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4182 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) { | 
|  | 4183 | if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) || | 
|  | 4184 | !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4185 | GEN_ERROR("Logical operator requires integral operands"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4186 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4187 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4188 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4189 | ;} | 
|  | 4190 | break; | 
|  | 4191 |  | 
|  | 4192 | case 167: | 
|  | 4193 | #line 1832 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4194 | { | 
|  | 4195 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4196 | GEN_ERROR("icmp operand types must match"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4197 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
|  | 4198 | ;} | 
|  | 4199 | break; | 
|  | 4200 |  | 
|  | 4201 | case 168: | 
|  | 4202 | #line 1837 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4203 | { | 
|  | 4204 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4205 | GEN_ERROR("fcmp operand types must match"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4206 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
|  | 4207 | ;} | 
|  | 4208 | break; | 
|  | 4209 |  | 
|  | 4210 | case 169: | 
|  | 4211 | #line 1842 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4212 | { | 
|  | 4213 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4214 | GEN_ERROR("Invalid extractelement operands"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4215 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4216 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4217 | ;} | 
|  | 4218 | break; | 
|  | 4219 |  | 
|  | 4220 | case 170: | 
|  | 4221 | #line 1848 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4222 | { | 
|  | 4223 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4224 | GEN_ERROR("Invalid insertelement operands"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4225 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4226 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4227 | ;} | 
|  | 4228 | break; | 
|  | 4229 |  | 
|  | 4230 | case 171: | 
|  | 4231 | #line 1854 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4232 | { | 
|  | 4233 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4234 | GEN_ERROR("Invalid shufflevector operands"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4235 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4236 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4237 | ;} | 
|  | 4238 | break; | 
|  | 4239 |  | 
|  | 4240 | case 172: | 
|  | 4241 | #line 1863 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4242 | { | 
|  | 4243 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4244 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4245 | ;} | 
|  | 4246 | break; | 
|  | 4247 |  | 
|  | 4248 | case 173: | 
|  | 4249 | #line 1867 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4250 | { | 
|  | 4251 | (yyval.ConstVector) = new std::vector<Constant*>(); | 
|  | 4252 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4253 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4254 | ;} | 
|  | 4255 | break; | 
|  | 4256 |  | 
|  | 4257 | case 174: | 
|  | 4258 | #line 1875 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4259 | { (yyval.BoolVal) = false; ;} | 
|  | 4260 | break; | 
|  | 4261 |  | 
|  | 4262 | case 175: | 
|  | 4263 | #line 1875 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4264 | { (yyval.BoolVal) = true; ;} | 
|  | 4265 | break; | 
|  | 4266 |  | 
|  | 4267 | case 176: | 
|  | 4268 | #line 1886 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4269 | { | 
|  | 4270 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4271 | CurModule.ModuleDone(); | 
|  | 4272 | CHECK_FOR_ERROR; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4273 | ;} | 
|  | 4274 | break; | 
|  | 4275 |  | 
|  | 4276 | case 177: | 
|  | 4277 | #line 1891 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4278 | { | 
|  | 4279 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4280 | CurModule.ModuleDone(); | 
|  | 4281 | CHECK_FOR_ERROR; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4282 | ;} | 
|  | 4283 | break; | 
|  | 4284 |  | 
|  | 4285 | case 180: | 
|  | 4286 | #line 1904 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4287 | { CurFun.isDeclare = false; ;} | 
|  | 4288 | break; | 
|  | 4289 |  | 
|  | 4290 | case 181: | 
|  | 4291 | #line 1904 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4292 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4293 | CurFun.FunctionDone(); | 
|  | 4294 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4295 | ;} | 
|  | 4296 | break; | 
|  | 4297 |  | 
|  | 4298 | case 182: | 
|  | 4299 | #line 1908 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4300 | { CurFun.isDeclare = true; ;} | 
|  | 4301 | break; | 
|  | 4302 |  | 
|  | 4303 | case 183: | 
|  | 4304 | #line 1908 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4305 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4306 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4307 | ;} | 
|  | 4308 | break; | 
|  | 4309 |  | 
|  | 4310 | case 184: | 
|  | 4311 | #line 1911 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4312 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4313 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4314 | ;} | 
|  | 4315 | break; | 
|  | 4316 |  | 
|  | 4317 | case 185: | 
|  | 4318 | #line 1914 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4319 | { | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4320 | // Emit an error if there are any unresolved types left. | 
|  | 4321 | if (!CurModule.LateResolveTypes.empty()) { | 
|  | 4322 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4323 | if (DID.Type == ValID::LocalName) { | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4324 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); | 
|  | 4325 | } else { | 
|  | 4326 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); | 
|  | 4327 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4328 | } | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4329 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4330 | ;} | 
|  | 4331 | break; | 
|  | 4332 |  | 
|  | 4333 | case 186: | 
|  | 4334 | #line 1926 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4335 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4336 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4337 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4338 | // Eagerly resolve types.  This is not an optimization, this is a | 
|  | 4339 | // requirement that is due to the fact that we could have this: | 
|  | 4340 | // | 
|  | 4341 | // %list = type { %list * } | 
|  | 4342 | // %list = type { %list * }    ; repeated type decl | 
|  | 4343 | // | 
|  | 4344 | // If types are not resolved eagerly, then the two types will not be | 
|  | 4345 | // determined to be the same type! | 
|  | 4346 | // | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4347 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4348 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4349 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4350 | CHECK_FOR_ERROR | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4351 | // If this is a named type that is not a redefinition, add it to the slot | 
|  | 4352 | // table. | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4353 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4354 | } | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4355 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4356 | delete (yyvsp[0].TypeVal); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4357 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4358 | ;} | 
|  | 4359 | break; | 
| Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4360 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4361 | case 187: | 
|  | 4362 | #line 1950 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4363 | { | 
|  | 4364 | ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType)); | 
|  | 4365 |  | 
|  | 4366 | if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4367 | CHECK_FOR_ERROR | 
|  | 4368 | // If this is a named type that is not a redefinition, add it to the slot | 
|  | 4369 | // table. | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4370 | CurModule.Types.push_back((yyvsp[0].PrimType)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4371 | } | 
| Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4372 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4373 | ;} | 
|  | 4374 | break; | 
|  | 4375 |  | 
|  | 4376 | case 188: | 
|  | 4377 | #line 1961 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4378 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4379 | /* "Externally Visible" Linkage */ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4380 | if ((yyvsp[0].ConstVal) == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4381 | GEN_ERROR("Global value initializer is not a constant"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4382 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, | 
|  | 4383 | (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4384 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4385 | ;} | 
|  | 4386 | break; | 
|  | 4387 |  | 
|  | 4388 | case 189: | 
|  | 4389 | #line 1968 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4390 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4391 | CurGV = 0; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4392 | ;} | 
|  | 4393 | break; | 
|  | 4394 |  | 
|  | 4395 | case 190: | 
|  | 4396 | #line 1971 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4397 | { | 
|  | 4398 | if ((yyvsp[0].ConstVal) == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4399 | GEN_ERROR("Global value initializer is not a constant"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4400 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4401 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4402 | ;} | 
|  | 4403 | break; | 
|  | 4404 |  | 
|  | 4405 | case 191: | 
|  | 4406 | #line 1976 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4407 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4408 | CurGV = 0; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4409 | ;} | 
|  | 4410 | break; | 
|  | 4411 |  | 
|  | 4412 | case 192: | 
|  | 4413 | #line 1979 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4414 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4415 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4416 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); | 
|  | 4417 | CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4418 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4419 | delete (yyvsp[0].TypeVal); | 
|  | 4420 | ;} | 
|  | 4421 | break; | 
|  | 4422 |  | 
|  | 4423 | case 193: | 
|  | 4424 | #line 1985 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4425 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4426 | CurGV = 0; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4427 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4428 | ;} | 
|  | 4429 | break; | 
|  | 4430 |  | 
|  | 4431 | case 194: | 
|  | 4432 | #line 1989 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4433 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4434 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4435 | ;} | 
|  | 4436 | break; | 
|  | 4437 |  | 
|  | 4438 | case 195: | 
|  | 4439 | #line 1992 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4440 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4441 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4442 | ;} | 
|  | 4443 | break; | 
|  | 4444 |  | 
|  | 4445 | case 196: | 
|  | 4446 | #line 1998 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4447 | { | 
| Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4448 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4449 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); | 
|  | 4450 | std::string NewAsm((yyvsp[0].StrVal), EndStr); | 
|  | 4451 | free((yyvsp[0].StrVal)); | 
| Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4452 |  | 
|  | 4453 | if (AsmSoFar.empty()) | 
|  | 4454 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); | 
|  | 4455 | else | 
|  | 4456 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4457 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4458 | ;} | 
|  | 4459 | break; | 
|  | 4460 |  | 
|  | 4461 | case 197: | 
|  | 4462 | #line 2011 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4463 | { | 
|  | 4464 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); | 
|  | 4465 | free((yyvsp[0].StrVal)); | 
|  | 4466 | ;} | 
|  | 4467 | break; | 
|  | 4468 |  | 
|  | 4469 | case 198: | 
|  | 4470 | #line 2015 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4471 | { | 
|  | 4472 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); | 
|  | 4473 | free((yyvsp[0].StrVal)); | 
|  | 4474 | ;} | 
|  | 4475 | break; | 
|  | 4476 |  | 
|  | 4477 | case 200: | 
|  | 4478 | #line 2022 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4479 | { | 
|  | 4480 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); | 
|  | 4481 | free((yyvsp[0].StrVal)); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4482 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4483 | ;} | 
|  | 4484 | break; | 
|  | 4485 |  | 
|  | 4486 | case 201: | 
|  | 4487 | #line 2027 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4488 | { | 
|  | 4489 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); | 
|  | 4490 | free((yyvsp[0].StrVal)); | 
| Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 4491 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4492 | ;} | 
|  | 4493 | break; | 
|  | 4494 |  | 
|  | 4495 | case 202: | 
|  | 4496 | #line 2032 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4497 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4498 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4499 | ;} | 
|  | 4500 | break; | 
|  | 4501 |  | 
|  | 4502 | case 203: | 
|  | 4503 | #line 2041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4504 | { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4505 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4506 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
|  | 4507 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4508 | GEN_ERROR("void typed arguments are invalid"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4509 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); | 
|  | 4510 | (yyval.ArgList) = (yyvsp[-4].ArgList); | 
|  | 4511 | (yyvsp[-4].ArgList)->push_back(E); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4512 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4513 | ;} | 
|  | 4514 | break; | 
|  | 4515 |  | 
|  | 4516 | case 204: | 
|  | 4517 | #line 2051 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4518 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4519 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4520 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
|  | 4521 | if (*(yyvsp[-2].TypeVal) == Type::VoidTy) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4522 | GEN_ERROR("void typed arguments are invalid"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4523 | ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal); | 
|  | 4524 | (yyval.ArgList) = new ArgListType; | 
|  | 4525 | (yyval.ArgList)->push_back(E); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4526 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4527 | ;} | 
|  | 4528 | break; | 
|  | 4529 |  | 
|  | 4530 | case 205: | 
|  | 4531 | #line 2062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4532 | { | 
|  | 4533 | (yyval.ArgList) = (yyvsp[0].ArgList); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4534 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4535 | ;} | 
|  | 4536 | break; | 
|  | 4537 |  | 
|  | 4538 | case 206: | 
|  | 4539 | #line 2066 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4540 | { | 
|  | 4541 | (yyval.ArgList) = (yyvsp[-2].ArgList); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4542 | struct ArgListEntry E; | 
|  | 4543 | E.Ty = new PATypeHolder(Type::VoidTy); | 
|  | 4544 | E.Name = 0; | 
|  | 4545 | E.Attrs = FunctionType::NoAttributeSet; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4546 | (yyval.ArgList)->push_back(E); | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4547 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4548 | ;} | 
|  | 4549 | break; | 
|  | 4550 |  | 
|  | 4551 | case 207: | 
|  | 4552 | #line 2075 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4553 | { | 
|  | 4554 | (yyval.ArgList) = new ArgListType; | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4555 | struct ArgListEntry E; | 
|  | 4556 | E.Ty = new PATypeHolder(Type::VoidTy); | 
|  | 4557 | E.Name = 0; | 
|  | 4558 | E.Attrs = FunctionType::NoAttributeSet; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4559 | (yyval.ArgList)->push_back(E); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4560 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4561 | ;} | 
|  | 4562 | break; | 
|  | 4563 |  | 
|  | 4564 | case 208: | 
|  | 4565 | #line 2084 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4566 | { | 
|  | 4567 | (yyval.ArgList) = 0; | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4568 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4569 | ;} | 
|  | 4570 | break; | 
|  | 4571 |  | 
|  | 4572 | case 209: | 
|  | 4573 | #line 2090 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4574 | { | 
|  | 4575 | UnEscapeLexed((yyvsp[-6].StrVal)); | 
|  | 4576 | std::string FunctionName((yyvsp[-6].StrVal)); | 
|  | 4577 | free((yyvsp[-6].StrVal));  // Free strdup'd memory! | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4578 |  | 
| Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4579 | // Check the function result for abstractness if this is a define. We should | 
|  | 4580 | // have no abstract types at this point | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4581 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal))) | 
|  | 4582 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription()); | 
| Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4583 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4584 | std::vector<const Type*> ParamTypeList; | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4585 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4586 | ParamAttrs.push_back((yyvsp[-2].ParamAttrs)); | 
|  | 4587 | if ((yyvsp[-4].ArgList)) {   // If there are arguments... | 
|  | 4588 | 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] | 4589 | const Type* Ty = I->Ty->get(); | 
| Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 4590 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) | 
|  | 4591 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4592 | ParamTypeList.push_back(Ty); | 
|  | 4593 | if (Ty != Type::VoidTy) | 
|  | 4594 | ParamAttrs.push_back(I->Attrs); | 
|  | 4595 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4596 | } | 
|  | 4597 |  | 
|  | 4598 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; | 
|  | 4599 | if (isVarArg) ParamTypeList.pop_back(); | 
|  | 4600 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4601 | FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4602 | ParamAttrs); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4603 | const PointerType *PFT = PointerType::get(FT); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4604 | delete (yyvsp[-7].TypeVal); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4605 |  | 
|  | 4606 | ValID ID; | 
|  | 4607 | if (!FunctionName.empty()) { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4608 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4609 | } else { | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4610 | ID = ValID::createGlobalID(CurModule.Values[PFT].size()); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4611 | } | 
|  | 4612 |  | 
|  | 4613 | Function *Fn = 0; | 
|  | 4614 | // See if this function was forward referenced.  If so, recycle the object. | 
|  | 4615 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { | 
|  | 4616 | // Move the function to the end of the list, from whereever it was | 
|  | 4617 | // previously inserted. | 
|  | 4618 | Fn = cast<Function>(FWRef); | 
|  | 4619 | CurModule.CurrentModule->getFunctionList().remove(Fn); | 
|  | 4620 | CurModule.CurrentModule->getFunctionList().push_back(Fn); | 
|  | 4621 | } else if (!FunctionName.empty() &&     // Merge with an earlier prototype? | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4622 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { | 
|  | 4623 | if (Fn->getFunctionType() != FT ) { | 
|  | 4624 | // The existing function doesn't have the same type. This is an overload | 
|  | 4625 | // error. | 
|  | 4626 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); | 
|  | 4627 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { | 
|  | 4628 | // Neither the existing or the current function is a declaration and they | 
|  | 4629 | // have the same name and same type. Clearly this is a redefinition. | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4630 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4631 | } if (Fn->isDeclaration()) { | 
|  | 4632 | // Make sure to strip off any argument names so we can't get conflicts. | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4633 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); | 
|  | 4634 | AI != AE; ++AI) | 
|  | 4635 | AI->setName(""); | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4636 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4637 | } else  {  // Not already defined? | 
|  | 4638 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, | 
|  | 4639 | CurModule.CurrentModule); | 
| Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4640 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4641 | InsertValue(Fn, CurModule.Values); | 
|  | 4642 | } | 
|  | 4643 |  | 
|  | 4644 | CurFun.FunctionStart(Fn); | 
| Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4645 |  | 
|  | 4646 | if (CurFun.isDeclare) { | 
|  | 4647 | // If we have declaration, always overwrite linkage.  This will allow us to | 
|  | 4648 | // correctly handle cases, when pointer to function is passed as argument to | 
|  | 4649 | // another function. | 
|  | 4650 | Fn->setLinkage(CurFun.Linkage); | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4651 | Fn->setVisibility(CurFun.Visibility); | 
| Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4652 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4653 | Fn->setCallingConv((yyvsp[-8].UIntVal)); | 
|  | 4654 | Fn->setAlignment((yyvsp[0].UIntVal)); | 
|  | 4655 | if ((yyvsp[-1].StrVal)) { | 
|  | 4656 | Fn->setSection((yyvsp[-1].StrVal)); | 
|  | 4657 | free((yyvsp[-1].StrVal)); | 
| Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4658 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4659 |  | 
|  | 4660 | // Add all of the arguments we parsed to the function... | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4661 | if ((yyvsp[-4].ArgList)) {                     // Is null if empty... | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4662 | if (isVarArg) {  // Nuke the last entry | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4663 | assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 && | 
| Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4664 | "Not a varargs marker!"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4665 | delete (yyvsp[-4].ArgList)->back().Ty; | 
|  | 4666 | (yyvsp[-4].ArgList)->pop_back();  // Delete the last entry | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4667 | } | 
|  | 4668 | Function::arg_iterator ArgIt = Fn->arg_begin(); | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4669 | Function::arg_iterator ArgEnd = Fn->arg_end(); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4670 | unsigned Idx = 1; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4671 | for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); | 
|  | 4672 | I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4673 | delete I->Ty;                          // Delete the typeholder... | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 4674 | setValueName(ArgIt, I->Name);          // Insert arg into symtab... | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4675 | CHECK_FOR_ERROR | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4676 | InsertValue(ArgIt); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4677 | Idx++; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4678 | } | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4679 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4680 | delete (yyvsp[-4].ArgList);                     // We're now done with the argument list | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4681 | } | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4682 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4683 | ;} | 
|  | 4684 | break; | 
|  | 4685 |  | 
|  | 4686 | case 212: | 
|  | 4687 | #line 2203 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4688 | { | 
|  | 4689 | (yyval.FunctionVal) = CurFun.CurrentFunction; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4690 |  | 
|  | 4691 | // Make sure that we keep track of the linkage type even if there was a | 
|  | 4692 | // previous "declare". | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4693 | (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage)); | 
|  | 4694 | (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility)); | 
|  | 4695 | ;} | 
|  | 4696 | break; | 
|  | 4697 |  | 
|  | 4698 | case 215: | 
|  | 4699 | #line 2214 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4700 | { | 
|  | 4701 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4702 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4703 | ;} | 
|  | 4704 | break; | 
|  | 4705 |  | 
|  | 4706 | case 216: | 
|  | 4707 | #line 2219 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4708 | { | 
|  | 4709 | CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage)); | 
|  | 4710 | CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility)); | 
|  | 4711 | (yyval.FunctionVal) = CurFun.CurrentFunction; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4712 | CurFun.FunctionDone(); | 
|  | 4713 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4714 | ;} | 
|  | 4715 | break; | 
|  | 4716 |  | 
|  | 4717 | case 217: | 
|  | 4718 | #line 2231 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4719 | { | 
|  | 4720 | (yyval.BoolVal) = false; | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4721 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4722 | ;} | 
|  | 4723 | break; | 
|  | 4724 |  | 
|  | 4725 | case 218: | 
|  | 4726 | #line 2235 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4727 | { | 
|  | 4728 | (yyval.BoolVal) = true; | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4729 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4730 | ;} | 
|  | 4731 | break; | 
|  | 4732 |  | 
|  | 4733 | case 219: | 
|  | 4734 | #line 2240 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4735 | {    // A reference to a direct constant | 
|  | 4736 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4737 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4738 | ;} | 
|  | 4739 | break; | 
|  | 4740 |  | 
|  | 4741 | case 220: | 
|  | 4742 | #line 2244 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4743 | { | 
|  | 4744 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4745 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4746 | ;} | 
|  | 4747 | break; | 
|  | 4748 |  | 
|  | 4749 | case 221: | 
|  | 4750 | #line 2248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4751 | {                     // Perhaps it's an FP constant? | 
|  | 4752 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4753 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4754 | ;} | 
|  | 4755 | break; | 
|  | 4756 |  | 
|  | 4757 | case 222: | 
|  | 4758 | #line 2252 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4759 | { | 
|  | 4760 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4761 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4762 | ;} | 
|  | 4763 | break; | 
|  | 4764 |  | 
|  | 4765 | case 223: | 
|  | 4766 | #line 2256 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4767 | { | 
|  | 4768 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4769 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4770 | ;} | 
|  | 4771 | break; | 
|  | 4772 |  | 
|  | 4773 | case 224: | 
|  | 4774 | #line 2260 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4775 | { | 
|  | 4776 | (yyval.ValIDVal) = ValID::createNull(); | 
| Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4777 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4778 | ;} | 
|  | 4779 | break; | 
|  | 4780 |  | 
|  | 4781 | case 225: | 
|  | 4782 | #line 2264 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4783 | { | 
|  | 4784 | (yyval.ValIDVal) = ValID::createUndef(); | 
| Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 4785 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4786 | ;} | 
|  | 4787 | break; | 
|  | 4788 |  | 
|  | 4789 | case 226: | 
|  | 4790 | #line 2268 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4791 | {     // A vector zero constant. | 
|  | 4792 | (yyval.ValIDVal) = ValID::createZeroInit(); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4793 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4794 | ;} | 
|  | 4795 | break; | 
|  | 4796 |  | 
|  | 4797 | case 227: | 
|  | 4798 | #line 2272 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4799 | { // Nonempty unsized packed vector | 
|  | 4800 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); | 
|  | 4801 | int NumElements = (yyvsp[-1].ConstVector)->size(); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4802 |  | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 4803 | VectorType* pt = VectorType::get(ETy, NumElements); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4804 | PATypeHolder* PTy = new PATypeHolder( | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4805 | HandleUpRefs( | 
| Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 4806 | VectorType::get( | 
| Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4807 | ETy, | 
|  | 4808 | NumElements) | 
|  | 4809 | ) | 
|  | 4810 | ); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4811 |  | 
|  | 4812 | // Verify all elements are correct type! | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4813 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { | 
|  | 4814 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4815 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4816 | ETy->getDescription() +"' as required!\nIt is of type '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4817 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4818 | } | 
|  | 4819 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4820 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector))); | 
|  | 4821 | delete PTy; delete (yyvsp[-1].ConstVector); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4822 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4823 | ;} | 
|  | 4824 | break; | 
|  | 4825 |  | 
|  | 4826 | case 228: | 
|  | 4827 | #line 2297 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4828 | { | 
|  | 4829 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); | 
| Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4830 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4831 | ;} | 
|  | 4832 | break; | 
|  | 4833 |  | 
|  | 4834 | case 229: | 
|  | 4835 | #line 2301 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4836 | { | 
|  | 4837 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); | 
|  | 4838 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); | 
|  | 4839 | End = UnEscapeLexed((yyvsp[0].StrVal), true); | 
|  | 4840 | std::string Constraints = std::string((yyvsp[0].StrVal), End); | 
|  | 4841 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); | 
|  | 4842 | free((yyvsp[-2].StrVal)); | 
|  | 4843 | free((yyvsp[0].StrVal)); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4844 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4845 | ;} | 
|  | 4846 | break; | 
|  | 4847 |  | 
|  | 4848 | case 230: | 
|  | 4849 | #line 2315 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4850 | {  // Is it an integer reference...? | 
|  | 4851 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal)); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4852 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4853 | ;} | 
|  | 4854 | break; | 
|  | 4855 |  | 
|  | 4856 | case 231: | 
|  | 4857 | #line 2319 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4858 | { | 
|  | 4859 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal)); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4860 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4861 | ;} | 
|  | 4862 | break; | 
|  | 4863 |  | 
|  | 4864 | case 232: | 
|  | 4865 | #line 2323 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4866 | {                   // Is it a named reference...? | 
|  | 4867 | (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal)); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4868 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4869 | ;} | 
|  | 4870 | break; | 
|  | 4871 |  | 
|  | 4872 | case 233: | 
|  | 4873 | #line 2327 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4874 | {                   // Is it a named reference...? | 
|  | 4875 | (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal)); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4876 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4877 | ;} | 
|  | 4878 | break; | 
|  | 4879 |  | 
|  | 4880 | case 236: | 
|  | 4881 | #line 2339 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4882 | { | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4883 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4884 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 4885 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); | 
|  | 4886 | delete (yyvsp[-1].TypeVal); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4887 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4888 | ;} | 
|  | 4889 | break; | 
|  | 4890 |  | 
|  | 4891 | case 237: | 
|  | 4892 | #line 2348 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4893 | { | 
|  | 4894 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4895 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4896 | ;} | 
|  | 4897 | break; | 
|  | 4898 |  | 
|  | 4899 | case 238: | 
|  | 4900 | #line 2352 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4901 | { // Do not allow functions with 0 basic blocks | 
|  | 4902 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4903 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4904 | ;} | 
|  | 4905 | break; | 
|  | 4906 |  | 
|  | 4907 | case 239: | 
|  | 4908 | #line 2361 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4909 | { | 
|  | 4910 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4911 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4912 | InsertValue((yyvsp[0].TermInstVal)); | 
|  | 4913 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); | 
|  | 4914 | InsertValue((yyvsp[-2].BasicBlockVal)); | 
|  | 4915 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); | 
| Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 4916 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4917 | ;} | 
|  | 4918 | break; | 
|  | 4919 |  | 
|  | 4920 | case 240: | 
|  | 4921 | #line 2371 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4922 | { | 
|  | 4923 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4924 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) | 
|  | 4925 | if (CI2->getParent() == 0) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4926 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); | 
|  | 4927 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); | 
|  | 4928 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4929 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4930 | ;} | 
|  | 4931 | break; | 
|  | 4932 |  | 
|  | 4933 | case 241: | 
|  | 4934 | #line 2380 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4935 | { | 
|  | 4936 | (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4937 | CHECK_FOR_ERROR | 
|  | 4938 |  | 
|  | 4939 | // Make sure to move the basic block to the correct location in the | 
|  | 4940 | // function, instead of leaving it inserted wherever it was first | 
|  | 4941 | // referenced. | 
|  | 4942 | Function::BasicBlockListType &BBL = | 
|  | 4943 | CurFun.CurrentFunction->getBasicBlockList(); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4944 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4945 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4946 | ;} | 
|  | 4947 | break; | 
|  | 4948 |  | 
|  | 4949 | case 242: | 
|  | 4950 | #line 2392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4951 | { | 
|  | 4952 | (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4953 | CHECK_FOR_ERROR | 
|  | 4954 |  | 
|  | 4955 | // Make sure to move the basic block to the correct location in the | 
|  | 4956 | // function, instead of leaving it inserted wherever it was first | 
|  | 4957 | // referenced. | 
|  | 4958 | Function::BasicBlockListType &BBL = | 
|  | 4959 | CurFun.CurrentFunction->getBasicBlockList(); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4960 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); | 
| Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4961 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4962 | ;} | 
|  | 4963 | break; | 
| Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4964 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4965 | case 243: | 
|  | 4966 | #line 2405 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4967 | {              // Return with a result... | 
|  | 4968 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); | 
|  | 4969 | CHECK_FOR_ERROR | 
|  | 4970 | ;} | 
|  | 4971 | break; | 
|  | 4972 |  | 
|  | 4973 | case 244: | 
|  | 4974 | #line 2409 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4975 | {                                       // Return with no result... | 
|  | 4976 | (yyval.TermInstVal) = new ReturnInst(); | 
|  | 4977 | CHECK_FOR_ERROR | 
|  | 4978 | ;} | 
|  | 4979 | break; | 
|  | 4980 |  | 
|  | 4981 | case 245: | 
|  | 4982 | #line 2413 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4983 | {                         // Unconditional Branch... | 
|  | 4984 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); | 
|  | 4985 | CHECK_FOR_ERROR | 
|  | 4986 | (yyval.TermInstVal) = new BranchInst(tmpBB); | 
|  | 4987 | ;} | 
|  | 4988 | break; | 
|  | 4989 |  | 
|  | 4990 | case 246: | 
|  | 4991 | #line 2418 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 4992 | { | 
|  | 4993 | assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?"); | 
|  | 4994 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); | 
|  | 4995 | CHECK_FOR_ERROR | 
|  | 4996 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); | 
|  | 4997 | CHECK_FOR_ERROR | 
|  | 4998 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); | 
|  | 4999 | CHECK_FOR_ERROR | 
|  | 5000 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); | 
|  | 5001 | ;} | 
|  | 5002 | break; | 
|  | 5003 |  | 
|  | 5004 | case 247: | 
|  | 5005 | #line 2428 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5006 | { | 
|  | 5007 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); | 
|  | 5008 | CHECK_FOR_ERROR | 
|  | 5009 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); | 
|  | 5010 | CHECK_FOR_ERROR | 
|  | 5011 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); | 
|  | 5012 | (yyval.TermInstVal) = S; | 
|  | 5013 |  | 
|  | 5014 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), | 
|  | 5015 | E = (yyvsp[-1].JumpTable)->end(); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5016 | for (; I != E; ++I) { | 
|  | 5017 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) | 
|  | 5018 | S->addCase(CI, I->second); | 
|  | 5019 | else | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5020 | GEN_ERROR("Switch case is constant, but not a simple integer"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5021 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5022 | delete (yyvsp[-1].JumpTable); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5023 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5024 | ;} | 
|  | 5025 | break; | 
|  | 5026 |  | 
|  | 5027 | case 248: | 
|  | 5028 | #line 2447 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5029 | { | 
|  | 5030 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5031 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5032 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5033 | CHECK_FOR_ERROR | 
|  | 5034 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5035 | (yyval.TermInstVal) = S; | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5036 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5037 | ;} | 
|  | 5038 | break; | 
|  | 5039 |  | 
|  | 5040 | case 249: | 
|  | 5041 | #line 2457 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5042 | { | 
| Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5043 |  | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5044 | // Handle the short syntax | 
|  | 5045 | const PointerType *PFTy = 0; | 
|  | 5046 | const FunctionType *Ty = 0; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5047 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) || | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5048 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { | 
|  | 5049 | // Pull out the types of all of the arguments... | 
|  | 5050 | std::vector<const Type*> ParamTypes; | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5051 | FunctionType::ParamAttrsList ParamAttrs; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5052 | ParamAttrs.push_back((yyvsp[-6].ParamAttrs)); | 
|  | 5053 | 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] | 5054 | const Type *Ty = I->Val->getType(); | 
|  | 5055 | if (Ty == Type::VoidTy) | 
|  | 5056 | GEN_ERROR("Short call syntax cannot be used with varargs"); | 
|  | 5057 | ParamTypes.push_back(Ty); | 
|  | 5058 | ParamAttrs.push_back(I->Attrs); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5059 | } | 
|  | 5060 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5061 | Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5062 | PFTy = PointerType::get(Ty); | 
|  | 5063 | } | 
|  | 5064 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5065 | 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] | 5066 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5067 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5068 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5069 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); | 
| Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5070 | CHECK_FOR_ERROR | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5071 |  | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5072 | // Check the arguments | 
|  | 5073 | ValueList Args; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5074 | if ((yyvsp[-8].ValueRefList)->empty()) {                                   // Has no arguments? | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5075 | // Make sure no arguments is a good thing! | 
|  | 5076 | if (Ty->getNumParams() != 0) | 
|  | 5077 | GEN_ERROR("No arguments passed to a function that " | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5078 | "expects arguments"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5079 | } else {                                     // Has arguments? | 
|  | 5080 | // Loop through FunctionType's arguments and ensure they are specified | 
|  | 5081 | // correctly! | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5082 | FunctionType::param_iterator I = Ty->param_begin(); | 
|  | 5083 | FunctionType::param_iterator E = Ty->param_end(); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5084 | ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end(); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5085 |  | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5086 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { | 
|  | 5087 | if (ArgI->Val->getType() != *I) | 
|  | 5088 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5089 | (*I)->getDescription() + "'"); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5090 | Args.push_back(ArgI->Val); | 
|  | 5091 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5092 |  | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5093 | if (Ty->isVarArg()) { | 
|  | 5094 | if (I == E) | 
|  | 5095 | for (; ArgI != ArgE; ++ArgI) | 
|  | 5096 | Args.push_back(ArgI->Val); // push the remaining varargs | 
|  | 5097 | } else if (I != E || ArgI != ArgE) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5098 | GEN_ERROR("Invalid number of parameters detected"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5099 | } | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5100 |  | 
|  | 5101 | // Create the InvokeInst | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5102 | InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size()); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5103 | II->setCallingConv((yyvsp[-12].UIntVal)); | 
|  | 5104 | (yyval.TermInstVal) = II; | 
|  | 5105 | delete (yyvsp[-8].ValueRefList); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5106 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5107 | ;} | 
|  | 5108 | break; | 
|  | 5109 |  | 
|  | 5110 | case 250: | 
|  | 5111 | #line 2523 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5112 | { | 
|  | 5113 | (yyval.TermInstVal) = new UnwindInst(); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5114 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5115 | ;} | 
|  | 5116 | break; | 
|  | 5117 |  | 
|  | 5118 | case 251: | 
|  | 5119 | #line 2527 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5120 | { | 
|  | 5121 | (yyval.TermInstVal) = new UnreachableInst(); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5122 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5123 | ;} | 
|  | 5124 | break; | 
|  | 5125 |  | 
|  | 5126 | case 252: | 
|  | 5127 | #line 2534 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5128 | { | 
|  | 5129 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); | 
|  | 5130 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5131 | CHECK_FOR_ERROR | 
|  | 5132 | if (V == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5133 | GEN_ERROR("May only switch on a constant pool value"); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5134 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5135 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5136 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5137 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); | 
|  | 5138 | ;} | 
|  | 5139 | break; | 
|  | 5140 |  | 
|  | 5141 | case 253: | 
|  | 5142 | #line 2545 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5143 | { | 
|  | 5144 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); | 
|  | 5145 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5146 | CHECK_FOR_ERROR | 
|  | 5147 |  | 
|  | 5148 | if (V == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5149 | GEN_ERROR("May only switch on a constant pool value"); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5150 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5151 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5152 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5153 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); | 
|  | 5154 | ;} | 
|  | 5155 | break; | 
|  | 5156 |  | 
|  | 5157 | case 254: | 
|  | 5158 | #line 2558 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5159 | { | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5160 | // Is this definition named?? if so, assign the name... | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5161 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5162 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5163 | InsertValue((yyvsp[0].InstVal)); | 
|  | 5164 | (yyval.InstVal) = (yyvsp[0].InstVal); | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5165 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5166 | ;} | 
|  | 5167 | break; | 
|  | 5168 |  | 
|  | 5169 | case 255: | 
|  | 5170 | #line 2568 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5171 | {    // Used for PHI nodes | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5172 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5173 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription()); | 
|  | 5174 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); | 
|  | 5175 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5176 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5177 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5178 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5179 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); | 
|  | 5180 | delete (yyvsp[-5].TypeVal); | 
|  | 5181 | ;} | 
|  | 5182 | break; | 
|  | 5183 |  | 
|  | 5184 | case 256: | 
|  | 5185 | #line 2579 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5186 | { | 
|  | 5187 | (yyval.PHIList) = (yyvsp[-6].PHIList); | 
|  | 5188 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5189 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5190 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5191 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5192 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); | 
|  | 5193 | ;} | 
|  | 5194 | break; | 
|  | 5195 |  | 
|  | 5196 | case 257: | 
|  | 5197 | #line 2589 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5198 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5199 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5200 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5201 | // Used for call and invoke instructions | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5202 | (yyval.ValueRefList) = new ValueRefList(); | 
|  | 5203 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); | 
|  | 5204 | (yyval.ValueRefList)->push_back(E); | 
|  | 5205 | ;} | 
|  | 5206 | break; | 
|  | 5207 |  | 
|  | 5208 | case 258: | 
|  | 5209 | #line 2597 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5210 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5211 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5212 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
|  | 5213 | (yyval.ValueRefList) = (yyvsp[-4].ValueRefList); | 
|  | 5214 | ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal)); | 
|  | 5215 | (yyval.ValueRefList)->push_back(E); | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5216 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5217 | ;} | 
|  | 5218 | break; | 
|  | 5219 |  | 
|  | 5220 | case 259: | 
|  | 5221 | #line 2605 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5222 | { (yyval.ValueRefList) = new ValueRefList(); ;} | 
|  | 5223 | break; | 
|  | 5224 |  | 
|  | 5225 | case 260: | 
|  | 5226 | #line 2608 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5227 | { (yyval.ValueList) = new std::vector<Value*>(); ;} | 
|  | 5228 | break; | 
|  | 5229 |  | 
|  | 5230 | case 261: | 
|  | 5231 | #line 2609 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5232 | { | 
|  | 5233 | (yyval.ValueList) = (yyvsp[-2].ValueList); | 
|  | 5234 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5235 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5236 | ;} | 
|  | 5237 | break; | 
|  | 5238 |  | 
|  | 5239 | case 262: | 
|  | 5240 | #line 2616 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5241 | { | 
|  | 5242 | (yyval.BoolVal) = true; | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5243 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5244 | ;} | 
|  | 5245 | break; | 
|  | 5246 |  | 
|  | 5247 | case 263: | 
|  | 5248 | #line 2620 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5249 | { | 
|  | 5250 | (yyval.BoolVal) = false; | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5251 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5252 | ;} | 
|  | 5253 | break; | 
|  | 5254 |  | 
|  | 5255 | case 264: | 
|  | 5256 | #line 2625 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5257 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5258 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5259 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); | 
|  | 5260 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && | 
|  | 5261 | !isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5262 | GEN_ERROR( | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5263 | "Arithmetic operator requires integer, FP, or packed operands"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5264 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) && | 
|  | 5265 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || | 
|  | 5266 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || | 
|  | 5267 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5268 | GEN_ERROR("Remainder not supported on vector types"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5269 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5270 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5271 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5272 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5273 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); | 
|  | 5274 | if ((yyval.InstVal) == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5275 | GEN_ERROR("binary operator returned null"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5276 | delete (yyvsp[-3].TypeVal); | 
|  | 5277 | ;} | 
|  | 5278 | break; | 
|  | 5279 |  | 
|  | 5280 | case 265: | 
|  | 5281 | #line 2646 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5282 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5283 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5284 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); | 
|  | 5285 | if (!(*(yyvsp[-3].TypeVal))->isInteger()) { | 
|  | 5286 | if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) || | 
|  | 5287 | !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5288 | GEN_ERROR("Logical operator requires integral operands"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5289 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5290 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5291 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5292 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5293 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5294 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); | 
|  | 5295 | if ((yyval.InstVal) == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5296 | GEN_ERROR("binary operator returned null"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5297 | delete (yyvsp[-3].TypeVal); | 
|  | 5298 | ;} | 
|  | 5299 | break; | 
|  | 5300 |  | 
|  | 5301 | case 266: | 
|  | 5302 | #line 2663 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5303 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5304 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5305 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); | 
|  | 5306 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5307 | GEN_ERROR("Vector types not supported by icmp instruction"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5308 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5309 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5310 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5311 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5312 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); | 
|  | 5313 | if ((yyval.InstVal) == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5314 | GEN_ERROR("icmp operator returned null"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5315 | ;} | 
|  | 5316 | break; | 
|  | 5317 |  | 
|  | 5318 | case 267: | 
|  | 5319 | #line 2676 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5320 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5321 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5322 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription()); | 
|  | 5323 | if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get())) | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5324 | GEN_ERROR("Vector types not supported by fcmp instruction"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5325 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5326 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5327 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5328 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5329 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); | 
|  | 5330 | if ((yyval.InstVal) == 0) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5331 | GEN_ERROR("fcmp operator returned null"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5332 | ;} | 
|  | 5333 | break; | 
|  | 5334 |  | 
|  | 5335 | case 268: | 
|  | 5336 | #line 2689 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5337 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5338 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5339 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); | 
|  | 5340 | Value* Val = (yyvsp[-2].ValueVal); | 
|  | 5341 | const Type* DestTy = (yyvsp[0].TypeVal)->get(); | 
|  | 5342 | if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy)) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5343 | GEN_ERROR("invalid cast opcode for cast from '" + | 
|  | 5344 | Val->getType()->getDescription() + "' to '" + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5345 | DestTy->getDescription() + "'"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5346 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy); | 
|  | 5347 | delete (yyvsp[0].TypeVal); | 
|  | 5348 | ;} | 
|  | 5349 | break; | 
|  | 5350 |  | 
|  | 5351 | case 269: | 
|  | 5352 | #line 2701 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5353 | { | 
|  | 5354 | if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5355 | GEN_ERROR("select condition must be boolean"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5356 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5357 | GEN_ERROR("select value types should match"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5358 | (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5359 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5360 | ;} | 
|  | 5361 | break; | 
|  | 5362 |  | 
|  | 5363 | case 270: | 
|  | 5364 | #line 2709 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5365 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5366 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5367 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); | 
|  | 5368 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); | 
|  | 5369 | delete (yyvsp[0].TypeVal); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5370 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5371 | ;} | 
|  | 5372 | break; | 
|  | 5373 |  | 
|  | 5374 | case 271: | 
|  | 5375 | #line 2716 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5376 | { | 
|  | 5377 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5378 | GEN_ERROR("Invalid extractelement operands"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5379 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5380 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5381 | ;} | 
|  | 5382 | break; | 
|  | 5383 |  | 
|  | 5384 | case 272: | 
|  | 5385 | #line 2722 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5386 | { | 
|  | 5387 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5388 | GEN_ERROR("Invalid insertelement operands"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5389 | (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] | 5390 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5391 | ;} | 
|  | 5392 | break; | 
|  | 5393 |  | 
|  | 5394 | case 273: | 
|  | 5395 | #line 2728 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5396 | { | 
|  | 5397 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5398 | GEN_ERROR("Invalid shufflevector operands"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5399 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5400 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5401 | ;} | 
|  | 5402 | break; | 
|  | 5403 |  | 
|  | 5404 | case 274: | 
|  | 5405 | #line 2734 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5406 | { | 
|  | 5407 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5408 | if (!Ty->isFirstClassType()) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5409 | GEN_ERROR("PHI node operands must be of first class type"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5410 | (yyval.InstVal) = new PHINode(Ty); | 
|  | 5411 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); | 
|  | 5412 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { | 
|  | 5413 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5414 | GEN_ERROR("All elements of a PHI node must be of the same type"); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5415 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); | 
|  | 5416 | (yyvsp[0].PHIList)->pop_front(); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5417 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5418 | delete (yyvsp[0].PHIList);  // Free the list... | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5419 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5420 | ;} | 
|  | 5421 | break; | 
|  | 5422 |  | 
|  | 5423 | case 275: | 
|  | 5424 | #line 2750 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5425 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5426 |  | 
|  | 5427 | // Handle the short syntax | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5428 | const PointerType *PFTy = 0; | 
|  | 5429 | const FunctionType *Ty = 0; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5430 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) || | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5431 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { | 
|  | 5432 | // Pull out the types of all of the arguments... | 
|  | 5433 | std::vector<const Type*> ParamTypes; | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5434 | FunctionType::ParamAttrsList ParamAttrs; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5435 | ParamAttrs.push_back((yyvsp[0].ParamAttrs)); | 
|  | 5436 | 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] | 5437 | const Type *Ty = I->Val->getType(); | 
|  | 5438 | if (Ty == Type::VoidTy) | 
|  | 5439 | GEN_ERROR("Short call syntax cannot be used with varargs"); | 
|  | 5440 | ParamTypes.push_back(Ty); | 
|  | 5441 | ParamAttrs.push_back(I->Attrs); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5442 | } | 
|  | 5443 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5444 | Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5445 | PFTy = PointerType::get(Ty); | 
|  | 5446 | } | 
|  | 5447 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5448 | 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] | 5449 | CHECK_FOR_ERROR | 
|  | 5450 |  | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5451 | // Check the arguments | 
|  | 5452 | ValueList Args; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5453 | if ((yyvsp[-2].ValueRefList)->empty()) {                                   // Has no arguments? | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5454 | // Make sure no arguments is a good thing! | 
|  | 5455 | if (Ty->getNumParams() != 0) | 
|  | 5456 | GEN_ERROR("No arguments passed to a function that " | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5457 | "expects arguments"); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5458 | } else {                                     // Has arguments? | 
|  | 5459 | // Loop through FunctionType's arguments and ensure they are specified | 
|  | 5460 | // correctly! | 
|  | 5461 | // | 
|  | 5462 | FunctionType::param_iterator I = Ty->param_begin(); | 
|  | 5463 | FunctionType::param_iterator E = Ty->param_end(); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5464 | ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end(); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5465 |  | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5466 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { | 
|  | 5467 | if (ArgI->Val->getType() != *I) | 
|  | 5468 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5469 | (*I)->getDescription() + "'"); | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5470 | Args.push_back(ArgI->Val); | 
|  | 5471 | } | 
|  | 5472 | if (Ty->isVarArg()) { | 
|  | 5473 | if (I == E) | 
|  | 5474 | for (; ArgI != ArgE; ++ArgI) | 
|  | 5475 | Args.push_back(ArgI->Val); // push the remaining varargs | 
|  | 5476 | } else if (I != E || ArgI != ArgE) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5477 | GEN_ERROR("Invalid number of parameters detected"); | 
| Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5478 | } | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5479 | // Create the call node | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5480 | CallInst *CI = new CallInst(V, &Args[0], Args.size()); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5481 | CI->setTailCall((yyvsp[-7].BoolVal)); | 
|  | 5482 | CI->setCallingConv((yyvsp[-6].UIntVal)); | 
|  | 5483 | (yyval.InstVal) = CI; | 
|  | 5484 | delete (yyvsp[-2].ValueRefList); | 
|  | 5485 | delete (yyvsp[-5].TypeVal); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5486 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5487 | ;} | 
|  | 5488 | break; | 
|  | 5489 |  | 
|  | 5490 | case 276: | 
|  | 5491 | #line 2813 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5492 | { | 
|  | 5493 | (yyval.InstVal) = (yyvsp[0].InstVal); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5494 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5495 | ;} | 
|  | 5496 | break; | 
|  | 5497 |  | 
|  | 5498 | case 277: | 
|  | 5499 | #line 2818 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5500 | { | 
|  | 5501 | (yyval.BoolVal) = true; | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5502 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5503 | ;} | 
|  | 5504 | break; | 
|  | 5505 |  | 
|  | 5506 | case 278: | 
|  | 5507 | #line 2822 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5508 | { | 
|  | 5509 | (yyval.BoolVal) = false; | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5510 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5511 | ;} | 
|  | 5512 | break; | 
|  | 5513 |  | 
|  | 5514 | case 279: | 
|  | 5515 | #line 2829 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5516 | { | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5517 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5518 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 5519 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); | 
|  | 5520 | delete (yyvsp[-1].TypeVal); | 
| Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5521 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5522 | ;} | 
|  | 5523 | break; | 
|  | 5524 |  | 
|  | 5525 | case 280: | 
|  | 5526 | #line 2836 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5527 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5528 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5529 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); | 
|  | 5530 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5531 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5532 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); | 
|  | 5533 | delete (yyvsp[-4].TypeVal); | 
|  | 5534 | ;} | 
|  | 5535 | break; | 
|  | 5536 |  | 
|  | 5537 | case 281: | 
|  | 5538 | #line 2844 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5539 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5540 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5541 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 5542 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); | 
|  | 5543 | delete (yyvsp[-1].TypeVal); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5544 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5545 | ;} | 
|  | 5546 | break; | 
|  | 5547 |  | 
|  | 5548 | case 282: | 
|  | 5549 | #line 2851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5550 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5551 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5552 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription()); | 
|  | 5553 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5554 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5555 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); | 
|  | 5556 | delete (yyvsp[-4].TypeVal); | 
|  | 5557 | ;} | 
|  | 5558 | break; | 
|  | 5559 |  | 
|  | 5560 | case 283: | 
|  | 5561 | #line 2859 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5562 | { | 
|  | 5563 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5564 | GEN_ERROR("Trying to free nonpointer type " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5565 | (yyvsp[0].ValueVal)->getType()->getDescription() + ""); | 
|  | 5566 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5567 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5568 | ;} | 
|  | 5569 | break; | 
|  | 5570 |  | 
|  | 5571 | case 284: | 
|  | 5572 | #line 2867 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5573 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5574 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5575 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 5576 | if (!isa<PointerType>((yyvsp[-1].TypeVal)->get())) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5577 | GEN_ERROR("Can't load from nonpointer type: " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5578 | (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 5579 | if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5580 | GEN_ERROR("Can't load from pointer of non-first-class type: " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5581 | (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 5582 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5583 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5584 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); | 
|  | 5585 | delete (yyvsp[-1].TypeVal); | 
|  | 5586 | ;} | 
|  | 5587 | break; | 
|  | 5588 |  | 
|  | 5589 | case 285: | 
|  | 5590 | #line 2881 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5591 | { | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5592 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5593 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription()); | 
|  | 5594 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5595 | if (!PT) | 
|  | 5596 | GEN_ERROR("Can't store to a nonpointer type: " + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5597 | (*(yyvsp[-1].TypeVal))->getDescription()); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5598 | const Type *ElTy = PT->getElementType(); | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5599 | if (ElTy != (yyvsp[-3].ValueVal)->getType()) | 
|  | 5600 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5601 | "' into space of type '" + ElTy->getDescription() + "'"); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5602 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5603 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5604 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5605 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); | 
|  | 5606 | delete (yyvsp[-1].TypeVal); | 
|  | 5607 | ;} | 
|  | 5608 | break; | 
|  | 5609 |  | 
|  | 5610 | case 286: | 
|  | 5611 | #line 2898 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
|  | 5612 | { | 
| Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5613 | if (!UpRefs.empty()) | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5614 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription()); | 
|  | 5615 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) | 
| Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5616 | GEN_ERROR("getelementptr insn requires pointer operand"); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5617 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5618 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true)) | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5619 | GEN_ERROR("Invalid getelementptr indices for type '" + | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5620 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'"); | 
|  | 5621 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5622 | CHECK_FOR_ERROR | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5623 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size()); | 
|  | 5624 | delete (yyvsp[-2].TypeVal); | 
|  | 5625 | delete (yyvsp[0].ValueList); | 
|  | 5626 | ;} | 
|  | 5627 | break; | 
|  | 5628 |  | 
|  | 5629 |  | 
|  | 5630 | default: break; | 
|  | 5631 | } | 
|  | 5632 |  | 
|  | 5633 | /* Line 1126 of yacc.c.  */ | 
|  | 5634 | #line 5635 "llvmAsmParser.tab.c" | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5635 |  | 
|  | 5636 | yyvsp -= yylen; | 
|  | 5637 | yyssp -= yylen; | 
| Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 5638 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5639 |  | 
|  | 5640 | YY_STACK_PRINT (yyss, yyssp); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5641 |  | 
|  | 5642 | *++yyvsp = yyval; | 
|  | 5643 |  | 
|  | 5644 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5645 | /* Now `shift' the result of the reduction.  Determine what state | 
|  | 5646 | that goes to, based on the state we popped back to and the rule | 
|  | 5647 | number reduced by.  */ | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5648 |  | 
|  | 5649 | yyn = yyr1[yyn]; | 
|  | 5650 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5651 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | 
|  | 5652 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5653 | yystate = yytable[yystate]; | 
|  | 5654 | else | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5655 | yystate = yydefgoto[yyn - YYNTOKENS]; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5656 |  | 
|  | 5657 | goto yynewstate; | 
|  | 5658 |  | 
|  | 5659 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5660 | /*------------------------------------. | 
|  | 5661 | | yyerrlab -- here on detecting error | | 
|  | 5662 | `------------------------------------*/ | 
|  | 5663 | yyerrlab: | 
|  | 5664 | /* If not already recovering from an error, report this error.  */ | 
|  | 5665 | if (!yyerrstatus) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5666 | { | 
|  | 5667 | ++yynerrs; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5668 | #if YYERROR_VERBOSE | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5669 | yyn = yypact[yystate]; | 
|  | 5670 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5671 | if (YYPACT_NINF < yyn && yyn < YYLAST) | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5672 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5673 | int yytype = YYTRANSLATE (yychar); | 
|  | 5674 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); | 
|  | 5675 | YYSIZE_T yysize = yysize0; | 
|  | 5676 | YYSIZE_T yysize1; | 
|  | 5677 | int yysize_overflow = 0; | 
|  | 5678 | char *yymsg = 0; | 
|  | 5679 | #	  define YYERROR_VERBOSE_ARGS_MAXIMUM 5 | 
|  | 5680 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | 
|  | 5681 | int yyx; | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5682 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5683 | #if 0 | 
|  | 5684 | /* This is so xgettext sees the translatable formats that are | 
|  | 5685 | constructed on the fly.  */ | 
|  | 5686 | YY_("syntax error, unexpected %s"); | 
|  | 5687 | YY_("syntax error, unexpected %s, expecting %s"); | 
|  | 5688 | YY_("syntax error, unexpected %s, expecting %s or %s"); | 
|  | 5689 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); | 
|  | 5690 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); | 
|  | 5691 | #endif | 
|  | 5692 | char *yyfmt; | 
|  | 5693 | char const *yyf; | 
|  | 5694 | static char const yyunexpected[] = "syntax error, unexpected %s"; | 
|  | 5695 | static char const yyexpecting[] = ", expecting %s"; | 
|  | 5696 | static char const yyor[] = " or %s"; | 
|  | 5697 | char yyformat[sizeof yyunexpected | 
|  | 5698 | + sizeof yyexpecting - 1 | 
|  | 5699 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) | 
|  | 5700 | * (sizeof yyor - 1))]; | 
|  | 5701 | char const *yyprefix = yyexpecting; | 
|  | 5702 |  | 
|  | 5703 | /* Start YYX at -YYN if negative to avoid negative indexes in | 
|  | 5704 | YYCHECK.  */ | 
|  | 5705 | int yyxbegin = yyn < 0 ? -yyn : 0; | 
|  | 5706 |  | 
|  | 5707 | /* Stay within bounds of both yycheck and yytname.  */ | 
|  | 5708 | int yychecklim = YYLAST - yyn; | 
|  | 5709 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | 
|  | 5710 | int yycount = 1; | 
|  | 5711 |  | 
|  | 5712 | yyarg[0] = yytname[yytype]; | 
|  | 5713 | yyfmt = yystpcpy (yyformat, yyunexpected); | 
|  | 5714 |  | 
|  | 5715 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | 
|  | 5716 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | 
|  | 5717 | { | 
|  | 5718 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | 
|  | 5719 | { | 
|  | 5720 | yycount = 1; | 
|  | 5721 | yysize = yysize0; | 
|  | 5722 | yyformat[sizeof yyunexpected - 1] = '\0'; | 
|  | 5723 | break; | 
|  | 5724 | } | 
|  | 5725 | yyarg[yycount++] = yytname[yyx]; | 
|  | 5726 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | 
|  | 5727 | yysize_overflow |= yysize1 < yysize; | 
|  | 5728 | yysize = yysize1; | 
|  | 5729 | yyfmt = yystpcpy (yyfmt, yyprefix); | 
|  | 5730 | yyprefix = yyor; | 
|  | 5731 | } | 
|  | 5732 |  | 
|  | 5733 | yyf = YY_(yyformat); | 
|  | 5734 | yysize1 = yysize + yystrlen (yyf); | 
|  | 5735 | yysize_overflow |= yysize1 < yysize; | 
|  | 5736 | yysize = yysize1; | 
|  | 5737 |  | 
|  | 5738 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) | 
|  | 5739 | yymsg = (char *) YYSTACK_ALLOC (yysize); | 
|  | 5740 | if (yymsg) | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5741 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5742 | /* Avoid sprintf, as that infringes on the user's name space. | 
|  | 5743 | Don't have undefined behavior even if the translation | 
|  | 5744 | produced a string with the wrong number of "%s"s.  */ | 
|  | 5745 | char *yyp = yymsg; | 
|  | 5746 | int yyi = 0; | 
|  | 5747 | while ((*yyp = *yyf)) | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5748 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5749 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) | 
|  | 5750 | { | 
|  | 5751 | yyp += yytnamerr (yyp, yyarg[yyi++]); | 
|  | 5752 | yyf += 2; | 
|  | 5753 | } | 
|  | 5754 | else | 
|  | 5755 | { | 
|  | 5756 | yyp++; | 
|  | 5757 | yyf++; | 
|  | 5758 | } | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5759 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5760 | yyerror (yymsg); | 
|  | 5761 | YYSTACK_FREE (yymsg); | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5762 | } | 
|  | 5763 | else | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5764 | { | 
|  | 5765 | yyerror (YY_("syntax error")); | 
|  | 5766 | goto yyexhaustedlab; | 
|  | 5767 | } | 
| Chris Lattner | 9d2fda6 | 2007-02-13 05:53:56 +0000 | [diff] [blame] | 5768 | } | 
|  | 5769 | else | 
|  | 5770 | #endif /* YYERROR_VERBOSE */ | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5771 | yyerror (YY_("syntax error")); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5772 | } | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5773 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5774 |  | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5775 |  | 
|  | 5776 | if (yyerrstatus == 3) | 
|  | 5777 | { | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5778 | /* If just tried and failed to reuse look-ahead token after an | 
|  | 5779 | error, discard it.  */ | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5780 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5781 | if (yychar <= YYEOF) | 
|  | 5782 | { | 
|  | 5783 | /* Return failure if at end of input.  */ | 
|  | 5784 | if (yychar == YYEOF) | 
|  | 5785 | YYABORT; | 
|  | 5786 | } | 
|  | 5787 | else | 
|  | 5788 | { | 
|  | 5789 | yydestruct ("Error: discarding", yytoken, &yylval); | 
|  | 5790 | yychar = YYEMPTY; | 
|  | 5791 | } | 
|  | 5792 | } | 
|  | 5793 |  | 
|  | 5794 | /* Else will try to reuse look-ahead token after shifting the error | 
|  | 5795 | token.  */ | 
|  | 5796 | goto yyerrlab1; | 
|  | 5797 |  | 
|  | 5798 |  | 
|  | 5799 | /*---------------------------------------------------. | 
|  | 5800 | | yyerrorlab -- error raised explicitly by YYERROR.  | | 
|  | 5801 | `---------------------------------------------------*/ | 
|  | 5802 | yyerrorlab: | 
|  | 5803 |  | 
|  | 5804 | /* Pacify compilers like GCC when the user code never invokes | 
|  | 5805 | YYERROR and the label yyerrorlab therefore never appears in user | 
|  | 5806 | code.  */ | 
|  | 5807 | if (0) | 
|  | 5808 | goto yyerrorlab; | 
|  | 5809 |  | 
|  | 5810 | yyvsp -= yylen; | 
|  | 5811 | yyssp -= yylen; | 
|  | 5812 | yystate = *yyssp; | 
|  | 5813 | goto yyerrlab1; | 
|  | 5814 |  | 
|  | 5815 |  | 
|  | 5816 | /*-------------------------------------------------------------. | 
|  | 5817 | | yyerrlab1 -- common code for both syntax error and YYERROR.  | | 
|  | 5818 | `-------------------------------------------------------------*/ | 
|  | 5819 | yyerrlab1: | 
|  | 5820 | yyerrstatus = 3;	/* Each real token shifted decrements this.  */ | 
|  | 5821 |  | 
|  | 5822 | for (;;) | 
|  | 5823 | { | 
|  | 5824 | yyn = yypact[yystate]; | 
|  | 5825 | if (yyn != YYPACT_NINF) | 
|  | 5826 | { | 
|  | 5827 | yyn += YYTERROR; | 
|  | 5828 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | 
|  | 5829 | { | 
|  | 5830 | yyn = yytable[yyn]; | 
|  | 5831 | if (0 < yyn) | 
|  | 5832 | break; | 
|  | 5833 | } | 
|  | 5834 | } | 
|  | 5835 |  | 
|  | 5836 | /* Pop the current state because it cannot handle the error token.  */ | 
|  | 5837 | if (yyssp == yyss) | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5838 | YYABORT; | 
|  | 5839 |  | 
| Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5840 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5841 | yydestruct ("Error: popping", yystos[yystate], yyvsp); | 
|  | 5842 | YYPOPSTACK; | 
|  | 5843 | yystate = *yyssp; | 
|  | 5844 | YY_STACK_PRINT (yyss, yyssp); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5845 | } | 
|  | 5846 |  | 
|  | 5847 | if (yyn == YYFINAL) | 
|  | 5848 | YYACCEPT; | 
|  | 5849 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5850 | *++yyvsp = yylval; | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5851 |  | 
|  | 5852 |  | 
|  | 5853 | /* Shift the error token. */ | 
|  | 5854 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | 
| Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5855 |  | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5856 | yystate = yyn; | 
|  | 5857 | goto yynewstate; | 
|  | 5858 |  | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5859 |  | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5860 | /*-------------------------------------. | 
|  | 5861 | | yyacceptlab -- YYACCEPT comes here.  | | 
|  | 5862 | `-------------------------------------*/ | 
|  | 5863 | yyacceptlab: | 
|  | 5864 | yyresult = 0; | 
|  | 5865 | goto yyreturn; | 
|  | 5866 |  | 
|  | 5867 | /*-----------------------------------. | 
|  | 5868 | | yyabortlab -- YYABORT comes here.  | | 
|  | 5869 | `-----------------------------------*/ | 
|  | 5870 | yyabortlab: | 
|  | 5871 | yyresult = 1; | 
|  | 5872 | goto yyreturn; | 
|  | 5873 |  | 
|  | 5874 | #ifndef yyoverflow | 
|  | 5875 | /*-------------------------------------------------. | 
|  | 5876 | | yyexhaustedlab -- memory exhaustion comes here.  | | 
|  | 5877 | `-------------------------------------------------*/ | 
|  | 5878 | yyexhaustedlab: | 
|  | 5879 | yyerror (YY_("memory exhausted")); | 
|  | 5880 | yyresult = 2; | 
|  | 5881 | /* Fall through.  */ | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5882 | #endif | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5883 |  | 
|  | 5884 | yyreturn: | 
|  | 5885 | if (yychar != YYEOF && yychar != YYEMPTY) | 
|  | 5886 | yydestruct ("Cleanup: discarding lookahead", | 
|  | 5887 | yytoken, &yylval); | 
|  | 5888 | while (yyssp != yyss) | 
|  | 5889 | { | 
|  | 5890 | yydestruct ("Cleanup: popping", | 
|  | 5891 | yystos[*yyssp], yyvsp); | 
|  | 5892 | YYPOPSTACK; | 
| Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 5893 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5894 | #ifndef yyoverflow | 
|  | 5895 | if (yyss != yyssa) | 
|  | 5896 | YYSTACK_FREE (yyss); | 
|  | 5897 | #endif | 
|  | 5898 | return yyresult; | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5899 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5900 |  | 
|  | 5901 |  | 
|  | 5902 | #line 2915 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5903 |  | 
|  | 5904 |  | 
| Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5905 | // common code from the two 'RunVMAsmParser' functions | 
|  | 5906 | static Module* RunParser(Module * M) { | 
|  | 5907 |  | 
|  | 5908 | llvmAsmlineno = 1;      // Reset the current line number... | 
|  | 5909 | CurModule.CurrentModule = M; | 
|  | 5910 | #if YYDEBUG | 
|  | 5911 | yydebug = Debug; | 
|  | 5912 | #endif | 
|  | 5913 |  | 
|  | 5914 | // Check to make sure the parser succeeded | 
|  | 5915 | if (yyparse()) { | 
|  | 5916 | if (ParserResult) | 
|  | 5917 | delete ParserResult; | 
|  | 5918 | return 0; | 
|  | 5919 | } | 
|  | 5920 |  | 
|  | 5921 | // Check to make sure that parsing produced a result | 
|  | 5922 | if (!ParserResult) | 
|  | 5923 | return 0; | 
|  | 5924 |  | 
|  | 5925 | // Reset ParserResult variable while saving its value for the result. | 
|  | 5926 | Module *Result = ParserResult; | 
|  | 5927 | ParserResult = 0; | 
|  | 5928 |  | 
|  | 5929 | return Result; | 
|  | 5930 | } | 
|  | 5931 |  | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5932 | void llvm::GenerateError(const std::string &message, int LineNo) { | 
|  | 5933 | if (LineNo == -1) LineNo = llvmAsmlineno; | 
|  | 5934 | // TODO: column number in exception | 
|  | 5935 | if (TheParseError) | 
|  | 5936 | TheParseError->setError(CurFilename, message, LineNo); | 
|  | 5937 | TriggerError = 1; | 
|  | 5938 | } | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5939 |  | 
|  | 5940 | int yyerror(const char *ErrorMsg) { | 
|  | 5941 | std::string where | 
|  | 5942 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) | 
|  | 5943 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; | 
| Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5944 | std::string errMsg = where + "error: " + std::string(ErrorMsg); | 
|  | 5945 | if (yychar != YYEMPTY && yychar != 0) | 
|  | 5946 | errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ | 
|  | 5947 | "'"; | 
| Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5948 | GenerateError(errMsg); | 
| Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5949 | return 0; | 
|  | 5950 | } | 
| Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 5951 |  |