Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame^] | 1 | /* A Bison parser, made by GNU Bison 1.875c. */ |
| 2 | |
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
| 5 | |
| 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. |
| 10 | |
| 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., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, 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 | /* Skeleton name. */ |
| 40 | #define YYSKELETON_NAME "yacc.c" |
| 41 | |
| 42 | /* Pure parsers. */ |
| 43 | #define YYPURE 0 |
| 44 | |
| 45 | /* Using locations. */ |
| 46 | #define YYLSP_NEEDED 0 |
| 47 | |
| 48 | /* If NAME_PREFIX is specified substitute the variables and functions |
| 49 | names. */ |
| 50 | #define yyparse Fileparse |
| 51 | #define yylex Filelex |
| 52 | #define yyerror Fileerror |
| 53 | #define yylval Filelval |
| 54 | #define yychar Filechar |
| 55 | #define yydebug Filedebug |
| 56 | #define yynerrs Filenerrs |
| 57 | |
| 58 | |
| 59 | /* Tokens. */ |
| 60 | #ifndef YYTOKENTYPE |
| 61 | # define YYTOKENTYPE |
| 62 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 63 | know about them. */ |
| 64 | enum yytokentype { |
| 65 | INT = 258, |
| 66 | BIT = 259, |
| 67 | STRING = 260, |
| 68 | BITS = 261, |
| 69 | LIST = 262, |
| 70 | CODE = 263, |
| 71 | DAG = 264, |
| 72 | CLASS = 265, |
| 73 | DEF = 266, |
| 74 | FIELD = 267, |
| 75 | LET = 268, |
| 76 | IN = 269, |
| 77 | SHLTOK = 270, |
| 78 | SRATOK = 271, |
| 79 | SRLTOK = 272, |
| 80 | INTVAL = 273, |
| 81 | ID = 274, |
| 82 | VARNAME = 275, |
| 83 | STRVAL = 276, |
| 84 | CODEFRAGMENT = 277 |
| 85 | }; |
| 86 | #endif |
| 87 | #define INT 258 |
| 88 | #define BIT 259 |
| 89 | #define STRING 260 |
| 90 | #define BITS 261 |
| 91 | #define LIST 262 |
| 92 | #define CODE 263 |
| 93 | #define DAG 264 |
| 94 | #define CLASS 265 |
| 95 | #define DEF 266 |
| 96 | #define FIELD 267 |
| 97 | #define LET 268 |
| 98 | #define IN 269 |
| 99 | #define SHLTOK 270 |
| 100 | #define SRATOK 271 |
| 101 | #define SRLTOK 272 |
| 102 | #define INTVAL 273 |
| 103 | #define ID 274 |
| 104 | #define VARNAME 275 |
| 105 | #define STRVAL 276 |
| 106 | #define CODEFRAGMENT 277 |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | /* Copy the first part of user declarations. */ |
| 112 | #line 14 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 113 | |
| 114 | #include "Record.h" |
| 115 | #include "llvm/ADT/StringExtras.h" |
| 116 | #include <algorithm> |
| 117 | #include <cstdio> |
| 118 | #define YYERROR_VERBOSE 1 |
| 119 | |
| 120 | int yyerror(const char *ErrorMsg); |
| 121 | int yylex(); |
| 122 | |
| 123 | namespace llvm { |
| 124 | |
| 125 | extern int Filelineno; |
| 126 | static Record *CurRec = 0; |
| 127 | static bool ParsingTemplateArgs = false; |
| 128 | |
| 129 | typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy; |
| 130 | |
| 131 | struct LetRecord { |
| 132 | std::string Name; |
| 133 | std::vector<unsigned> Bits; |
| 134 | Init *Value; |
| 135 | bool HasBits; |
| 136 | LetRecord(const std::string &N, std::vector<unsigned> *B, Init *V) |
| 137 | : Name(N), Value(V), HasBits(B != 0) { |
| 138 | if (HasBits) Bits = *B; |
| 139 | } |
| 140 | }; |
| 141 | |
| 142 | static std::vector<std::vector<LetRecord> > LetStack; |
| 143 | |
| 144 | |
| 145 | extern std::ostream &err(); |
| 146 | |
| 147 | static void addValue(const RecordVal &RV) { |
| 148 | if (RecordVal *ERV = CurRec->getValue(RV.getName())) { |
| 149 | // The value already exists in the class, treat this as a set... |
| 150 | if (ERV->setValue(RV.getValue())) { |
| 151 | err() << "New definition of '" << RV.getName() << "' of type '" |
| 152 | << *RV.getType() << "' is incompatible with previous " |
| 153 | << "definition of type '" << *ERV->getType() << "'!\n"; |
| 154 | exit(1); |
| 155 | } |
| 156 | } else { |
| 157 | CurRec->addValue(RV); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | static void addSuperClass(Record *SC) { |
| 162 | if (CurRec->isSubClassOf(SC)) { |
| 163 | err() << "Already subclass of '" << SC->getName() << "'!\n"; |
| 164 | exit(1); |
| 165 | } |
| 166 | CurRec->addSuperClass(SC); |
| 167 | } |
| 168 | |
| 169 | static void setValue(const std::string &ValName, |
| 170 | std::vector<unsigned> *BitList, Init *V) { |
| 171 | if (!V) return; |
| 172 | |
| 173 | RecordVal *RV = CurRec->getValue(ValName); |
| 174 | if (RV == 0) { |
| 175 | err() << "Value '" << ValName << "' unknown!\n"; |
| 176 | exit(1); |
| 177 | } |
| 178 | |
| 179 | // Do not allow assignments like 'X = X'. This will just cause infinite loops |
| 180 | // in the resolution machinery. |
| 181 | if (!BitList) |
| 182 | if (VarInit *VI = dynamic_cast<VarInit*>(V)) |
| 183 | if (VI->getName() == ValName) |
| 184 | return; |
| 185 | |
| 186 | // If we are assigning to a subset of the bits in the value... then we must be |
| 187 | // assigning to a field of BitsRecTy, which must have a BitsInit |
| 188 | // initializer... |
| 189 | // |
| 190 | if (BitList) { |
| 191 | BitsInit *CurVal = dynamic_cast<BitsInit*>(RV->getValue()); |
| 192 | if (CurVal == 0) { |
| 193 | err() << "Value '" << ValName << "' is not a bits type!\n"; |
| 194 | exit(1); |
| 195 | } |
| 196 | |
| 197 | // Convert the incoming value to a bits type of the appropriate size... |
| 198 | Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size())); |
| 199 | if (BI == 0) { |
| 200 | V->convertInitializerTo(new BitsRecTy(BitList->size())); |
| 201 | err() << "Initializer '" << *V << "' not compatible with bit range!\n"; |
| 202 | exit(1); |
| 203 | } |
| 204 | |
| 205 | // We should have a BitsInit type now... |
| 206 | assert(dynamic_cast<BitsInit*>(BI) != 0 || &(std::cerr << *BI) == 0); |
| 207 | BitsInit *BInit = (BitsInit*)BI; |
| 208 | |
| 209 | BitsInit *NewVal = new BitsInit(CurVal->getNumBits()); |
| 210 | |
| 211 | // Loop over bits, assigning values as appropriate... |
| 212 | for (unsigned i = 0, e = BitList->size(); i != e; ++i) { |
| 213 | unsigned Bit = (*BitList)[i]; |
| 214 | if (NewVal->getBit(Bit)) { |
| 215 | err() << "Cannot set bit #" << Bit << " of value '" << ValName |
| 216 | << "' more than once!\n"; |
| 217 | exit(1); |
| 218 | } |
| 219 | NewVal->setBit(Bit, BInit->getBit(i)); |
| 220 | } |
| 221 | |
| 222 | for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i) |
| 223 | if (NewVal->getBit(i) == 0) |
| 224 | NewVal->setBit(i, CurVal->getBit(i)); |
| 225 | |
| 226 | V = NewVal; |
| 227 | } |
| 228 | |
| 229 | if (RV->setValue(V)) { |
| 230 | err() << "Value '" << ValName << "' of type '" << *RV->getType() |
| 231 | << "' is incompatible with initializer '" << *V << "'!\n"; |
| 232 | exit(1); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | // addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's |
| 237 | // template arguments. |
| 238 | static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) { |
| 239 | // Add all of the values in the subclass into the current class... |
| 240 | const std::vector<RecordVal> &Vals = SC->getValues(); |
| 241 | for (unsigned i = 0, e = Vals.size(); i != e; ++i) |
| 242 | addValue(Vals[i]); |
| 243 | |
| 244 | const std::vector<std::string> &TArgs = SC->getTemplateArgs(); |
| 245 | |
| 246 | // Ensure that an appropriate number of template arguments are specified... |
| 247 | if (TArgs.size() < TemplateArgs.size()) { |
| 248 | err() << "ERROR: More template args specified than expected!\n"; |
| 249 | exit(1); |
| 250 | } else { // This class expects template arguments... |
| 251 | // Loop over all of the template arguments, setting them to the specified |
| 252 | // value or leaving them as the default if necessary. |
| 253 | for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { |
| 254 | if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? |
| 255 | // Set it now. |
| 256 | setValue(TArgs[i], 0, TemplateArgs[i]); |
| 257 | |
| 258 | // Resolve it next. |
| 259 | CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); |
| 260 | |
| 261 | |
| 262 | // Now remove it. |
| 263 | CurRec->removeValue(TArgs[i]); |
| 264 | |
| 265 | } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { |
| 266 | err() << "ERROR: Value not specified for template argument #" |
| 267 | << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() |
| 268 | << "'!\n"; |
| 269 | exit(1); |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | // Since everything went well, we can now set the "superclass" list for the |
| 275 | // current record. |
| 276 | const std::vector<Record*> &SCs = SC->getSuperClasses(); |
| 277 | for (unsigned i = 0, e = SCs.size(); i != e; ++i) |
| 278 | addSuperClass(SCs[i]); |
| 279 | addSuperClass(SC); |
| 280 | } |
| 281 | |
| 282 | } // End llvm namespace |
| 283 | |
| 284 | using namespace llvm; |
| 285 | |
| 286 | |
| 287 | |
| 288 | /* Enabling traces. */ |
| 289 | #ifndef YYDEBUG |
| 290 | # define YYDEBUG 0 |
| 291 | #endif |
| 292 | |
| 293 | /* Enabling verbose error messages. */ |
| 294 | #ifdef YYERROR_VERBOSE |
| 295 | # undef YYERROR_VERBOSE |
| 296 | # define YYERROR_VERBOSE 1 |
| 297 | #else |
| 298 | # define YYERROR_VERBOSE 0 |
| 299 | #endif |
| 300 | |
| 301 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
| 302 | #line 189 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 303 | typedef union YYSTYPE { |
| 304 | std::string* StrVal; |
| 305 | int IntVal; |
| 306 | llvm::RecTy* Ty; |
| 307 | llvm::Init* Initializer; |
| 308 | std::vector<llvm::Init*>* FieldList; |
| 309 | std::vector<unsigned>* BitList; |
| 310 | llvm::Record* Rec; |
| 311 | SubClassRefTy* SubClassRef; |
| 312 | std::vector<SubClassRefTy>* SubClassList; |
| 313 | std::vector<std::pair<llvm::Init*, std::string> >* DagValueList; |
| 314 | } YYSTYPE; |
| 315 | /* Line 191 of yacc.c. */ |
| 316 | #line 317 "FileParser.tab.c" |
| 317 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 318 | # define YYSTYPE_IS_DECLARED 1 |
| 319 | # define YYSTYPE_IS_TRIVIAL 1 |
| 320 | #endif |
| 321 | |
| 322 | |
| 323 | |
| 324 | /* Copy the second part of user declarations. */ |
| 325 | |
| 326 | |
| 327 | /* Line 214 of yacc.c. */ |
| 328 | #line 329 "FileParser.tab.c" |
| 329 | |
| 330 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 331 | |
| 332 | # ifndef YYFREE |
| 333 | # define YYFREE free |
| 334 | # endif |
| 335 | # ifndef YYMALLOC |
| 336 | # define YYMALLOC malloc |
| 337 | # endif |
| 338 | |
| 339 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 340 | |
| 341 | # ifdef YYSTACK_USE_ALLOCA |
| 342 | # if YYSTACK_USE_ALLOCA |
| 343 | # define YYSTACK_ALLOC alloca |
| 344 | # endif |
| 345 | # else |
| 346 | # if defined (alloca) || defined (_ALLOCA_H) |
| 347 | # define YYSTACK_ALLOC alloca |
| 348 | # else |
| 349 | # ifdef __GNUC__ |
| 350 | # define YYSTACK_ALLOC __builtin_alloca |
| 351 | # endif |
| 352 | # endif |
| 353 | # endif |
| 354 | |
| 355 | # ifdef YYSTACK_ALLOC |
| 356 | /* Pacify GCC's `empty if-body' warning. */ |
| 357 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 358 | # else |
| 359 | # if defined (__STDC__) || defined (__cplusplus) |
| 360 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 361 | # define YYSIZE_T size_t |
| 362 | # endif |
| 363 | # define YYSTACK_ALLOC YYMALLOC |
| 364 | # define YYSTACK_FREE YYFREE |
| 365 | # endif |
| 366 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 367 | |
| 368 | |
| 369 | #if (! defined (yyoverflow) \ |
| 370 | && (! defined (__cplusplus) \ |
| 371 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 372 | |
| 373 | /* A type that is properly aligned for any stack member. */ |
| 374 | union yyalloc |
| 375 | { |
| 376 | short yyss; |
| 377 | YYSTYPE yyvs; |
| 378 | }; |
| 379 | |
| 380 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 381 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 382 | |
| 383 | /* The size of an array large to enough to hold all stacks, each with |
| 384 | N elements. */ |
| 385 | # define YYSTACK_BYTES(N) \ |
| 386 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ |
| 387 | + YYSTACK_GAP_MAXIMUM) |
| 388 | |
| 389 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 390 | not overlap. */ |
| 391 | # ifndef YYCOPY |
| 392 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 393 | # define YYCOPY(To, From, Count) \ |
| 394 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 395 | # else |
| 396 | # define YYCOPY(To, From, Count) \ |
| 397 | do \ |
| 398 | { \ |
| 399 | register YYSIZE_T yyi; \ |
| 400 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 401 | (To)[yyi] = (From)[yyi]; \ |
| 402 | } \ |
| 403 | while (0) |
| 404 | # endif |
| 405 | # endif |
| 406 | |
| 407 | /* Relocate STACK from its old location to the new one. The |
| 408 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 409 | elements in the stack, and YYPTR gives the new location of the |
| 410 | stack. Advance YYPTR to a properly aligned location for the next |
| 411 | stack. */ |
| 412 | # define YYSTACK_RELOCATE(Stack) \ |
| 413 | do \ |
| 414 | { \ |
| 415 | YYSIZE_T yynewbytes; \ |
| 416 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 417 | Stack = &yyptr->Stack; \ |
| 418 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 419 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 420 | } \ |
| 421 | while (0) |
| 422 | |
| 423 | #endif |
| 424 | |
| 425 | #if defined (__STDC__) || defined (__cplusplus) |
| 426 | typedef signed char yysigned_char; |
| 427 | #else |
| 428 | typedef short yysigned_char; |
| 429 | #endif |
| 430 | |
| 431 | /* YYFINAL -- State number of the termination state. */ |
| 432 | #define YYFINAL 18 |
| 433 | /* YYLAST -- Last index in YYTABLE. */ |
| 434 | #define YYLAST 149 |
| 435 | |
| 436 | /* YYNTOKENS -- Number of terminals. */ |
| 437 | #define YYNTOKENS 38 |
| 438 | /* YYNNTS -- Number of nonterminals. */ |
| 439 | #define YYNNTS 37 |
| 440 | /* YYNRULES -- Number of rules. */ |
| 441 | #define YYNRULES 84 |
| 442 | /* YYNRULES -- Number of states. */ |
| 443 | #define YYNSTATES 152 |
| 444 | |
| 445 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 446 | #define YYUNDEFTOK 2 |
| 447 | #define YYMAXUTOK 277 |
| 448 | |
| 449 | #define YYTRANSLATE(YYX) \ |
| 450 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 451 | |
| 452 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 453 | static const unsigned char yytranslate[] = |
| 454 | { |
| 455 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 456 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 457 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 458 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 459 | 32, 33, 2, 2, 34, 36, 31, 2, 2, 2, |
| 460 | 2, 2, 2, 2, 2, 2, 2, 2, 35, 37, |
| 461 | 23, 25, 24, 26, 2, 2, 2, 2, 2, 2, |
| 462 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 464 | 2, 29, 2, 30, 2, 2, 2, 2, 2, 2, |
| 465 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 466 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 467 | 2, 2, 2, 27, 2, 28, 2, 2, 2, 2, |
| 468 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 469 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 470 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 471 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 475 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 478 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 479 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 480 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 481 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 482 | 15, 16, 17, 18, 19, 20, 21, 22 |
| 483 | }; |
| 484 | |
| 485 | #if YYDEBUG |
| 486 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 487 | YYRHS. */ |
| 488 | static const unsigned char yyprhs[] = |
| 489 | { |
| 490 | 0, 0, 3, 5, 7, 9, 14, 16, 21, 23, |
| 491 | 25, 27, 28, 30, 31, 34, 36, 38, 40, 42, |
| 492 | 46, 48, 53, 57, 61, 66, 71, 78, 85, 92, |
| 493 | 93, 96, 99, 104, 105, 107, 109, 113, 116, 120, |
| 494 | 126, 131, 133, 134, 138, 139, 141, 143, 147, 152, |
| 495 | 155, 162, 163, 166, 168, 172, 174, 179, 181, 185, |
| 496 | 186, 189, 191, 195, 199, 200, 202, 204, 205, 206, |
| 497 | 207, 214, 217, 220, 222, 224, 229, 231, 235, 236, |
| 498 | 241, 246, 249, 251, 254 |
| 499 | }; |
| 500 | |
| 501 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 502 | static const yysigned_char yyrhs[] = |
| 503 | { |
| 504 | 74, 0, -1, 19, -1, 5, -1, 4, -1, 6, |
| 505 | 23, 18, 24, -1, 3, -1, 7, 23, 40, 24, |
| 506 | -1, 8, -1, 9, -1, 39, -1, -1, 12, -1, |
| 507 | -1, 25, 43, -1, 18, -1, 21, -1, 22, -1, |
| 508 | 26, -1, 27, 50, 28, -1, 19, -1, 43, 27, |
| 509 | 48, 28, -1, 29, 50, 30, -1, 43, 31, 19, |
| 510 | -1, 32, 19, 46, 33, -1, 43, 29, 48, 30, |
| 511 | -1, 15, 32, 43, 34, 43, 33, -1, 16, 32, |
| 512 | 43, 34, 43, 33, -1, 17, 32, 43, 34, 43, |
| 513 | 33, -1, -1, 35, 20, -1, 43, 44, -1, 45, |
| 514 | 34, 43, 44, -1, -1, 45, -1, 18, -1, 18, |
| 515 | 36, 18, -1, 18, 18, -1, 47, 34, 18, -1, |
| 516 | 47, 34, 18, 36, 18, -1, 47, 34, 18, 18, |
| 517 | -1, 47, -1, -1, 27, 48, 28, -1, -1, 51, |
| 518 | -1, 43, -1, 51, 34, 43, -1, 41, 40, 19, |
| 519 | 42, -1, 52, 37, -1, 13, 19, 49, 25, 43, |
| 520 | 37, -1, -1, 54, 53, -1, 37, -1, 27, 54, |
| 521 | 28, -1, 39, -1, 39, 23, 51, 24, -1, 56, |
| 522 | -1, 57, 34, 56, -1, -1, 35, 57, -1, 52, |
| 523 | -1, 59, 34, 52, -1, 23, 59, 24, -1, -1, |
| 524 | 60, -1, 19, -1, -1, -1, -1, 62, 64, 61, |
| 525 | 58, 65, 55, -1, 10, 63, -1, 11, 63, -1, |
| 526 | 66, -1, 67, -1, 19, 49, 25, 43, -1, 69, |
| 527 | -1, 70, 34, 69, -1, -1, 13, 72, 70, 14, |
| 528 | -1, 71, 27, 73, 28, -1, 71, 68, -1, 68, |
| 529 | -1, 73, 68, -1, 73, -1 |
| 530 | }; |
| 531 | |
| 532 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 533 | static const unsigned short yyrline[] = |
| 534 | { |
| 535 | 0, 223, 223, 234, 236, 238, 240, 242, 244, 246, |
| 536 | 248, 252, 252, 254, 254, 256, 258, 261, 264, 266, |
| 537 | 279, 294, 301, 304, 311, 319, 327, 333, 339, 347, |
| 538 | 350, 354, 359, 365, 368, 371, 374, 387, 401, 403, |
| 539 | 416, 432, 434, 434, 438, 440, 444, 447, 451, 461, |
| 540 | 463, 469, 469, 470, 470, 472, 474, 478, 483, 488, |
| 541 | 491, 495, 498, 503, 504, 504, 506, 506, 508, 515, |
| 542 | 508, 535, 543, 560, 560, 562, 567, 567, 570, 570, |
| 543 | 573, 576, 580, 580, 582 |
| 544 | }; |
| 545 | #endif |
| 546 | |
| 547 | #if YYDEBUG || YYERROR_VERBOSE |
| 548 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 549 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 550 | static const char *const yytname[] = |
| 551 | { |
| 552 | "$end", "error", "$undefined", "INT", "BIT", "STRING", "BITS", "LIST", |
| 553 | "CODE", "DAG", "CLASS", "DEF", "FIELD", "LET", "IN", "SHLTOK", "SRATOK", |
| 554 | "SRLTOK", "INTVAL", "ID", "VARNAME", "STRVAL", "CODEFRAGMENT", "'<'", |
| 555 | "'>'", "'='", "'?'", "'{'", "'}'", "'['", "']'", "'.'", "'('", "')'", |
| 556 | "','", "':'", "'-'", "';'", "$accept", "ClassID", "Type", "OptPrefix", |
| 557 | "OptValue", "Value", "OptVarName", "DagArgListNE", "DagArgList", |
| 558 | "RBitList", "BitList", "OptBitList", "ValueList", "ValueListNE", |
| 559 | "Declaration", "BodyItem", "BodyList", "Body", "SubClassRef", |
| 560 | "ClassListNE", "ClassList", "DeclListNE", "TemplateArgList", |
| 561 | "OptTemplateArgList", "OptID", "ObjectBody", "@1", "@2", "ClassInst", |
| 562 | "DefInst", "Object", "LETItem", "LETList", "LETCommand", "@3", |
| 563 | "ObjectList", "File", 0 |
| 564 | }; |
| 565 | #endif |
| 566 | |
| 567 | # ifdef YYPRINT |
| 568 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 569 | token YYLEX-NUM. */ |
| 570 | static const unsigned short yytoknum[] = |
| 571 | { |
| 572 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 573 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 574 | 275, 276, 277, 60, 62, 61, 63, 123, 125, 91, |
| 575 | 93, 46, 40, 41, 44, 58, 45, 59 |
| 576 | }; |
| 577 | # endif |
| 578 | |
| 579 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 580 | static const unsigned char yyr1[] = |
| 581 | { |
| 582 | 0, 38, 39, 40, 40, 40, 40, 40, 40, 40, |
| 583 | 40, 41, 41, 42, 42, 43, 43, 43, 43, 43, |
| 584 | 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, |
| 585 | 44, 45, 45, 46, 46, 47, 47, 47, 47, 47, |
| 586 | 47, 48, 49, 49, 50, 50, 51, 51, 52, 53, |
| 587 | 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, |
| 588 | 58, 59, 59, 60, 61, 61, 62, 62, 64, 65, |
| 589 | 63, 66, 67, 68, 68, 69, 70, 70, 72, 71, |
| 590 | 68, 68, 73, 73, 74 |
| 591 | }; |
| 592 | |
| 593 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 594 | static const unsigned char yyr2[] = |
| 595 | { |
| 596 | 0, 2, 1, 1, 1, 4, 1, 4, 1, 1, |
| 597 | 1, 0, 1, 0, 2, 1, 1, 1, 1, 3, |
| 598 | 1, 4, 3, 3, 4, 4, 6, 6, 6, 0, |
| 599 | 2, 2, 4, 0, 1, 1, 3, 2, 3, 5, |
| 600 | 4, 1, 0, 3, 0, 1, 1, 3, 4, 2, |
| 601 | 6, 0, 2, 1, 3, 1, 4, 1, 3, 0, |
| 602 | 2, 1, 3, 3, 0, 1, 1, 0, 0, 0, |
| 603 | 6, 2, 2, 1, 1, 4, 1, 3, 0, 4, |
| 604 | 4, 2, 1, 2, 1 |
| 605 | }; |
| 606 | |
| 607 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 608 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 609 | means the default is an error. */ |
| 610 | static const unsigned char yydefact[] = |
| 611 | { |
| 612 | 0, 67, 67, 78, 73, 74, 82, 0, 84, 0, |
| 613 | 66, 68, 71, 72, 0, 0, 81, 83, 1, 64, |
| 614 | 42, 76, 0, 0, 11, 65, 59, 0, 0, 79, |
| 615 | 0, 80, 12, 0, 61, 0, 0, 69, 35, 41, |
| 616 | 0, 0, 77, 6, 4, 3, 0, 0, 8, 9, |
| 617 | 2, 10, 0, 63, 11, 55, 57, 60, 0, 37, |
| 618 | 0, 0, 43, 0, 0, 0, 15, 20, 16, 17, |
| 619 | 18, 44, 44, 0, 75, 0, 0, 13, 62, 0, |
| 620 | 0, 51, 53, 70, 36, 38, 0, 0, 0, 46, |
| 621 | 0, 45, 0, 33, 0, 0, 0, 0, 0, 0, |
| 622 | 48, 0, 58, 11, 40, 0, 0, 0, 0, 19, |
| 623 | 0, 22, 29, 34, 0, 0, 0, 23, 5, 7, |
| 624 | 14, 56, 0, 54, 0, 52, 39, 0, 0, 0, |
| 625 | 47, 0, 31, 0, 24, 21, 25, 42, 49, 0, |
| 626 | 0, 0, 30, 29, 0, 26, 27, 28, 32, 0, |
| 627 | 0, 50 |
| 628 | }; |
| 629 | |
| 630 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 631 | static const short yydefgoto[] = |
| 632 | { |
| 633 | -1, 51, 52, 33, 100, 89, 132, 113, 114, 39, |
| 634 | 40, 28, 90, 91, 34, 125, 103, 83, 56, 57, |
| 635 | 37, 35, 25, 26, 11, 12, 19, 58, 4, 5, |
| 636 | 6, 21, 22, 7, 14, 8, 9 |
| 637 | }; |
| 638 | |
| 639 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 640 | STATE-NUM. */ |
| 641 | #define YYPACT_NINF -54 |
| 642 | static const yysigned_char yypact[] = |
| 643 | { |
| 644 | 61, -7, -7, -54, -54, -54, -54, 4, 61, 24, |
| 645 | -54, -54, -54, -54, 23, 61, -54, -54, -54, 18, |
| 646 | 29, -54, -12, -5, 55, -54, 38, 65, 69, -54, |
| 647 | 23, -54, -54, 56, -54, -14, 71, -54, -15, 64, |
| 648 | 72, 11, -54, -54, -54, -54, 81, 83, -54, -54, |
| 649 | -54, -54, 91, -54, 55, 89, -54, 80, 12, -54, |
| 650 | 100, 101, -54, 88, 90, 92, -54, -54, -54, -54, |
| 651 | -54, 11, 11, 102, 26, 105, 56, 103, -54, 11, |
| 652 | 71, -54, -54, -54, -54, -11, 11, 11, 11, 26, |
| 653 | 97, 93, 96, 11, 65, 65, 110, 106, 107, 11, |
| 654 | -54, 20, -54, 6, -54, 114, -18, 62, 68, -54, |
| 655 | 11, -54, 50, 99, 104, 108, 109, -54, -54, -54, |
| 656 | 26, -54, 115, -54, 98, -54, -54, 11, 11, 11, |
| 657 | 26, 118, -54, 11, -54, -54, -54, 29, -54, 51, |
| 658 | 74, 82, -54, 50, 116, -54, -54, -54, -54, 11, |
| 659 | 39, -54 |
| 660 | }; |
| 661 | |
| 662 | /* YYPGOTO[NTERM-NUM]. */ |
| 663 | static const short yypgoto[] = |
| 664 | { |
| 665 | -54, -32, 66, -54, -54, -41, -3, -54, -54, -54, |
| 666 | 22, 7, 73, 67, -53, -54, -54, -54, 63, -54, |
| 667 | -54, -54, -54, -54, -54, 145, -54, -54, -54, -54, |
| 668 | 28, 119, -54, -54, -54, 133, -54 |
| 669 | }; |
| 670 | |
| 671 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 672 | positive, shift that token. If negative, reduce the rule which |
| 673 | number is the opposite. If zero, do what YYDEFACT says. |
| 674 | If YYTABLE_NINF, syntax error. */ |
| 675 | #define YYTABLE_NINF -1 |
| 676 | static const unsigned char yytable[] = |
| 677 | { |
| 678 | 74, 78, 29, 59, 55, 1, 2, 104, 3, 94, |
| 679 | 53, 95, 10, 96, 1, 2, 127, 3, 32, 122, |
| 680 | 54, 60, 30, 31, 18, 105, 63, 64, 65, 66, |
| 681 | 67, 15, 68, 69, 123, 16, 17, 70, 71, 81, |
| 682 | 72, 24, 20, 73, 121, 106, 107, 108, 55, 82, |
| 683 | 124, 17, 112, 94, 110, 95, 27, 96, 120, 43, |
| 684 | 44, 45, 46, 47, 48, 49, 94, 32, 95, 130, |
| 685 | 96, 1, 2, 36, 3, 50, 151, 94, 94, 95, |
| 686 | 95, 96, 96, 38, 145, 131, 139, 140, 141, 94, |
| 687 | 50, 95, 143, 96, 41, 94, 128, 95, 61, 96, |
| 688 | 62, 94, 129, 95, 75, 96, 76, 146, 150, 94, |
| 689 | 77, 95, 79, 96, 80, 147, 115, 116, 84, 85, |
| 690 | 86, 93, 87, 97, 88, 109, 111, 110, 99, 117, |
| 691 | 118, 119, 126, 133, 137, 138, 135, 134, 142, 136, |
| 692 | 148, 149, 98, 102, 144, 92, 101, 13, 23, 42 |
| 693 | }; |
| 694 | |
| 695 | static const unsigned char yycheck[] = |
| 696 | { |
| 697 | 41, 54, 14, 18, 36, 10, 11, 18, 13, 27, |
| 698 | 24, 29, 19, 31, 10, 11, 34, 13, 12, 13, |
| 699 | 34, 36, 34, 28, 0, 36, 15, 16, 17, 18, |
| 700 | 19, 27, 21, 22, 28, 7, 8, 26, 27, 27, |
| 701 | 29, 23, 19, 32, 24, 86, 87, 88, 80, 37, |
| 702 | 103, 23, 93, 27, 34, 29, 27, 31, 99, 3, |
| 703 | 4, 5, 6, 7, 8, 9, 27, 12, 29, 110, |
| 704 | 31, 10, 11, 35, 13, 19, 37, 27, 27, 29, |
| 705 | 29, 31, 31, 18, 33, 35, 127, 128, 129, 27, |
| 706 | 19, 29, 133, 31, 25, 27, 34, 29, 34, 31, |
| 707 | 28, 27, 34, 29, 23, 31, 23, 33, 149, 27, |
| 708 | 19, 29, 23, 31, 34, 33, 94, 95, 18, 18, |
| 709 | 32, 19, 32, 18, 32, 28, 30, 34, 25, 19, |
| 710 | 24, 24, 18, 34, 19, 37, 28, 33, 20, 30, |
| 711 | 143, 25, 76, 80, 137, 72, 79, 2, 15, 30 |
| 712 | }; |
| 713 | |
| 714 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 715 | symbol of state STATE-NUM. */ |
| 716 | static const unsigned char yystos[] = |
| 717 | { |
| 718 | 0, 10, 11, 13, 66, 67, 68, 71, 73, 74, |
| 719 | 19, 62, 63, 63, 72, 27, 68, 68, 0, 64, |
| 720 | 19, 69, 70, 73, 23, 60, 61, 27, 49, 14, |
| 721 | 34, 28, 12, 41, 52, 59, 35, 58, 18, 47, |
| 722 | 48, 25, 69, 3, 4, 5, 6, 7, 8, 9, |
| 723 | 19, 39, 40, 24, 34, 39, 56, 57, 65, 18, |
| 724 | 36, 34, 28, 15, 16, 17, 18, 19, 21, 22, |
| 725 | 26, 27, 29, 32, 43, 23, 23, 19, 52, 23, |
| 726 | 34, 27, 37, 55, 18, 18, 32, 32, 32, 43, |
| 727 | 50, 51, 50, 19, 27, 29, 31, 18, 40, 25, |
| 728 | 42, 51, 56, 54, 18, 36, 43, 43, 43, 28, |
| 729 | 34, 30, 43, 45, 46, 48, 48, 19, 24, 24, |
| 730 | 43, 24, 13, 28, 52, 53, 18, 34, 34, 34, |
| 731 | 43, 35, 44, 34, 33, 28, 30, 19, 37, 43, |
| 732 | 43, 43, 20, 43, 49, 33, 33, 33, 44, 25, |
| 733 | 43, 37 |
| 734 | }; |
| 735 | |
| 736 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 737 | # define YYSIZE_T __SIZE_TYPE__ |
| 738 | #endif |
| 739 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 740 | # define YYSIZE_T size_t |
| 741 | #endif |
| 742 | #if ! defined (YYSIZE_T) |
| 743 | # if defined (__STDC__) || defined (__cplusplus) |
| 744 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 745 | # define YYSIZE_T size_t |
| 746 | # endif |
| 747 | #endif |
| 748 | #if ! defined (YYSIZE_T) |
| 749 | # define YYSIZE_T unsigned int |
| 750 | #endif |
| 751 | |
| 752 | #define yyerrok (yyerrstatus = 0) |
| 753 | #define yyclearin (yychar = YYEMPTY) |
| 754 | #define YYEMPTY (-2) |
| 755 | #define YYEOF 0 |
| 756 | |
| 757 | #define YYACCEPT goto yyacceptlab |
| 758 | #define YYABORT goto yyabortlab |
| 759 | #define YYERROR goto yyerrorlab |
| 760 | |
| 761 | |
| 762 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 763 | to ease the transition to the new meaning of YYERROR, for GCC. |
| 764 | Once GCC version 2 has supplanted version 1, this can go. */ |
| 765 | |
| 766 | #define YYFAIL goto yyerrlab |
| 767 | |
| 768 | #define YYRECOVERING() (!!yyerrstatus) |
| 769 | |
| 770 | #define YYBACKUP(Token, Value) \ |
| 771 | do \ |
| 772 | if (yychar == YYEMPTY && yylen == 1) \ |
| 773 | { \ |
| 774 | yychar = (Token); \ |
| 775 | yylval = (Value); \ |
| 776 | yytoken = YYTRANSLATE (yychar); \ |
| 777 | YYPOPSTACK; \ |
| 778 | goto yybackup; \ |
| 779 | } \ |
| 780 | else \ |
| 781 | { \ |
| 782 | yyerror ("syntax error: cannot back up");\ |
| 783 | YYERROR; \ |
| 784 | } \ |
| 785 | while (0) |
| 786 | |
| 787 | #define YYTERROR 1 |
| 788 | #define YYERRCODE 256 |
| 789 | |
| 790 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
| 791 | are run). */ |
| 792 | |
| 793 | #ifndef YYLLOC_DEFAULT |
| 794 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 795 | ((Current).first_line = (Rhs)[1].first_line, \ |
| 796 | (Current).first_column = (Rhs)[1].first_column, \ |
| 797 | (Current).last_line = (Rhs)[N].last_line, \ |
| 798 | (Current).last_column = (Rhs)[N].last_column) |
| 799 | #endif |
| 800 | |
| 801 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 802 | |
| 803 | #ifdef YYLEX_PARAM |
| 804 | # define YYLEX yylex (YYLEX_PARAM) |
| 805 | #else |
| 806 | # define YYLEX yylex () |
| 807 | #endif |
| 808 | |
| 809 | /* Enable debugging if requested. */ |
| 810 | #if YYDEBUG |
| 811 | |
| 812 | # ifndef YYFPRINTF |
| 813 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 814 | # define YYFPRINTF fprintf |
| 815 | # endif |
| 816 | |
| 817 | # define YYDPRINTF(Args) \ |
| 818 | do { \ |
| 819 | if (yydebug) \ |
| 820 | YYFPRINTF Args; \ |
| 821 | } while (0) |
| 822 | |
| 823 | # define YYDSYMPRINT(Args) \ |
| 824 | do { \ |
| 825 | if (yydebug) \ |
| 826 | yysymprint Args; \ |
| 827 | } while (0) |
| 828 | |
| 829 | # define YYDSYMPRINTF(Title, Token, Value, Location) \ |
| 830 | do { \ |
| 831 | if (yydebug) \ |
| 832 | { \ |
| 833 | YYFPRINTF (stderr, "%s ", Title); \ |
| 834 | yysymprint (stderr, \ |
| 835 | Token, Value); \ |
| 836 | YYFPRINTF (stderr, "\n"); \ |
| 837 | } \ |
| 838 | } while (0) |
| 839 | |
| 840 | /*------------------------------------------------------------------. |
| 841 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 842 | | TOP (included). | |
| 843 | `------------------------------------------------------------------*/ |
| 844 | |
| 845 | #if defined (__STDC__) || defined (__cplusplus) |
| 846 | static void |
| 847 | yy_stack_print (short *bottom, short *top) |
| 848 | #else |
| 849 | static void |
| 850 | yy_stack_print (bottom, top) |
| 851 | short *bottom; |
| 852 | short *top; |
| 853 | #endif |
| 854 | { |
| 855 | YYFPRINTF (stderr, "Stack now"); |
| 856 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 857 | YYFPRINTF (stderr, " %d", *bottom); |
| 858 | YYFPRINTF (stderr, "\n"); |
| 859 | } |
| 860 | |
| 861 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 862 | do { \ |
| 863 | if (yydebug) \ |
| 864 | yy_stack_print ((Bottom), (Top)); \ |
| 865 | } while (0) |
| 866 | |
| 867 | |
| 868 | /*------------------------------------------------. |
| 869 | | Report that the YYRULE is going to be reduced. | |
| 870 | `------------------------------------------------*/ |
| 871 | |
| 872 | #if defined (__STDC__) || defined (__cplusplus) |
| 873 | static void |
| 874 | yy_reduce_print (int yyrule) |
| 875 | #else |
| 876 | static void |
| 877 | yy_reduce_print (yyrule) |
| 878 | int yyrule; |
| 879 | #endif |
| 880 | { |
| 881 | int yyi; |
| 882 | unsigned int yylno = yyrline[yyrule]; |
| 883 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", |
| 884 | yyrule - 1, yylno); |
| 885 | /* Print the symbols being reduced, and their result. */ |
| 886 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 887 | YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); |
| 888 | YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); |
| 889 | } |
| 890 | |
| 891 | # define YY_REDUCE_PRINT(Rule) \ |
| 892 | do { \ |
| 893 | if (yydebug) \ |
| 894 | yy_reduce_print (Rule); \ |
| 895 | } while (0) |
| 896 | |
| 897 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 898 | multiple parsers can coexist. */ |
| 899 | int yydebug; |
| 900 | #else /* !YYDEBUG */ |
| 901 | # define YYDPRINTF(Args) |
| 902 | # define YYDSYMPRINT(Args) |
| 903 | # define YYDSYMPRINTF(Title, Token, Value, Location) |
| 904 | # define YY_STACK_PRINT(Bottom, Top) |
| 905 | # define YY_REDUCE_PRINT(Rule) |
| 906 | #endif /* !YYDEBUG */ |
| 907 | |
| 908 | |
| 909 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 910 | #ifndef YYINITDEPTH |
| 911 | # define YYINITDEPTH 200 |
| 912 | #endif |
| 913 | |
| 914 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 915 | if the built-in stack extension method is used). |
| 916 | |
| 917 | Do not make this value too large; the results are undefined if |
| 918 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
| 919 | evaluated with infinite-precision integer arithmetic. */ |
| 920 | |
| 921 | #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 |
| 922 | # undef YYMAXDEPTH |
| 923 | #endif |
| 924 | |
| 925 | #ifndef YYMAXDEPTH |
| 926 | # define YYMAXDEPTH 10000 |
| 927 | #endif |
| 928 | |
| 929 | |
| 930 | |
| 931 | #if YYERROR_VERBOSE |
| 932 | |
| 933 | # ifndef yystrlen |
| 934 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 935 | # define yystrlen strlen |
| 936 | # else |
| 937 | /* Return the length of YYSTR. */ |
| 938 | static YYSIZE_T |
| 939 | # if defined (__STDC__) || defined (__cplusplus) |
| 940 | yystrlen (const char *yystr) |
| 941 | # else |
| 942 | yystrlen (yystr) |
| 943 | const char *yystr; |
| 944 | # endif |
| 945 | { |
| 946 | register const char *yys = yystr; |
| 947 | |
| 948 | while (*yys++ != '\0') |
| 949 | continue; |
| 950 | |
| 951 | return yys - yystr - 1; |
| 952 | } |
| 953 | # endif |
| 954 | # endif |
| 955 | |
| 956 | # ifndef yystpcpy |
| 957 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 958 | # define yystpcpy stpcpy |
| 959 | # else |
| 960 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 961 | YYDEST. */ |
| 962 | static char * |
| 963 | # if defined (__STDC__) || defined (__cplusplus) |
| 964 | yystpcpy (char *yydest, const char *yysrc) |
| 965 | # else |
| 966 | yystpcpy (yydest, yysrc) |
| 967 | char *yydest; |
| 968 | const char *yysrc; |
| 969 | # endif |
| 970 | { |
| 971 | register char *yyd = yydest; |
| 972 | register const char *yys = yysrc; |
| 973 | |
| 974 | while ((*yyd++ = *yys++) != '\0') |
| 975 | continue; |
| 976 | |
| 977 | return yyd - 1; |
| 978 | } |
| 979 | # endif |
| 980 | # endif |
| 981 | |
| 982 | #endif /* !YYERROR_VERBOSE */ |
| 983 | |
| 984 | |
| 985 | |
| 986 | #if YYDEBUG |
| 987 | /*--------------------------------. |
| 988 | | Print this symbol on YYOUTPUT. | |
| 989 | `--------------------------------*/ |
| 990 | |
| 991 | #if defined (__STDC__) || defined (__cplusplus) |
| 992 | static void |
| 993 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
| 994 | #else |
| 995 | static void |
| 996 | yysymprint (yyoutput, yytype, yyvaluep) |
| 997 | FILE *yyoutput; |
| 998 | int yytype; |
| 999 | YYSTYPE *yyvaluep; |
| 1000 | #endif |
| 1001 | { |
| 1002 | /* Pacify ``unused variable'' warnings. */ |
| 1003 | (void) yyvaluep; |
| 1004 | |
| 1005 | if (yytype < YYNTOKENS) |
| 1006 | { |
| 1007 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 1008 | # ifdef YYPRINT |
| 1009 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 1010 | # endif |
| 1011 | } |
| 1012 | else |
| 1013 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 1014 | |
| 1015 | switch (yytype) |
| 1016 | { |
| 1017 | default: |
| 1018 | break; |
| 1019 | } |
| 1020 | YYFPRINTF (yyoutput, ")"); |
| 1021 | } |
| 1022 | |
| 1023 | #endif /* ! YYDEBUG */ |
| 1024 | /*-----------------------------------------------. |
| 1025 | | Release the memory associated to this symbol. | |
| 1026 | `-----------------------------------------------*/ |
| 1027 | |
| 1028 | #if defined (__STDC__) || defined (__cplusplus) |
| 1029 | static void |
| 1030 | yydestruct (int yytype, YYSTYPE *yyvaluep) |
| 1031 | #else |
| 1032 | static void |
| 1033 | yydestruct (yytype, yyvaluep) |
| 1034 | int yytype; |
| 1035 | YYSTYPE *yyvaluep; |
| 1036 | #endif |
| 1037 | { |
| 1038 | /* Pacify ``unused variable'' warnings. */ |
| 1039 | (void) yyvaluep; |
| 1040 | |
| 1041 | switch (yytype) |
| 1042 | { |
| 1043 | |
| 1044 | default: |
| 1045 | break; |
| 1046 | } |
| 1047 | } |
| 1048 | |
| 1049 | |
| 1050 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 1051 | |
| 1052 | #ifdef YYPARSE_PARAM |
| 1053 | # if defined (__STDC__) || defined (__cplusplus) |
| 1054 | int yyparse (void *YYPARSE_PARAM); |
| 1055 | # else |
| 1056 | int yyparse (); |
| 1057 | # endif |
| 1058 | #else /* ! YYPARSE_PARAM */ |
| 1059 | #if defined (__STDC__) || defined (__cplusplus) |
| 1060 | int yyparse (void); |
| 1061 | #else |
| 1062 | int yyparse (); |
| 1063 | #endif |
| 1064 | #endif /* ! YYPARSE_PARAM */ |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | /* The lookahead symbol. */ |
| 1069 | int yychar; |
| 1070 | |
| 1071 | /* The semantic value of the lookahead symbol. */ |
| 1072 | YYSTYPE yylval; |
| 1073 | |
| 1074 | /* Number of syntax errors so far. */ |
| 1075 | int yynerrs; |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | /*----------. |
| 1080 | | yyparse. | |
| 1081 | `----------*/ |
| 1082 | |
| 1083 | #ifdef YYPARSE_PARAM |
| 1084 | # if defined (__STDC__) || defined (__cplusplus) |
| 1085 | int yyparse (void *YYPARSE_PARAM) |
| 1086 | # else |
| 1087 | int yyparse (YYPARSE_PARAM) |
| 1088 | void *YYPARSE_PARAM; |
| 1089 | # endif |
| 1090 | #else /* ! YYPARSE_PARAM */ |
| 1091 | #if defined (__STDC__) || defined (__cplusplus) |
| 1092 | int |
| 1093 | yyparse (void) |
| 1094 | #else |
| 1095 | int |
| 1096 | yyparse () |
| 1097 | |
| 1098 | #endif |
| 1099 | #endif |
| 1100 | { |
| 1101 | |
| 1102 | register int yystate; |
| 1103 | register int yyn; |
| 1104 | int yyresult; |
| 1105 | /* Number of tokens to shift before error messages enabled. */ |
| 1106 | int yyerrstatus; |
| 1107 | /* Lookahead token as an internal (translated) token number. */ |
| 1108 | int yytoken = 0; |
| 1109 | |
| 1110 | /* Three stacks and their tools: |
| 1111 | `yyss': related to states, |
| 1112 | `yyvs': related to semantic values, |
| 1113 | `yyls': related to locations. |
| 1114 | |
| 1115 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 1116 | to reallocate them elsewhere. */ |
| 1117 | |
| 1118 | /* The state stack. */ |
| 1119 | short yyssa[YYINITDEPTH]; |
| 1120 | short *yyss = yyssa; |
| 1121 | register short *yyssp; |
| 1122 | |
| 1123 | /* The semantic value stack. */ |
| 1124 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 1125 | YYSTYPE *yyvs = yyvsa; |
| 1126 | register YYSTYPE *yyvsp; |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | #define YYPOPSTACK (yyvsp--, yyssp--) |
| 1131 | |
| 1132 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 1133 | |
| 1134 | /* The variables used to return semantic value and location from the |
| 1135 | action routines. */ |
| 1136 | YYSTYPE yyval; |
| 1137 | |
| 1138 | |
| 1139 | /* When reducing, the number of symbols on the RHS of the reduced |
| 1140 | rule. */ |
| 1141 | int yylen; |
| 1142 | |
| 1143 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 1144 | |
| 1145 | yystate = 0; |
| 1146 | yyerrstatus = 0; |
| 1147 | yynerrs = 0; |
| 1148 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1149 | |
| 1150 | /* Initialize stack pointers. |
| 1151 | Waste one element of value and location stack |
| 1152 | so that they stay on the same level as the state stack. |
| 1153 | The wasted elements are never initialized. */ |
| 1154 | |
| 1155 | yyssp = yyss; |
| 1156 | yyvsp = yyvs; |
| 1157 | |
| 1158 | goto yysetstate; |
| 1159 | |
| 1160 | /*------------------------------------------------------------. |
| 1161 | | yynewstate -- Push a new state, which is found in yystate. | |
| 1162 | `------------------------------------------------------------*/ |
| 1163 | yynewstate: |
| 1164 | /* In all cases, when you get here, the value and location stacks |
| 1165 | have just been pushed. so pushing a state here evens the stacks. |
| 1166 | */ |
| 1167 | yyssp++; |
| 1168 | |
| 1169 | yysetstate: |
| 1170 | *yyssp = yystate; |
| 1171 | |
| 1172 | if (yyss + yystacksize - 1 <= yyssp) |
| 1173 | { |
| 1174 | /* Get the current used size of the three stacks, in elements. */ |
| 1175 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 1176 | |
| 1177 | #ifdef yyoverflow |
| 1178 | { |
| 1179 | /* Give user a chance to reallocate the stack. Use copies of |
| 1180 | these so that the &'s don't force the real ones into |
| 1181 | memory. */ |
| 1182 | YYSTYPE *yyvs1 = yyvs; |
| 1183 | short *yyss1 = yyss; |
| 1184 | |
| 1185 | |
| 1186 | /* Each stack pointer address is followed by the size of the |
| 1187 | data in use in that stack, in bytes. This used to be a |
| 1188 | conditional around just the two extra args, but that might |
| 1189 | be undefined if yyoverflow is a macro. */ |
| 1190 | yyoverflow ("parser stack overflow", |
| 1191 | &yyss1, yysize * sizeof (*yyssp), |
| 1192 | &yyvs1, yysize * sizeof (*yyvsp), |
| 1193 | |
| 1194 | &yystacksize); |
| 1195 | |
| 1196 | yyss = yyss1; |
| 1197 | yyvs = yyvs1; |
| 1198 | } |
| 1199 | #else /* no yyoverflow */ |
| 1200 | # ifndef YYSTACK_RELOCATE |
| 1201 | goto yyoverflowlab; |
| 1202 | # else |
| 1203 | /* Extend the stack our own way. */ |
| 1204 | if (YYMAXDEPTH <= yystacksize) |
| 1205 | goto yyoverflowlab; |
| 1206 | yystacksize *= 2; |
| 1207 | if (YYMAXDEPTH < yystacksize) |
| 1208 | yystacksize = YYMAXDEPTH; |
| 1209 | |
| 1210 | { |
| 1211 | short *yyss1 = yyss; |
| 1212 | union yyalloc *yyptr = |
| 1213 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 1214 | if (! yyptr) |
| 1215 | goto yyoverflowlab; |
| 1216 | YYSTACK_RELOCATE (yyss); |
| 1217 | YYSTACK_RELOCATE (yyvs); |
| 1218 | |
| 1219 | # undef YYSTACK_RELOCATE |
| 1220 | if (yyss1 != yyssa) |
| 1221 | YYSTACK_FREE (yyss1); |
| 1222 | } |
| 1223 | # endif |
| 1224 | #endif /* no yyoverflow */ |
| 1225 | |
| 1226 | yyssp = yyss + yysize - 1; |
| 1227 | yyvsp = yyvs + yysize - 1; |
| 1228 | |
| 1229 | |
| 1230 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1231 | (unsigned long int) yystacksize)); |
| 1232 | |
| 1233 | if (yyss + yystacksize - 1 <= yyssp) |
| 1234 | YYABORT; |
| 1235 | } |
| 1236 | |
| 1237 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1238 | |
| 1239 | goto yybackup; |
| 1240 | |
| 1241 | /*-----------. |
| 1242 | | yybackup. | |
| 1243 | `-----------*/ |
| 1244 | yybackup: |
| 1245 | |
| 1246 | /* Do appropriate processing given the current state. */ |
| 1247 | /* Read a lookahead token if we need one and don't already have one. */ |
| 1248 | /* yyresume: */ |
| 1249 | |
| 1250 | /* First try to decide what to do without reference to lookahead token. */ |
| 1251 | |
| 1252 | yyn = yypact[yystate]; |
| 1253 | if (yyn == YYPACT_NINF) |
| 1254 | goto yydefault; |
| 1255 | |
| 1256 | /* Not known => get a lookahead token if don't already have one. */ |
| 1257 | |
| 1258 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
| 1259 | if (yychar == YYEMPTY) |
| 1260 | { |
| 1261 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 1262 | yychar = YYLEX; |
| 1263 | } |
| 1264 | |
| 1265 | if (yychar <= YYEOF) |
| 1266 | { |
| 1267 | yychar = yytoken = YYEOF; |
| 1268 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1269 | } |
| 1270 | else |
| 1271 | { |
| 1272 | yytoken = YYTRANSLATE (yychar); |
| 1273 | YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); |
| 1274 | } |
| 1275 | |
| 1276 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 1277 | detect an error, take that action. */ |
| 1278 | yyn += yytoken; |
| 1279 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 1280 | goto yydefault; |
| 1281 | yyn = yytable[yyn]; |
| 1282 | if (yyn <= 0) |
| 1283 | { |
| 1284 | if (yyn == 0 || yyn == YYTABLE_NINF) |
| 1285 | goto yyerrlab; |
| 1286 | yyn = -yyn; |
| 1287 | goto yyreduce; |
| 1288 | } |
| 1289 | |
| 1290 | if (yyn == YYFINAL) |
| 1291 | YYACCEPT; |
| 1292 | |
| 1293 | /* Shift the lookahead token. */ |
| 1294 | YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); |
| 1295 | |
| 1296 | /* Discard the token being shifted unless it is eof. */ |
| 1297 | if (yychar != YYEOF) |
| 1298 | yychar = YYEMPTY; |
| 1299 | |
| 1300 | *++yyvsp = yylval; |
| 1301 | |
| 1302 | |
| 1303 | /* Count tokens shifted since error; after three, turn off error |
| 1304 | status. */ |
| 1305 | if (yyerrstatus) |
| 1306 | yyerrstatus--; |
| 1307 | |
| 1308 | yystate = yyn; |
| 1309 | goto yynewstate; |
| 1310 | |
| 1311 | |
| 1312 | /*-----------------------------------------------------------. |
| 1313 | | yydefault -- do the default action for the current state. | |
| 1314 | `-----------------------------------------------------------*/ |
| 1315 | yydefault: |
| 1316 | yyn = yydefact[yystate]; |
| 1317 | if (yyn == 0) |
| 1318 | goto yyerrlab; |
| 1319 | goto yyreduce; |
| 1320 | |
| 1321 | |
| 1322 | /*-----------------------------. |
| 1323 | | yyreduce -- Do a reduction. | |
| 1324 | `-----------------------------*/ |
| 1325 | yyreduce: |
| 1326 | /* yyn is the number of a rule to reduce with. */ |
| 1327 | yylen = yyr2[yyn]; |
| 1328 | |
| 1329 | /* If YYLEN is nonzero, implement the default value of the action: |
| 1330 | `$$ = $1'. |
| 1331 | |
| 1332 | Otherwise, the following line sets YYVAL to garbage. |
| 1333 | This behavior is undocumented and Bison |
| 1334 | users should not rely upon it. Assigning to YYVAL |
| 1335 | unconditionally makes the parser a bit smaller, and it avoids a |
| 1336 | GCC warning that YYVAL may be used uninitialized. */ |
| 1337 | yyval = yyvsp[1-yylen]; |
| 1338 | |
| 1339 | |
| 1340 | YY_REDUCE_PRINT (yyn); |
| 1341 | switch (yyn) |
| 1342 | { |
| 1343 | case 2: |
| 1344 | #line 223 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1345 | { |
| 1346 | yyval.Rec = Records.getClass(*yyvsp[0].StrVal); |
| 1347 | if (yyval.Rec == 0) { |
| 1348 | err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; |
| 1349 | exit(1); |
| 1350 | } |
| 1351 | delete yyvsp[0].StrVal; |
| 1352 | ;} |
| 1353 | break; |
| 1354 | |
| 1355 | case 3: |
| 1356 | #line 234 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1357 | { // string type |
| 1358 | yyval.Ty = new StringRecTy(); |
| 1359 | ;} |
| 1360 | break; |
| 1361 | |
| 1362 | case 4: |
| 1363 | #line 236 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1364 | { // bit type |
| 1365 | yyval.Ty = new BitRecTy(); |
| 1366 | ;} |
| 1367 | break; |
| 1368 | |
| 1369 | case 5: |
| 1370 | #line 238 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1371 | { // bits<x> type |
| 1372 | yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal); |
| 1373 | ;} |
| 1374 | break; |
| 1375 | |
| 1376 | case 6: |
| 1377 | #line 240 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1378 | { // int type |
| 1379 | yyval.Ty = new IntRecTy(); |
| 1380 | ;} |
| 1381 | break; |
| 1382 | |
| 1383 | case 7: |
| 1384 | #line 242 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1385 | { // list<x> type |
| 1386 | yyval.Ty = new ListRecTy(yyvsp[-1].Ty); |
| 1387 | ;} |
| 1388 | break; |
| 1389 | |
| 1390 | case 8: |
| 1391 | #line 244 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1392 | { // code type |
| 1393 | yyval.Ty = new CodeRecTy(); |
| 1394 | ;} |
| 1395 | break; |
| 1396 | |
| 1397 | case 9: |
| 1398 | #line 246 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1399 | { // dag type |
| 1400 | yyval.Ty = new DagRecTy(); |
| 1401 | ;} |
| 1402 | break; |
| 1403 | |
| 1404 | case 10: |
| 1405 | #line 248 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1406 | { // Record Type |
| 1407 | yyval.Ty = new RecordRecTy(yyvsp[0].Rec); |
| 1408 | ;} |
| 1409 | break; |
| 1410 | |
| 1411 | case 11: |
| 1412 | #line 252 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1413 | { yyval.IntVal = 0; ;} |
| 1414 | break; |
| 1415 | |
| 1416 | case 12: |
| 1417 | #line 252 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1418 | { yyval.IntVal = 1; ;} |
| 1419 | break; |
| 1420 | |
| 1421 | case 13: |
| 1422 | #line 254 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1423 | { yyval.Initializer = 0; ;} |
| 1424 | break; |
| 1425 | |
| 1426 | case 14: |
| 1427 | #line 254 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1428 | { yyval.Initializer = yyvsp[0].Initializer; ;} |
| 1429 | break; |
| 1430 | |
| 1431 | case 15: |
| 1432 | #line 256 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1433 | { |
| 1434 | yyval.Initializer = new IntInit(yyvsp[0].IntVal); |
| 1435 | ;} |
| 1436 | break; |
| 1437 | |
| 1438 | case 16: |
| 1439 | #line 258 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1440 | { |
| 1441 | yyval.Initializer = new StringInit(*yyvsp[0].StrVal); |
| 1442 | delete yyvsp[0].StrVal; |
| 1443 | ;} |
| 1444 | break; |
| 1445 | |
| 1446 | case 17: |
| 1447 | #line 261 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1448 | { |
| 1449 | yyval.Initializer = new CodeInit(*yyvsp[0].StrVal); |
| 1450 | delete yyvsp[0].StrVal; |
| 1451 | ;} |
| 1452 | break; |
| 1453 | |
| 1454 | case 18: |
| 1455 | #line 264 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1456 | { |
| 1457 | yyval.Initializer = new UnsetInit(); |
| 1458 | ;} |
| 1459 | break; |
| 1460 | |
| 1461 | case 19: |
| 1462 | #line 266 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1463 | { |
| 1464 | BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size()); |
| 1465 | for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) { |
| 1466 | struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy()); |
| 1467 | if (Bit == 0) { |
| 1468 | err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i] |
| 1469 | << ") is not convertable to a bit!\n"; |
| 1470 | exit(1); |
| 1471 | } |
| 1472 | Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit); |
| 1473 | } |
| 1474 | yyval.Initializer = Init; |
| 1475 | delete yyvsp[-1].FieldList; |
| 1476 | ;} |
| 1477 | break; |
| 1478 | |
| 1479 | case 20: |
| 1480 | #line 279 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1481 | { |
| 1482 | if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) { |
| 1483 | yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType()); |
| 1484 | } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) { |
| 1485 | const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal); |
| 1486 | assert(RV && "Template arg doesn't exist??"); |
| 1487 | yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType()); |
| 1488 | } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) { |
| 1489 | yyval.Initializer = new DefInit(D); |
| 1490 | } else { |
| 1491 | err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n"; |
| 1492 | exit(1); |
| 1493 | } |
| 1494 | |
| 1495 | delete yyvsp[0].StrVal; |
| 1496 | ;} |
| 1497 | break; |
| 1498 | |
| 1499 | case 21: |
| 1500 | #line 294 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1501 | { |
| 1502 | yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList); |
| 1503 | if (yyval.Initializer == 0) { |
| 1504 | err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n"; |
| 1505 | exit(1); |
| 1506 | } |
| 1507 | delete yyvsp[-1].BitList; |
| 1508 | ;} |
| 1509 | break; |
| 1510 | |
| 1511 | case 22: |
| 1512 | #line 301 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1513 | { |
| 1514 | yyval.Initializer = new ListInit(*yyvsp[-1].FieldList); |
| 1515 | delete yyvsp[-1].FieldList; |
| 1516 | ;} |
| 1517 | break; |
| 1518 | |
| 1519 | case 23: |
| 1520 | #line 304 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1521 | { |
| 1522 | if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) { |
| 1523 | err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n"; |
| 1524 | exit(1); |
| 1525 | } |
| 1526 | yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal); |
| 1527 | delete yyvsp[0].StrVal; |
| 1528 | ;} |
| 1529 | break; |
| 1530 | |
| 1531 | case 24: |
| 1532 | #line 311 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1533 | { |
| 1534 | Record *D = Records.getDef(*yyvsp[-2].StrVal); |
| 1535 | if (D == 0) { |
| 1536 | err() << "Invalid def '" << *yyvsp[-2].StrVal << "'!\n"; |
| 1537 | exit(1); |
| 1538 | } |
| 1539 | yyval.Initializer = new DagInit(D, *yyvsp[-1].DagValueList); |
| 1540 | delete yyvsp[-2].StrVal; delete yyvsp[-1].DagValueList; |
| 1541 | ;} |
| 1542 | break; |
| 1543 | |
| 1544 | case 25: |
| 1545 | #line 319 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1546 | { |
| 1547 | std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end()); |
| 1548 | yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList); |
| 1549 | if (yyval.Initializer == 0) { |
| 1550 | err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n"; |
| 1551 | exit(1); |
| 1552 | } |
| 1553 | delete yyvsp[-1].BitList; |
| 1554 | ;} |
| 1555 | break; |
| 1556 | |
| 1557 | case 26: |
| 1558 | #line 327 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1559 | { |
| 1560 | yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SHL, yyvsp[-1].Initializer); |
| 1561 | if (yyval.Initializer == 0) { |
| 1562 | err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n"; |
| 1563 | exit(1); |
| 1564 | } |
| 1565 | ;} |
| 1566 | break; |
| 1567 | |
| 1568 | case 27: |
| 1569 | #line 333 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1570 | { |
| 1571 | yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRA, yyvsp[-1].Initializer); |
| 1572 | if (yyval.Initializer == 0) { |
| 1573 | err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n"; |
| 1574 | exit(1); |
| 1575 | } |
| 1576 | ;} |
| 1577 | break; |
| 1578 | |
| 1579 | case 28: |
| 1580 | #line 339 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1581 | { |
| 1582 | yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRL, yyvsp[-1].Initializer); |
| 1583 | if (yyval.Initializer == 0) { |
| 1584 | err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n"; |
| 1585 | exit(1); |
| 1586 | } |
| 1587 | ;} |
| 1588 | break; |
| 1589 | |
| 1590 | case 29: |
| 1591 | #line 347 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1592 | { |
| 1593 | yyval.StrVal = new std::string(); |
| 1594 | ;} |
| 1595 | break; |
| 1596 | |
| 1597 | case 30: |
| 1598 | #line 350 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1599 | { |
| 1600 | yyval.StrVal = yyvsp[0].StrVal; |
| 1601 | ;} |
| 1602 | break; |
| 1603 | |
| 1604 | case 31: |
| 1605 | #line 354 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1606 | { |
| 1607 | yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >(); |
| 1608 | yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); |
| 1609 | delete yyvsp[0].StrVal; |
| 1610 | ;} |
| 1611 | break; |
| 1612 | |
| 1613 | case 32: |
| 1614 | #line 359 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1615 | { |
| 1616 | yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); |
| 1617 | delete yyvsp[0].StrVal; |
| 1618 | yyval.DagValueList = yyvsp[-3].DagValueList; |
| 1619 | ;} |
| 1620 | break; |
| 1621 | |
| 1622 | case 33: |
| 1623 | #line 365 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1624 | { |
| 1625 | yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >(); |
| 1626 | ;} |
| 1627 | break; |
| 1628 | |
| 1629 | case 34: |
| 1630 | #line 368 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1631 | { yyval.DagValueList = yyvsp[0].DagValueList; ;} |
| 1632 | break; |
| 1633 | |
| 1634 | case 35: |
| 1635 | #line 371 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1636 | { |
| 1637 | yyval.BitList = new std::vector<unsigned>(); |
| 1638 | yyval.BitList->push_back(yyvsp[0].IntVal); |
| 1639 | ;} |
| 1640 | break; |
| 1641 | |
| 1642 | case 36: |
| 1643 | #line 374 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1644 | { |
| 1645 | if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { |
| 1646 | err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; |
| 1647 | exit(1); |
| 1648 | } |
| 1649 | yyval.BitList = new std::vector<unsigned>(); |
| 1650 | if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { |
| 1651 | for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) |
| 1652 | yyval.BitList->push_back(i); |
| 1653 | } else { |
| 1654 | for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) |
| 1655 | yyval.BitList->push_back(i); |
| 1656 | } |
| 1657 | ;} |
| 1658 | break; |
| 1659 | |
| 1660 | case 37: |
| 1661 | #line 387 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1662 | { |
| 1663 | yyvsp[0].IntVal = -yyvsp[0].IntVal; |
| 1664 | if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { |
| 1665 | err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; |
| 1666 | exit(1); |
| 1667 | } |
| 1668 | yyval.BitList = new std::vector<unsigned>(); |
| 1669 | if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { |
| 1670 | for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) |
| 1671 | yyval.BitList->push_back(i); |
| 1672 | } else { |
| 1673 | for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) |
| 1674 | yyval.BitList->push_back(i); |
| 1675 | } |
| 1676 | ;} |
| 1677 | break; |
| 1678 | |
| 1679 | case 38: |
| 1680 | #line 401 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1681 | { |
| 1682 | (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal); |
| 1683 | ;} |
| 1684 | break; |
| 1685 | |
| 1686 | case 39: |
| 1687 | #line 403 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1688 | { |
| 1689 | if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { |
| 1690 | err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; |
| 1691 | exit(1); |
| 1692 | } |
| 1693 | yyval.BitList = yyvsp[-4].BitList; |
| 1694 | if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { |
| 1695 | for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) |
| 1696 | yyval.BitList->push_back(i); |
| 1697 | } else { |
| 1698 | for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) |
| 1699 | yyval.BitList->push_back(i); |
| 1700 | } |
| 1701 | ;} |
| 1702 | break; |
| 1703 | |
| 1704 | case 40: |
| 1705 | #line 416 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1706 | { |
| 1707 | yyvsp[0].IntVal = -yyvsp[0].IntVal; |
| 1708 | if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { |
| 1709 | err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; |
| 1710 | exit(1); |
| 1711 | } |
| 1712 | yyval.BitList = yyvsp[-3].BitList; |
| 1713 | if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { |
| 1714 | for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) |
| 1715 | yyval.BitList->push_back(i); |
| 1716 | } else { |
| 1717 | for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) |
| 1718 | yyval.BitList->push_back(i); |
| 1719 | } |
| 1720 | ;} |
| 1721 | break; |
| 1722 | |
| 1723 | case 41: |
| 1724 | #line 432 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1725 | { yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;} |
| 1726 | break; |
| 1727 | |
| 1728 | case 42: |
| 1729 | #line 434 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1730 | { yyval.BitList = 0; ;} |
| 1731 | break; |
| 1732 | |
| 1733 | case 43: |
| 1734 | #line 434 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1735 | { yyval.BitList = yyvsp[-1].BitList; ;} |
| 1736 | break; |
| 1737 | |
| 1738 | case 44: |
| 1739 | #line 438 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1740 | { |
| 1741 | yyval.FieldList = new std::vector<Init*>(); |
| 1742 | ;} |
| 1743 | break; |
| 1744 | |
| 1745 | case 45: |
| 1746 | #line 440 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1747 | { |
| 1748 | yyval.FieldList = yyvsp[0].FieldList; |
| 1749 | ;} |
| 1750 | break; |
| 1751 | |
| 1752 | case 46: |
| 1753 | #line 444 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1754 | { |
| 1755 | yyval.FieldList = new std::vector<Init*>(); |
| 1756 | yyval.FieldList->push_back(yyvsp[0].Initializer); |
| 1757 | ;} |
| 1758 | break; |
| 1759 | |
| 1760 | case 47: |
| 1761 | #line 447 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1762 | { |
| 1763 | (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer); |
| 1764 | ;} |
| 1765 | break; |
| 1766 | |
| 1767 | case 48: |
| 1768 | #line 451 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1769 | { |
| 1770 | std::string DecName = *yyvsp[-1].StrVal; |
| 1771 | if (ParsingTemplateArgs) |
| 1772 | DecName = CurRec->getName() + ":" + DecName; |
| 1773 | |
| 1774 | addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal)); |
| 1775 | setValue(DecName, 0, yyvsp[0].Initializer); |
| 1776 | yyval.StrVal = new std::string(DecName); |
| 1777 | ;} |
| 1778 | break; |
| 1779 | |
| 1780 | case 49: |
| 1781 | #line 461 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1782 | { |
| 1783 | delete yyvsp[-1].StrVal; |
| 1784 | ;} |
| 1785 | break; |
| 1786 | |
| 1787 | case 50: |
| 1788 | #line 463 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1789 | { |
| 1790 | setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer); |
| 1791 | delete yyvsp[-4].StrVal; |
| 1792 | delete yyvsp[-3].BitList; |
| 1793 | ;} |
| 1794 | break; |
| 1795 | |
| 1796 | case 55: |
| 1797 | #line 472 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1798 | { |
| 1799 | yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>()); |
| 1800 | ;} |
| 1801 | break; |
| 1802 | |
| 1803 | case 56: |
| 1804 | #line 474 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1805 | { |
| 1806 | yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList); |
| 1807 | ;} |
| 1808 | break; |
| 1809 | |
| 1810 | case 57: |
| 1811 | #line 478 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1812 | { |
| 1813 | yyval.SubClassList = new std::vector<SubClassRefTy>(); |
| 1814 | yyval.SubClassList->push_back(*yyvsp[0].SubClassRef); |
| 1815 | delete yyvsp[0].SubClassRef; |
| 1816 | ;} |
| 1817 | break; |
| 1818 | |
| 1819 | case 58: |
| 1820 | #line 483 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1821 | { |
| 1822 | (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef); |
| 1823 | delete yyvsp[0].SubClassRef; |
| 1824 | ;} |
| 1825 | break; |
| 1826 | |
| 1827 | case 59: |
| 1828 | #line 488 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1829 | { |
| 1830 | yyval.SubClassList = new std::vector<SubClassRefTy>(); |
| 1831 | ;} |
| 1832 | break; |
| 1833 | |
| 1834 | case 60: |
| 1835 | #line 491 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1836 | { |
| 1837 | yyval.SubClassList = yyvsp[0].SubClassList; |
| 1838 | ;} |
| 1839 | break; |
| 1840 | |
| 1841 | case 61: |
| 1842 | #line 495 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1843 | { |
| 1844 | CurRec->addTemplateArg(*yyvsp[0].StrVal); |
| 1845 | delete yyvsp[0].StrVal; |
| 1846 | ;} |
| 1847 | break; |
| 1848 | |
| 1849 | case 62: |
| 1850 | #line 498 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1851 | { |
| 1852 | CurRec->addTemplateArg(*yyvsp[0].StrVal); |
| 1853 | delete yyvsp[0].StrVal; |
| 1854 | ;} |
| 1855 | break; |
| 1856 | |
| 1857 | case 63: |
| 1858 | #line 503 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1859 | {;} |
| 1860 | break; |
| 1861 | |
| 1862 | case 66: |
| 1863 | #line 506 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1864 | { yyval.StrVal = yyvsp[0].StrVal; ;} |
| 1865 | break; |
| 1866 | |
| 1867 | case 67: |
| 1868 | #line 506 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1869 | { yyval.StrVal = new std::string(); ;} |
| 1870 | break; |
| 1871 | |
| 1872 | case 68: |
| 1873 | #line 508 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1874 | { |
| 1875 | static unsigned AnonCounter = 0; |
| 1876 | if (yyvsp[0].StrVal->empty()) |
| 1877 | *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++); |
| 1878 | CurRec = new Record(*yyvsp[0].StrVal); |
| 1879 | delete yyvsp[0].StrVal; |
| 1880 | ParsingTemplateArgs = true; |
| 1881 | ;} |
| 1882 | break; |
| 1883 | |
| 1884 | case 69: |
| 1885 | #line 515 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1886 | { |
| 1887 | ParsingTemplateArgs = false; |
| 1888 | for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) { |
| 1889 | addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second); |
| 1890 | // Delete the template arg values for the class |
| 1891 | delete (*yyvsp[0].SubClassList)[i].second; |
| 1892 | } |
| 1893 | delete yyvsp[0].SubClassList; // Delete the class list... |
| 1894 | |
| 1895 | // Process any variables on the set stack... |
| 1896 | for (unsigned i = 0, e = LetStack.size(); i != e; ++i) |
| 1897 | for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j) |
| 1898 | setValue(LetStack[i][j].Name, |
| 1899 | LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0, |
| 1900 | LetStack[i][j].Value); |
| 1901 | ;} |
| 1902 | break; |
| 1903 | |
| 1904 | case 70: |
| 1905 | #line 530 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1906 | { |
| 1907 | yyval.Rec = CurRec; |
| 1908 | CurRec = 0; |
| 1909 | ;} |
| 1910 | break; |
| 1911 | |
| 1912 | case 71: |
| 1913 | #line 535 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1914 | { |
| 1915 | if (Records.getClass(yyvsp[0].Rec->getName())) { |
| 1916 | err() << "Class '" << yyvsp[0].Rec->getName() << "' already defined!\n"; |
| 1917 | exit(1); |
| 1918 | } |
| 1919 | Records.addClass(yyval.Rec = yyvsp[0].Rec); |
| 1920 | ;} |
| 1921 | break; |
| 1922 | |
| 1923 | case 72: |
| 1924 | #line 543 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1925 | { |
| 1926 | yyvsp[0].Rec->resolveReferences(); |
| 1927 | |
| 1928 | if (!yyvsp[0].Rec->getTemplateArgs().empty()) { |
| 1929 | err() << "Def '" << yyvsp[0].Rec->getName() |
| 1930 | << "' is not permitted to have template arguments!\n"; |
| 1931 | exit(1); |
| 1932 | } |
| 1933 | // If ObjectBody has template arguments, it's an error. |
| 1934 | if (Records.getDef(yyvsp[0].Rec->getName())) { |
| 1935 | err() << "Def '" << yyvsp[0].Rec->getName() << "' already defined!\n"; |
| 1936 | exit(1); |
| 1937 | } |
| 1938 | Records.addDef(yyval.Rec = yyvsp[0].Rec); |
| 1939 | ;} |
| 1940 | break; |
| 1941 | |
| 1942 | case 75: |
| 1943 | #line 562 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1944 | { |
| 1945 | LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer)); |
| 1946 | delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList; |
| 1947 | ;} |
| 1948 | break; |
| 1949 | |
| 1950 | case 78: |
| 1951 | #line 570 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1952 | { LetStack.push_back(std::vector<LetRecord>()); ;} |
| 1953 | break; |
| 1954 | |
| 1955 | case 80: |
| 1956 | #line 573 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1957 | { |
| 1958 | LetStack.pop_back(); |
| 1959 | ;} |
| 1960 | break; |
| 1961 | |
| 1962 | case 81: |
| 1963 | #line 576 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1964 | { |
| 1965 | LetStack.pop_back(); |
| 1966 | ;} |
| 1967 | break; |
| 1968 | |
| 1969 | case 82: |
| 1970 | #line 580 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1971 | {;} |
| 1972 | break; |
| 1973 | |
| 1974 | case 83: |
| 1975 | #line 580 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1976 | {;} |
| 1977 | break; |
| 1978 | |
| 1979 | case 84: |
| 1980 | #line 582 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 1981 | {;} |
| 1982 | break; |
| 1983 | |
| 1984 | |
| 1985 | } |
| 1986 | |
| 1987 | /* Line 1000 of yacc.c. */ |
| 1988 | #line 1989 "FileParser.tab.c" |
| 1989 | |
| 1990 | yyvsp -= yylen; |
| 1991 | yyssp -= yylen; |
| 1992 | |
| 1993 | |
| 1994 | YY_STACK_PRINT (yyss, yyssp); |
| 1995 | |
| 1996 | *++yyvsp = yyval; |
| 1997 | |
| 1998 | |
| 1999 | /* Now `shift' the result of the reduction. Determine what state |
| 2000 | that goes to, based on the state we popped back to and the rule |
| 2001 | number reduced by. */ |
| 2002 | |
| 2003 | yyn = yyr1[yyn]; |
| 2004 | |
| 2005 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 2006 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 2007 | yystate = yytable[yystate]; |
| 2008 | else |
| 2009 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 2010 | |
| 2011 | goto yynewstate; |
| 2012 | |
| 2013 | |
| 2014 | /*------------------------------------. |
| 2015 | | yyerrlab -- here on detecting error | |
| 2016 | `------------------------------------*/ |
| 2017 | yyerrlab: |
| 2018 | /* If not already recovering from an error, report this error. */ |
| 2019 | if (!yyerrstatus) |
| 2020 | { |
| 2021 | ++yynerrs; |
| 2022 | #if YYERROR_VERBOSE |
| 2023 | yyn = yypact[yystate]; |
| 2024 | |
| 2025 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
| 2026 | { |
| 2027 | YYSIZE_T yysize = 0; |
| 2028 | int yytype = YYTRANSLATE (yychar); |
| 2029 | const char* yyprefix; |
| 2030 | char *yymsg; |
| 2031 | int yyx; |
| 2032 | |
| 2033 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 2034 | YYCHECK. */ |
| 2035 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 2036 | |
| 2037 | /* Stay within bounds of both yycheck and yytname. */ |
| 2038 | int yychecklim = YYLAST - yyn; |
| 2039 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 2040 | int yycount = 0; |
| 2041 | |
| 2042 | yyprefix = ", expecting "; |
| 2043 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 2044 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 2045 | { |
| 2046 | yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); |
| 2047 | yycount += 1; |
| 2048 | if (yycount == 5) |
| 2049 | { |
| 2050 | yysize = 0; |
| 2051 | break; |
| 2052 | } |
| 2053 | } |
| 2054 | yysize += (sizeof ("syntax error, unexpected ") |
| 2055 | + yystrlen (yytname[yytype])); |
| 2056 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 2057 | if (yymsg != 0) |
| 2058 | { |
| 2059 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); |
| 2060 | yyp = yystpcpy (yyp, yytname[yytype]); |
| 2061 | |
| 2062 | if (yycount < 5) |
| 2063 | { |
| 2064 | yyprefix = ", expecting "; |
| 2065 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 2066 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 2067 | { |
| 2068 | yyp = yystpcpy (yyp, yyprefix); |
| 2069 | yyp = yystpcpy (yyp, yytname[yyx]); |
| 2070 | yyprefix = " or "; |
| 2071 | } |
| 2072 | } |
| 2073 | yyerror (yymsg); |
| 2074 | YYSTACK_FREE (yymsg); |
| 2075 | } |
| 2076 | else |
| 2077 | yyerror ("syntax error; also virtual memory exhausted"); |
| 2078 | } |
| 2079 | else |
| 2080 | #endif /* YYERROR_VERBOSE */ |
| 2081 | yyerror ("syntax error"); |
| 2082 | } |
| 2083 | |
| 2084 | |
| 2085 | |
| 2086 | if (yyerrstatus == 3) |
| 2087 | { |
| 2088 | /* If just tried and failed to reuse lookahead token after an |
| 2089 | error, discard it. */ |
| 2090 | |
| 2091 | if (yychar <= YYEOF) |
| 2092 | { |
| 2093 | /* If at end of input, pop the error token, |
| 2094 | then the rest of the stack, then return failure. */ |
| 2095 | if (yychar == YYEOF) |
| 2096 | for (;;) |
| 2097 | { |
| 2098 | YYPOPSTACK; |
| 2099 | if (yyssp == yyss) |
| 2100 | YYABORT; |
| 2101 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); |
| 2102 | yydestruct (yystos[*yyssp], yyvsp); |
| 2103 | } |
| 2104 | } |
| 2105 | else |
| 2106 | { |
| 2107 | YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); |
| 2108 | yydestruct (yytoken, &yylval); |
| 2109 | yychar = YYEMPTY; |
| 2110 | |
| 2111 | } |
| 2112 | } |
| 2113 | |
| 2114 | /* Else will try to reuse lookahead token after shifting the error |
| 2115 | token. */ |
| 2116 | goto yyerrlab1; |
| 2117 | |
| 2118 | |
| 2119 | /*---------------------------------------------------. |
| 2120 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 2121 | `---------------------------------------------------*/ |
| 2122 | yyerrorlab: |
| 2123 | |
| 2124 | #ifdef __GNUC__ |
| 2125 | /* Pacify GCC when the user code never invokes YYERROR and the label |
| 2126 | yyerrorlab therefore never appears in user code. */ |
| 2127 | if (0) |
| 2128 | goto yyerrorlab; |
| 2129 | #endif |
| 2130 | |
| 2131 | yyvsp -= yylen; |
| 2132 | yyssp -= yylen; |
| 2133 | yystate = *yyssp; |
| 2134 | goto yyerrlab1; |
| 2135 | |
| 2136 | |
| 2137 | /*-------------------------------------------------------------. |
| 2138 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 2139 | `-------------------------------------------------------------*/ |
| 2140 | yyerrlab1: |
| 2141 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 2142 | |
| 2143 | for (;;) |
| 2144 | { |
| 2145 | yyn = yypact[yystate]; |
| 2146 | if (yyn != YYPACT_NINF) |
| 2147 | { |
| 2148 | yyn += YYTERROR; |
| 2149 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 2150 | { |
| 2151 | yyn = yytable[yyn]; |
| 2152 | if (0 < yyn) |
| 2153 | break; |
| 2154 | } |
| 2155 | } |
| 2156 | |
| 2157 | /* Pop the current state because it cannot handle the error token. */ |
| 2158 | if (yyssp == yyss) |
| 2159 | YYABORT; |
| 2160 | |
| 2161 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); |
| 2162 | yydestruct (yystos[yystate], yyvsp); |
| 2163 | YYPOPSTACK; |
| 2164 | yystate = *yyssp; |
| 2165 | YY_STACK_PRINT (yyss, yyssp); |
| 2166 | } |
| 2167 | |
| 2168 | if (yyn == YYFINAL) |
| 2169 | YYACCEPT; |
| 2170 | |
| 2171 | YYDPRINTF ((stderr, "Shifting error token, ")); |
| 2172 | |
| 2173 | *++yyvsp = yylval; |
| 2174 | |
| 2175 | |
| 2176 | yystate = yyn; |
| 2177 | goto yynewstate; |
| 2178 | |
| 2179 | |
| 2180 | /*-------------------------------------. |
| 2181 | | yyacceptlab -- YYACCEPT comes here. | |
| 2182 | `-------------------------------------*/ |
| 2183 | yyacceptlab: |
| 2184 | yyresult = 0; |
| 2185 | goto yyreturn; |
| 2186 | |
| 2187 | /*-----------------------------------. |
| 2188 | | yyabortlab -- YYABORT comes here. | |
| 2189 | `-----------------------------------*/ |
| 2190 | yyabortlab: |
| 2191 | yyresult = 1; |
| 2192 | goto yyreturn; |
| 2193 | |
| 2194 | #ifndef yyoverflow |
| 2195 | /*----------------------------------------------. |
| 2196 | | yyoverflowlab -- parser overflow comes here. | |
| 2197 | `----------------------------------------------*/ |
| 2198 | yyoverflowlab: |
| 2199 | yyerror ("parser stack overflow"); |
| 2200 | yyresult = 2; |
| 2201 | /* Fall through. */ |
| 2202 | #endif |
| 2203 | |
| 2204 | yyreturn: |
| 2205 | #ifndef yyoverflow |
| 2206 | if (yyss != yyssa) |
| 2207 | YYSTACK_FREE (yyss); |
| 2208 | #endif |
| 2209 | return yyresult; |
| 2210 | } |
| 2211 | |
| 2212 | |
| 2213 | #line 584 "/proj/llvm/build/../llvm/utils/TableGen/FileParser.y" |
| 2214 | |
| 2215 | |
| 2216 | int yyerror(const char *ErrorMsg) { |
| 2217 | err() << "Error parsing: " << ErrorMsg << "\n"; |
| 2218 | exit(1); |
| 2219 | } |
| 2220 | |