1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse Fileparse
64 #define yyerror Fileerror
65 #define yylval Filelval
66 #define yychar Filechar
67 #define yydebug Filedebug
68 #define yynerrs Filenerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
112 #define MULTICLASS 267
120 #define STRCONCATTOK 275
125 #define CODEFRAGMENT 280
130 /* Copy the first part of user declarations. */
131 #line 14 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
134 #include "llvm/ADT/StringExtras.h"
135 #include "llvm/Support/Streams.h"
138 #define YYERROR_VERBOSE 1
140 int yyerror(const char *ErrorMsg);
145 Record Rec; // Placeholder for template args and Name.
146 std::vector<Record*> DefPrototypes;
148 MultiClass(const std::string &Name) : Rec(Name) {}
152 static std::map<std::string, MultiClass*> MultiClasses;
154 extern int Filelineno;
155 static MultiClass *CurMultiClass = 0; // Set while parsing a multiclass.
156 static std::string *CurDefmPrefix = 0; // Set while parsing defm.
157 static Record *CurRec = 0;
158 static bool ParsingTemplateArgs = false;
160 typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
164 std::vector<unsigned> Bits;
167 LetRecord(const std::string &N, std::vector<unsigned> *B, Init *V)
168 : Name(N), Value(V), HasBits(B != 0) {
169 if (HasBits) Bits = *B;
173 static std::vector<std::vector<LetRecord> > LetStack;
176 extern std::ostream &err();
178 /// getActiveRec - If inside a def/class definition, return the def/class.
179 /// Otherwise, if within a multidef, return it.
180 static Record *getActiveRec() {
181 return CurRec ? CurRec : &CurMultiClass->Rec;
184 static void addValue(const RecordVal &RV) {
185 Record *TheRec = getActiveRec();
187 if (RecordVal *ERV = TheRec->getValue(RV.getName())) {
188 // The value already exists in the class, treat this as a set...
189 if (ERV->setValue(RV.getValue())) {
190 err() << "New definition of '" << RV.getName() << "' of type '"
191 << *RV.getType() << "' is incompatible with previous "
192 << "definition of type '" << *ERV->getType() << "'!\n";
196 TheRec->addValue(RV);
200 static void addSuperClass(Record *SC) {
201 if (CurRec->isSubClassOf(SC)) {
202 err() << "Already subclass of '" << SC->getName() << "'!\n";
205 CurRec->addSuperClass(SC);
208 static void setValue(const std::string &ValName,
209 std::vector<unsigned> *BitList, Init *V) {
212 Record *TheRec = getActiveRec();
213 RecordVal *RV = TheRec->getValue(ValName);
215 err() << "Value '" << ValName << "' unknown!\n";
219 // Do not allow assignments like 'X = X'. This will just cause infinite loops
220 // in the resolution machinery.
222 if (VarInit *VI = dynamic_cast<VarInit*>(V))
223 if (VI->getName() == ValName)
226 // If we are assigning to a subset of the bits in the value... then we must be
227 // assigning to a field of BitsRecTy, which must have a BitsInit
231 BitsInit *CurVal = dynamic_cast<BitsInit*>(RV->getValue());
233 err() << "Value '" << ValName << "' is not a bits type!\n";
237 // Convert the incoming value to a bits type of the appropriate size...
238 Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size()));
240 V->convertInitializerTo(new BitsRecTy(BitList->size()));
241 err() << "Initializer '" << *V << "' not compatible with bit range!\n";
245 // We should have a BitsInit type now...
246 assert(dynamic_cast<BitsInit*>(BI) != 0 || (cerr << *BI).stream() == 0);
247 BitsInit *BInit = (BitsInit*)BI;
249 BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
251 // Loop over bits, assigning values as appropriate...
252 for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
253 unsigned Bit = (*BitList)[i];
254 if (NewVal->getBit(Bit)) {
255 err() << "Cannot set bit #" << Bit << " of value '" << ValName
256 << "' more than once!\n";
259 NewVal->setBit(Bit, BInit->getBit(i));
262 for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
263 if (NewVal->getBit(i) == 0)
264 NewVal->setBit(i, CurVal->getBit(i));
269 if (RV->setValue(V)) {
270 err() << "Value '" << ValName << "' of type '" << *RV->getType()
271 << "' is incompatible with initializer '" << *V << "'!\n";
276 // addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's
277 // template arguments.
278 static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
279 // Add all of the values in the subclass into the current class...
280 const std::vector<RecordVal> &Vals = SC->getValues();
281 for (unsigned i = 0, e = Vals.size(); i != e; ++i)
284 const std::vector<std::string> &TArgs = SC->getTemplateArgs();
286 // Ensure that an appropriate number of template arguments are specified...
287 if (TArgs.size() < TemplateArgs.size()) {
288 err() << "ERROR: More template args specified than expected!\n";
292 // Loop over all of the template arguments, setting them to the specified
293 // value or leaving them as the default if necessary.
294 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
295 if (i < TemplateArgs.size()) { // A value is specified for this temp-arg?
297 setValue(TArgs[i], 0, TemplateArgs[i]);
300 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
304 CurRec->removeValue(TArgs[i]);
306 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
307 err() << "ERROR: Value not specified for template argument #"
308 << i << " (" << TArgs[i] << ") of subclass '" << SC->getName()
314 // Since everything went well, we can now set the "superclass" list for the
316 const std::vector<Record*> &SCs = SC->getSuperClasses();
317 for (unsigned i = 0, e = SCs.size(); i != e; ++i)
318 addSuperClass(SCs[i]);
322 } // End llvm namespace
324 using namespace llvm;
328 /* Enabling traces. */
333 /* Enabling verbose error messages. */
334 #ifdef YYERROR_VERBOSE
335 # undef YYERROR_VERBOSE
336 # define YYERROR_VERBOSE 1
338 # define YYERROR_VERBOSE 0
341 /* Enabling the token table. */
342 #ifndef YYTOKEN_TABLE
343 # define YYTOKEN_TABLE 0
346 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
347 typedef union YYSTYPE
348 #line 210 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
353 llvm::Init* Initializer;
354 std::vector<llvm::Init*>* FieldList;
355 std::vector<unsigned>* BitList;
357 std::vector<llvm::Record*>* RecList;
358 SubClassRefTy* SubClassRef;
359 std::vector<SubClassRefTy>* SubClassList;
360 std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
362 /* Line 193 of yacc.c. */
363 #line 364 "FileParser.tab.c"
365 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
366 # define YYSTYPE_IS_DECLARED 1
367 # define YYSTYPE_IS_TRIVIAL 1
372 /* Copy the second part of user declarations. */
375 /* Line 216 of yacc.c. */
376 #line 377 "FileParser.tab.c"
383 typedef YYTYPE_UINT8 yytype_uint8;
385 typedef unsigned char yytype_uint8;
389 typedef YYTYPE_INT8 yytype_int8;
390 #elif (defined __STDC__ || defined __C99__FUNC__ \
391 || defined __cplusplus || defined _MSC_VER)
392 typedef signed char yytype_int8;
394 typedef short int yytype_int8;
398 typedef YYTYPE_UINT16 yytype_uint16;
400 typedef unsigned short int yytype_uint16;
404 typedef YYTYPE_INT16 yytype_int16;
406 typedef short int yytype_int16;
410 # ifdef __SIZE_TYPE__
411 # define YYSIZE_T __SIZE_TYPE__
412 # elif defined size_t
413 # define YYSIZE_T size_t
414 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
415 || defined __cplusplus || defined _MSC_VER)
416 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
417 # define YYSIZE_T size_t
419 # define YYSIZE_T unsigned int
423 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
428 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
429 # define YY_(msgid) dgettext ("bison-runtime", msgid)
433 # define YY_(msgid) msgid
437 /* Suppress unused-variable warnings by "using" E. */
438 #if ! defined lint || defined __GNUC__
439 # define YYUSE(e) ((void) (e))
441 # define YYUSE(e) /* empty */
444 /* Identity function, used to suppress warnings about constant conditions. */
448 #if (defined __STDC__ || defined __C99__FUNC__ \
449 || defined __cplusplus || defined _MSC_VER)
462 #if ! defined yyoverflow || YYERROR_VERBOSE
464 /* The parser invokes alloca or malloc; define the necessary symbols. */
466 # ifdef YYSTACK_USE_ALLOCA
467 # if YYSTACK_USE_ALLOCA
469 # define YYSTACK_ALLOC __builtin_alloca
470 # elif defined __BUILTIN_VA_ARG_INCR
471 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
473 # define YYSTACK_ALLOC __alloca
474 # elif defined _MSC_VER
475 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
476 # define alloca _alloca
478 # define YYSTACK_ALLOC alloca
479 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
480 || defined __cplusplus || defined _MSC_VER)
481 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
490 # ifdef YYSTACK_ALLOC
491 /* Pacify GCC's `empty if-body' warning. */
492 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
493 # ifndef YYSTACK_ALLOC_MAXIMUM
494 /* The OS might guarantee only one guard page at the bottom of the stack,
495 and a page size can be as small as 4096 bytes. So we cannot safely
496 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
497 to allow for a few compiler-allocated temporary stack slots. */
498 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
501 # define YYSTACK_ALLOC YYMALLOC
502 # define YYSTACK_FREE YYFREE
503 # ifndef YYSTACK_ALLOC_MAXIMUM
504 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
506 # if (defined __cplusplus && ! defined _STDLIB_H \
507 && ! ((defined YYMALLOC || defined malloc) \
508 && (defined YYFREE || defined free)))
509 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
515 # define YYMALLOC malloc
516 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
517 || defined __cplusplus || defined _MSC_VER)
518 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
523 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
524 || defined __cplusplus || defined _MSC_VER)
525 void free (void *); /* INFRINGES ON USER NAME SPACE */
529 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
532 #if (! defined yyoverflow \
533 && (! defined __cplusplus \
534 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
536 /* A type that is properly aligned for any stack member. */
543 /* The size of the maximum gap between one aligned stack and the next. */
544 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
546 /* The size of an array large to enough to hold all stacks, each with
548 # define YYSTACK_BYTES(N) \
549 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
550 + YYSTACK_GAP_MAXIMUM)
552 /* Copy COUNT objects from FROM to TO. The source and destination do
555 # if defined __GNUC__ && 1 < __GNUC__
556 # define YYCOPY(To, From, Count) \
557 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
559 # define YYCOPY(To, From, Count) \
563 for (yyi = 0; yyi < (Count); yyi++) \
564 (To)[yyi] = (From)[yyi]; \
570 /* Relocate STACK from its old location to the new one. The
571 local variables YYSIZE and YYSTACKSIZE give the old and new number of
572 elements in the stack, and YYPTR gives the new location of the
573 stack. Advance YYPTR to a properly aligned location for the next
575 # define YYSTACK_RELOCATE(Stack) \
578 YYSIZE_T yynewbytes; \
579 YYCOPY (&yyptr->Stack, Stack, yysize); \
580 Stack = &yyptr->Stack; \
581 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
582 yyptr += yynewbytes / sizeof (*yyptr); \
588 /* YYFINAL -- State number of the termination state. */
590 /* YYLAST -- Last index in YYTABLE. */
593 /* YYNTOKENS -- Number of terminals. */
595 /* YYNNTS -- Number of nonterminals. */
597 /* YYNRULES -- Number of rules. */
599 /* YYNRULES -- Number of states. */
600 #define YYNSTATES 188
602 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
604 #define YYMAXUTOK 280
606 #define YYTRANSLATE(YYX) \
607 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
609 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
610 static const yytype_uint8 yytranslate[] =
612 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 35, 36, 2, 2, 37, 39, 34, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 38, 40,
618 26, 28, 27, 29, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 32, 2, 33, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 30, 2, 31, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
638 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
639 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
644 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
646 static const yytype_uint16 yyprhs[] =
648 0, 0, 3, 5, 7, 9, 14, 16, 21, 23,
649 25, 27, 28, 30, 31, 34, 36, 38, 40, 42,
650 44, 46, 50, 55, 60, 64, 68, 73, 78, 85,
651 92, 99, 106, 107, 110, 113, 118, 119, 121, 123,
652 127, 130, 134, 140, 145, 147, 148, 152, 153, 155,
653 157, 161, 166, 169, 176, 177, 180, 182, 186, 188,
654 193, 195, 199, 200, 203, 205, 209, 213, 214, 216,
655 218, 219, 221, 223, 225, 226, 230, 231, 232, 239,
656 243, 245, 247, 250, 252, 253, 254, 263, 264, 271,
657 273, 275, 277, 279, 284, 286, 290, 291, 296, 301,
661 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
662 static const yytype_int8 yyrhs[] =
664 90, 0, -1, 22, -1, 5, -1, 4, -1, 6,
665 26, 21, 27, -1, 3, -1, 7, 26, 43, 27,
666 -1, 8, -1, 9, -1, 42, -1, -1, 14, -1,
667 -1, 28, 47, -1, 22, -1, 46, -1, 21, -1,
668 24, -1, 25, -1, 29, -1, 30, 54, 31, -1,
669 22, 26, 55, 27, -1, 47, 30, 52, 31, -1,
670 32, 54, 33, -1, 47, 34, 22, -1, 35, 46,
671 50, 36, -1, 47, 32, 52, 33, -1, 17, 35,
672 47, 37, 47, 36, -1, 18, 35, 47, 37, 47,
673 36, -1, 19, 35, 47, 37, 47, 36, -1, 20,
674 35, 47, 37, 47, 36, -1, -1, 38, 23, -1,
675 47, 48, -1, 49, 37, 47, 48, -1, -1, 49,
676 -1, 21, -1, 21, 39, 21, -1, 21, 21, -1,
677 51, 37, 21, -1, 51, 37, 21, 39, 21, -1,
678 51, 37, 21, 21, -1, 51, -1, -1, 30, 52,
679 31, -1, -1, 55, -1, 47, -1, 55, 37, 47,
680 -1, 44, 43, 22, 45, -1, 56, 40, -1, 15,
681 22, 53, 28, 47, 40, -1, -1, 58, 57, -1,
682 40, -1, 30, 58, 31, -1, 42, -1, 42, 26,
683 55, 27, -1, 60, -1, 61, 37, 60, -1, -1,
684 38, 61, -1, 56, -1, 63, 37, 56, -1, 26,
685 63, 27, -1, -1, 64, -1, 22, -1, -1, 66,
686 -1, 67, -1, 67, -1, -1, 62, 71, 59, -1,
687 -1, -1, 10, 68, 73, 65, 74, 70, -1, 11,
688 69, 70, -1, 75, -1, 76, -1, 77, 76, -1,
689 22, -1, -1, -1, 12, 78, 80, 65, 81, 30,
690 77, 31, -1, -1, 13, 22, 83, 38, 60, 40,
691 -1, 72, -1, 75, -1, 79, -1, 82, -1, 22,
692 53, 28, 47, -1, 85, -1, 86, 37, 85, -1,
693 -1, 15, 88, 86, 16, -1, 87, 30, 89, 31,
694 -1, 87, 84, -1, 84, -1, 89, 84, -1, 89,
698 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
699 static const yytype_uint16 yyrline[] =
701 0, 246, 246, 268, 270, 272, 274, 276, 278, 280,
702 282, 286, 286, 288, 288, 290, 313, 315, 317, 320,
703 323, 325, 338, 366, 373, 376, 383, 386, 394, 396,
704 398, 400, 404, 407, 411, 416, 422, 425, 428, 431,
705 444, 458, 460, 473, 489, 491, 491, 495, 497, 501,
706 504, 508, 525, 527, 533, 533, 534, 534, 536, 538,
707 542, 547, 552, 555, 559, 562, 567, 568, 568, 570,
708 570, 572, 579, 597, 622, 622, 641, 643, 641, 649,
709 659, 673, 676, 680, 691, 693, 691, 700, 700, 774,
710 774, 775, 775, 777, 782, 782, 785, 785, 788, 791,
715 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
716 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
717 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
718 static const char *const yytname[] =
720 "$end", "error", "$undefined", "INT", "BIT", "STRING", "BITS", "LIST",
721 "CODE", "DAG", "CLASS", "DEF", "MULTICLASS", "DEFM", "FIELD", "LET",
722 "IN", "SHLTOK", "SRATOK", "SRLTOK", "STRCONCATTOK", "INTVAL", "ID",
723 "VARNAME", "STRVAL", "CODEFRAGMENT", "'<'", "'>'", "'='", "'?'", "'{'",
724 "'}'", "'['", "']'", "'.'", "'('", "')'", "','", "':'", "'-'", "';'",
725 "$accept", "ClassID", "Type", "OptPrefix", "OptValue", "IDValue",
726 "Value", "OptVarName", "DagArgListNE", "DagArgList", "RBitList",
727 "BitList", "OptBitList", "ValueList", "ValueListNE", "Declaration",
728 "BodyItem", "BodyList", "Body", "SubClassRef", "ClassListNE",
729 "ClassList", "DeclListNE", "TemplateArgList", "OptTemplateArgList",
730 "OptID", "ObjectName", "ClassName", "DefName", "ObjectBody", "@1",
731 "ClassInst", "@2", "@3", "DefInst", "MultiClassDef", "MultiClassBody",
732 "MultiClassName", "MultiClassInst", "@4", "@5", "DefMInst", "@6",
733 "Object", "LETItem", "LETList", "LETCommand", "@7", "ObjectList", "File", 0
738 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
740 static const yytype_uint16 yytoknum[] =
742 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
743 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
744 275, 276, 277, 278, 279, 280, 60, 62, 61, 63,
745 123, 125, 91, 93, 46, 40, 41, 44, 58, 45,
750 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
751 static const yytype_uint8 yyr1[] =
753 0, 41, 42, 43, 43, 43, 43, 43, 43, 43,
754 43, 44, 44, 45, 45, 46, 47, 47, 47, 47,
755 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
756 47, 47, 48, 48, 49, 49, 50, 50, 51, 51,
757 51, 51, 51, 51, 52, 53, 53, 54, 54, 55,
758 55, 56, 57, 57, 58, 58, 59, 59, 60, 60,
759 61, 61, 62, 62, 63, 63, 64, 65, 65, 66,
760 66, 67, 68, 69, 71, 70, 73, 74, 72, 75,
761 76, 77, 77, 78, 80, 81, 79, 83, 82, 84,
762 84, 84, 84, 85, 86, 86, 88, 87, 84, 84,
766 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
767 static const yytype_uint8 yyr2[] =
769 0, 2, 1, 1, 1, 4, 1, 4, 1, 1,
770 1, 0, 1, 0, 2, 1, 1, 1, 1, 1,
771 1, 3, 4, 4, 3, 3, 4, 4, 6, 6,
772 6, 6, 0, 2, 2, 4, 0, 1, 1, 3,
773 2, 3, 5, 4, 1, 0, 3, 0, 1, 1,
774 3, 4, 2, 6, 0, 2, 1, 3, 1, 4,
775 1, 3, 0, 2, 1, 3, 3, 0, 1, 1,
776 0, 1, 1, 1, 0, 3, 0, 0, 6, 3,
777 1, 1, 2, 1, 0, 0, 8, 0, 6, 1,
778 1, 1, 1, 4, 1, 3, 0, 4, 4, 2,
782 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
783 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
784 means the default is an error. */
785 static const yytype_uint8 yydefact[] =
787 0, 70, 70, 0, 0, 96, 89, 90, 91, 92,
788 100, 0, 102, 0, 69, 71, 72, 76, 73, 62,
789 83, 84, 87, 0, 0, 99, 101, 1, 67, 0,
790 74, 79, 67, 0, 45, 94, 0, 0, 11, 68,
791 77, 2, 58, 60, 63, 0, 85, 0, 0, 0,
792 97, 0, 98, 12, 0, 64, 0, 62, 0, 0,
793 54, 56, 75, 0, 0, 38, 44, 0, 0, 95,
794 6, 4, 3, 0, 0, 8, 9, 10, 0, 66,
795 11, 78, 0, 0, 0, 0, 17, 15, 18, 19,
796 20, 47, 47, 0, 16, 49, 0, 61, 11, 0,
797 88, 40, 0, 0, 46, 93, 0, 0, 13, 65,
798 0, 0, 0, 0, 0, 0, 48, 0, 15, 36,
799 0, 0, 0, 59, 0, 0, 57, 0, 55, 80,
800 81, 0, 39, 41, 0, 0, 0, 51, 0, 0,
801 0, 0, 0, 21, 24, 32, 37, 0, 0, 0,
802 25, 50, 45, 52, 86, 82, 43, 0, 5, 7,
803 14, 0, 0, 0, 0, 22, 0, 34, 0, 26,
804 23, 27, 0, 42, 0, 0, 0, 0, 33, 32,
805 0, 28, 29, 30, 31, 35, 0, 53
808 /* YYDEFGOTO[NTERM-NUM]. */
809 static const yytype_int16 yydefgoto[] =
811 -1, 42, 78, 54, 137, 94, 95, 167, 146, 147,
812 66, 67, 49, 115, 116, 55, 128, 98, 62, 43,
813 44, 30, 56, 39, 40, 15, 16, 17, 19, 31,
814 45, 6, 28, 57, 7, 130, 131, 21, 8, 32,
815 63, 9, 33, 10, 35, 36, 11, 23, 12, 13
818 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
820 #define YYPACT_NINF -97
821 static const yytype_int16 yypact[] =
823 129, 3, 3, 11, 19, -97, -97, -97, -97, -97,
824 -97, 2, 129, 48, -97, -97, -97, -97, -97, 29,
825 -97, -97, -97, 31, 129, -97, -97, -97, 43, 56,
826 -97, -97, 43, 42, 53, -97, -6, -4, 71, -97,
827 -97, -97, 72, -97, 65, 9, -97, 56, 87, 78,
828 -97, 31, -97, -97, 15, -97, 13, 29, 41, 56,
829 -97, -97, -97, 84, 80, 7, 81, 106, 41, -97,
830 -97, -97, -97, 120, 122, -97, -97, -97, 127, -97,
831 71, -97, 115, 116, 117, 118, -97, 128, -97, -97,
832 -97, 41, 41, 133, -97, 113, 27, -97, 60, 145,
833 -97, -97, 136, 137, -97, 113, 138, 15, 132, -97,
834 41, 41, 41, 41, 41, 130, 125, 131, -97, 41,
835 87, 87, 141, -97, 41, 143, -97, 126, -97, -97,
836 -97, 5, -97, 8, 140, 142, 41, -97, 67, 73,
837 79, 85, 45, -97, -97, 54, 134, 139, 146, 135,
838 -97, 113, 53, -97, -97, -97, -97, 149, -97, -97,
839 113, 41, 41, 41, 41, -97, 150, -97, 41, -97,
840 -97, -97, 144, -97, 91, 94, 99, 102, -97, 54,
841 41, -97, -97, -97, -97, -97, 47, -97
844 /* YYPGOTO[NTERM-NUM]. */
845 static const yytype_int16 yypgoto[] =
847 -97, -52, 69, -97, -97, 86, -68, -5, -97, -97,
848 -97, -31, 26, 88, -57, -46, -97, -97, -97, -21,
849 -97, -97, -97, -97, 151, -97, 179, -97, -97, 147,
850 -97, -97, -97, -97, -96, 51, -97, -97, -97, -97,
851 -97, -97, -97, -7, 148, -97, -97, -97, 160, -97
854 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
855 positive, shift that token. If negative, reduce the rule which
856 number is the opposite. If zero, do what YYDEFACT says.
857 If YYTABLE_NINF, syntax error. */
858 #define YYTABLE_NINF -1
859 static const yytype_uint8 yytable[] =
861 105, 96, 77, 129, 25, 26, 1, 2, 3, 4,
862 50, 5, 1, 2, 3, 4, 2, 5, 70, 71,
863 72, 73, 74, 75, 76, 14, 64, 52, 101, 156,
864 26, 51, 24, 20, 109, 129, 154, 41, 97, 60,
865 79, 22, 138, 139, 140, 141, 102, 157, 27, 61,
866 80, 145, 127, 34, 123, 77, 151, 142, 82, 83,
867 84, 85, 86, 87, 124, 88, 89, 29, 160, 38,
868 90, 91, 165, 92, 53, 125, 93, 120, 41, 121,
869 47, 122, 124, 48, 120, 53, 121, 187, 122, 148,
870 149, 126, 166, 174, 175, 176, 177, 120, 58, 121,
871 179, 122, 59, 120, 161, 121, 68, 122, 65, 120,
872 162, 121, 186, 122, 99, 120, 163, 121, 103, 122,
873 100, 120, 164, 121, 120, 122, 121, 181, 122, 120,
874 182, 121, 120, 122, 121, 183, 122, 104, 184, 1,
875 2, 3, 4, 120, 5, 121, 106, 122, 107, 108,
876 110, 111, 112, 113, 114, 118, 2, 132, 133, 134,
877 136, 143, 124, 150, 144, 152, 153, 158, 171, 159,
878 173, 168, 180, 178, 185, 169, 135, 170, 172, 119,
879 117, 18, 155, 46, 37, 0, 0, 0, 0, 0,
880 0, 0, 0, 0, 0, 0, 0, 0, 0, 69,
884 static const yytype_int16 yycheck[] =
886 68, 58, 54, 99, 11, 12, 10, 11, 12, 13,
887 16, 15, 10, 11, 12, 13, 11, 15, 3, 4,
888 5, 6, 7, 8, 9, 22, 47, 31, 21, 21,
889 37, 37, 30, 22, 80, 131, 31, 22, 59, 30,
890 27, 22, 110, 111, 112, 113, 39, 39, 0, 40,
891 37, 119, 98, 22, 27, 107, 124, 114, 17, 18,
892 19, 20, 21, 22, 37, 24, 25, 38, 136, 26,
893 29, 30, 27, 32, 14, 15, 35, 30, 22, 32,
894 38, 34, 37, 30, 30, 14, 32, 40, 34, 120,
895 121, 31, 38, 161, 162, 163, 164, 30, 26, 32,
896 168, 34, 37, 30, 37, 32, 28, 34, 21, 30,
897 37, 32, 180, 34, 30, 30, 37, 32, 37, 34,
898 40, 30, 37, 32, 30, 34, 32, 36, 34, 30,
899 36, 32, 30, 34, 32, 36, 34, 31, 36, 10,
900 11, 12, 13, 30, 15, 32, 26, 34, 26, 22,
901 35, 35, 35, 35, 26, 22, 11, 21, 21, 21,
902 28, 31, 37, 22, 33, 22, 40, 27, 33, 27,
903 21, 37, 28, 23, 179, 36, 107, 31, 152, 93,
904 92, 2, 131, 32, 24, -1, -1, -1, -1, -1,
905 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
909 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
910 symbol of state STATE-NUM. */
911 static const yytype_uint8 yystos[] =
913 0, 10, 11, 12, 13, 15, 72, 75, 79, 82,
914 84, 87, 89, 90, 22, 66, 67, 68, 67, 69,
915 22, 78, 22, 88, 30, 84, 84, 0, 73, 38,
916 62, 70, 80, 83, 22, 85, 86, 89, 26, 64,
917 65, 22, 42, 60, 61, 71, 65, 38, 30, 53,
918 16, 37, 31, 14, 44, 56, 63, 74, 26, 37,
919 30, 40, 59, 81, 60, 21, 51, 52, 28, 85,
920 3, 4, 5, 6, 7, 8, 9, 42, 43, 27,
921 37, 70, 17, 18, 19, 20, 21, 22, 24, 25,
922 29, 30, 32, 35, 46, 47, 55, 60, 58, 30,
923 40, 21, 39, 37, 31, 47, 26, 26, 22, 56,
924 35, 35, 35, 35, 26, 54, 55, 54, 22, 46,
925 30, 32, 34, 27, 37, 15, 31, 56, 57, 75,
926 76, 77, 21, 21, 21, 43, 28, 45, 47, 47,
927 47, 47, 55, 31, 33, 47, 49, 50, 52, 52,
928 22, 47, 22, 40, 31, 76, 21, 39, 27, 27,
929 47, 37, 37, 37, 37, 27, 38, 48, 37, 36,
930 31, 33, 53, 21, 47, 47, 47, 47, 23, 47,
931 28, 36, 36, 36, 36, 48, 47, 40
934 #define yyerrok (yyerrstatus = 0)
935 #define yyclearin (yychar = YYEMPTY)
939 #define YYACCEPT goto yyacceptlab
940 #define YYABORT goto yyabortlab
941 #define YYERROR goto yyerrorlab
944 /* Like YYERROR except do call yyerror. This remains here temporarily
945 to ease the transition to the new meaning of YYERROR, for GCC.
946 Once GCC version 2 has supplanted version 1, this can go. */
948 #define YYFAIL goto yyerrlab
950 #define YYRECOVERING() (!!yyerrstatus)
952 #define YYBACKUP(Token, Value) \
954 if (yychar == YYEMPTY && yylen == 1) \
958 yytoken = YYTRANSLATE (yychar); \
964 yyerror (YY_("syntax error: cannot back up")); \
971 #define YYERRCODE 256
974 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
975 If N is 0, then set CURRENT to the empty location which ends
976 the previous symbol: RHS[0] (always defined). */
978 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
979 #ifndef YYLLOC_DEFAULT
980 # define YYLLOC_DEFAULT(Current, Rhs, N) \
984 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
985 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
986 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
987 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
991 (Current).first_line = (Current).last_line = \
992 YYRHSLOC (Rhs, 0).last_line; \
993 (Current).first_column = (Current).last_column = \
994 YYRHSLOC (Rhs, 0).last_column; \
1000 /* YY_LOCATION_PRINT -- Print the location on the stream.
1001 This macro was not mandated originally: define only if we know
1002 we won't break user code: when these are the locations we know. */
1004 #ifndef YY_LOCATION_PRINT
1005 # if YYLTYPE_IS_TRIVIAL
1006 # define YY_LOCATION_PRINT(File, Loc) \
1007 fprintf (File, "%d.%d-%d.%d", \
1008 (Loc).first_line, (Loc).first_column, \
1009 (Loc).last_line, (Loc).last_column)
1011 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1016 /* YYLEX -- calling `yylex' with the right arguments. */
1019 # define YYLEX yylex (YYLEX_PARAM)
1021 # define YYLEX yylex ()
1024 /* Enable debugging if requested. */
1028 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1029 # define YYFPRINTF fprintf
1032 # define YYDPRINTF(Args) \
1038 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1042 YYFPRINTF (stderr, "%s ", Title); \
1043 yy_symbol_print (stderr, \
1045 YYFPRINTF (stderr, "\n"); \
1050 /*--------------------------------.
1051 | Print this symbol on YYOUTPUT. |
1052 `--------------------------------*/
1055 #if (defined __STDC__ || defined __C99__FUNC__ \
1056 || defined __cplusplus || defined _MSC_VER)
1058 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1061 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1064 YYSTYPE const * const yyvaluep;
1070 if (yytype < YYNTOKENS)
1071 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1083 /*--------------------------------.
1084 | Print this symbol on YYOUTPUT. |
1085 `--------------------------------*/
1087 #if (defined __STDC__ || defined __C99__FUNC__ \
1088 || defined __cplusplus || defined _MSC_VER)
1090 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1093 yy_symbol_print (yyoutput, yytype, yyvaluep)
1096 YYSTYPE const * const yyvaluep;
1099 if (yytype < YYNTOKENS)
1100 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1102 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1104 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1105 YYFPRINTF (yyoutput, ")");
1108 /*------------------------------------------------------------------.
1109 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1111 `------------------------------------------------------------------*/
1113 #if (defined __STDC__ || defined __C99__FUNC__ \
1114 || defined __cplusplus || defined _MSC_VER)
1116 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1119 yy_stack_print (bottom, top)
1120 yytype_int16 *bottom;
1124 YYFPRINTF (stderr, "Stack now");
1125 for (; bottom <= top; ++bottom)
1126 YYFPRINTF (stderr, " %d", *bottom);
1127 YYFPRINTF (stderr, "\n");
1130 # define YY_STACK_PRINT(Bottom, Top) \
1133 yy_stack_print ((Bottom), (Top)); \
1137 /*------------------------------------------------.
1138 | Report that the YYRULE is going to be reduced. |
1139 `------------------------------------------------*/
1141 #if (defined __STDC__ || defined __C99__FUNC__ \
1142 || defined __cplusplus || defined _MSC_VER)
1144 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1147 yy_reduce_print (yyvsp, yyrule)
1152 int yynrhs = yyr2[yyrule];
1154 unsigned long int yylno = yyrline[yyrule];
1155 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1157 /* The symbols being reduced. */
1158 for (yyi = 0; yyi < yynrhs; yyi++)
1160 fprintf (stderr, " $%d = ", yyi + 1);
1161 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1162 &(yyvsp[(yyi + 1) - (yynrhs)])
1164 fprintf (stderr, "\n");
1168 # define YY_REDUCE_PRINT(Rule) \
1171 yy_reduce_print (yyvsp, Rule); \
1174 /* Nonzero means print parse trace. It is left uninitialized so that
1175 multiple parsers can coexist. */
1177 #else /* !YYDEBUG */
1178 # define YYDPRINTF(Args)
1179 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1180 # define YY_STACK_PRINT(Bottom, Top)
1181 # define YY_REDUCE_PRINT(Rule)
1182 #endif /* !YYDEBUG */
1185 /* YYINITDEPTH -- initial size of the parser's stacks. */
1187 # define YYINITDEPTH 200
1190 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1191 if the built-in stack extension method is used).
1193 Do not make this value too large; the results are undefined if
1194 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1195 evaluated with infinite-precision integer arithmetic. */
1198 # define YYMAXDEPTH 10000
1206 # if defined __GLIBC__ && defined _STRING_H
1207 # define yystrlen strlen
1209 /* Return the length of YYSTR. */
1210 #if (defined __STDC__ || defined __C99__FUNC__ \
1211 || defined __cplusplus || defined _MSC_VER)
1213 yystrlen (const char *yystr)
1221 for (yylen = 0; yystr[yylen]; yylen++)
1229 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1230 # define yystpcpy stpcpy
1232 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1234 #if (defined __STDC__ || defined __C99__FUNC__ \
1235 || defined __cplusplus || defined _MSC_VER)
1237 yystpcpy (char *yydest, const char *yysrc)
1240 yystpcpy (yydest, yysrc)
1246 const char *yys = yysrc;
1248 while ((*yyd++ = *yys++) != '\0')
1257 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1258 quotes and backslashes, so that it's suitable for yyerror. The
1259 heuristic is that double-quoting is unnecessary unless the string
1260 contains an apostrophe, a comma, or backslash (other than
1261 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1262 null, do not copy; instead, return the length of what the result
1265 yytnamerr (char *yyres, const char *yystr)
1270 char const *yyp = yystr;
1277 goto do_not_strip_quotes;
1281 goto do_not_strip_quotes;
1294 do_not_strip_quotes: ;
1298 return yystrlen (yystr);
1300 return yystpcpy (yyres, yystr) - yyres;
1304 /* Copy into YYRESULT an error message about the unexpected token
1305 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1306 including the terminating null byte. If YYRESULT is null, do not
1307 copy anything; just return the number of bytes that would be
1308 copied. As a special case, return 0 if an ordinary "syntax error"
1309 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1310 size calculation. */
1312 yysyntax_error (char *yyresult, int yystate, int yychar)
1314 int yyn = yypact[yystate];
1316 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1320 int yytype = YYTRANSLATE (yychar);
1321 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1322 YYSIZE_T yysize = yysize0;
1324 int yysize_overflow = 0;
1325 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1326 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1330 /* This is so xgettext sees the translatable formats that are
1331 constructed on the fly. */
1332 YY_("syntax error, unexpected %s");
1333 YY_("syntax error, unexpected %s, expecting %s");
1334 YY_("syntax error, unexpected %s, expecting %s or %s");
1335 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1336 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1340 static char const yyunexpected[] = "syntax error, unexpected %s";
1341 static char const yyexpecting[] = ", expecting %s";
1342 static char const yyor[] = " or %s";
1343 char yyformat[sizeof yyunexpected
1344 + sizeof yyexpecting - 1
1345 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1346 * (sizeof yyor - 1))];
1347 char const *yyprefix = yyexpecting;
1349 /* Start YYX at -YYN if negative to avoid negative indexes in
1351 int yyxbegin = yyn < 0 ? -yyn : 0;
1353 /* Stay within bounds of both yycheck and yytname. */
1354 int yychecklim = YYLAST - yyn + 1;
1355 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1358 yyarg[0] = yytname[yytype];
1359 yyfmt = yystpcpy (yyformat, yyunexpected);
1361 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1362 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1364 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1368 yyformat[sizeof yyunexpected - 1] = '\0';
1371 yyarg[yycount++] = yytname[yyx];
1372 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1373 yysize_overflow |= (yysize1 < yysize);
1375 yyfmt = yystpcpy (yyfmt, yyprefix);
1379 yyf = YY_(yyformat);
1380 yysize1 = yysize + yystrlen (yyf);
1381 yysize_overflow |= (yysize1 < yysize);
1384 if (yysize_overflow)
1385 return YYSIZE_MAXIMUM;
1389 /* Avoid sprintf, as that infringes on the user's name space.
1390 Don't have undefined behavior even if the translation
1391 produced a string with the wrong number of "%s"s. */
1392 char *yyp = yyresult;
1394 while ((*yyp = *yyf) != '\0')
1396 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1398 yyp += yytnamerr (yyp, yyarg[yyi++]);
1411 #endif /* YYERROR_VERBOSE */
1414 /*-----------------------------------------------.
1415 | Release the memory associated to this symbol. |
1416 `-----------------------------------------------*/
1419 #if (defined __STDC__ || defined __C99__FUNC__ \
1420 || defined __cplusplus || defined _MSC_VER)
1422 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1425 yydestruct (yymsg, yytype, yyvaluep)
1435 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1446 /* Prevent warnings from -Wmissing-prototypes. */
1448 #ifdef YYPARSE_PARAM
1449 #if defined __STDC__ || defined __cplusplus
1450 int yyparse (void *YYPARSE_PARAM);
1454 #else /* ! YYPARSE_PARAM */
1455 #if defined __STDC__ || defined __cplusplus
1460 #endif /* ! YYPARSE_PARAM */
1464 /* The look-ahead symbol. */
1467 /* The semantic value of the look-ahead symbol. */
1470 /* Number of syntax errors so far. */
1479 #ifdef YYPARSE_PARAM
1480 #if (defined __STDC__ || defined __C99__FUNC__ \
1481 || defined __cplusplus || defined _MSC_VER)
1483 yyparse (void *YYPARSE_PARAM)
1486 yyparse (YYPARSE_PARAM)
1487 void *YYPARSE_PARAM;
1489 #else /* ! YYPARSE_PARAM */
1490 #if (defined __STDC__ || defined __C99__FUNC__ \
1491 || defined __cplusplus || defined _MSC_VER)
1505 /* Number of tokens to shift before error messages enabled. */
1507 /* Look-ahead token as an internal (translated) token number. */
1510 /* Buffer for error messages, and its allocated size. */
1512 char *yymsg = yymsgbuf;
1513 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1516 /* Three stacks and their tools:
1517 `yyss': related to states,
1518 `yyvs': related to semantic values,
1519 `yyls': related to locations.
1521 Refer to the stacks thru separate pointers, to allow yyoverflow
1522 to reallocate them elsewhere. */
1524 /* The state stack. */
1525 yytype_int16 yyssa[YYINITDEPTH];
1526 yytype_int16 *yyss = yyssa;
1527 yytype_int16 *yyssp;
1529 /* The semantic value stack. */
1530 YYSTYPE yyvsa[YYINITDEPTH];
1531 YYSTYPE *yyvs = yyvsa;
1536 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1538 YYSIZE_T yystacksize = YYINITDEPTH;
1540 /* The variables used to return semantic value and location from the
1545 /* The number of symbols on the RHS of the reduced rule.
1546 Keep to zero when no symbol should be popped. */
1549 YYDPRINTF ((stderr, "Starting parse\n"));
1554 yychar = YYEMPTY; /* Cause a token to be read. */
1556 /* Initialize stack pointers.
1557 Waste one element of value and location stack
1558 so that they stay on the same level as the state stack.
1559 The wasted elements are never initialized. */
1566 /*------------------------------------------------------------.
1567 | yynewstate -- Push a new state, which is found in yystate. |
1568 `------------------------------------------------------------*/
1570 /* In all cases, when you get here, the value and location stacks
1571 have just been pushed. So pushing a state here evens the stacks. */
1577 if (yyss + yystacksize - 1 <= yyssp)
1579 /* Get the current used size of the three stacks, in elements. */
1580 YYSIZE_T yysize = yyssp - yyss + 1;
1584 /* Give user a chance to reallocate the stack. Use copies of
1585 these so that the &'s don't force the real ones into
1587 YYSTYPE *yyvs1 = yyvs;
1588 yytype_int16 *yyss1 = yyss;
1591 /* Each stack pointer address is followed by the size of the
1592 data in use in that stack, in bytes. This used to be a
1593 conditional around just the two extra args, but that might
1594 be undefined if yyoverflow is a macro. */
1595 yyoverflow (YY_("memory exhausted"),
1596 &yyss1, yysize * sizeof (*yyssp),
1597 &yyvs1, yysize * sizeof (*yyvsp),
1604 #else /* no yyoverflow */
1605 # ifndef YYSTACK_RELOCATE
1606 goto yyexhaustedlab;
1608 /* Extend the stack our own way. */
1609 if (YYMAXDEPTH <= yystacksize)
1610 goto yyexhaustedlab;
1612 if (YYMAXDEPTH < yystacksize)
1613 yystacksize = YYMAXDEPTH;
1616 yytype_int16 *yyss1 = yyss;
1617 union yyalloc *yyptr =
1618 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1620 goto yyexhaustedlab;
1621 YYSTACK_RELOCATE (yyss);
1622 YYSTACK_RELOCATE (yyvs);
1624 # undef YYSTACK_RELOCATE
1626 YYSTACK_FREE (yyss1);
1629 #endif /* no yyoverflow */
1631 yyssp = yyss + yysize - 1;
1632 yyvsp = yyvs + yysize - 1;
1635 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1636 (unsigned long int) yystacksize));
1638 if (yyss + yystacksize - 1 <= yyssp)
1642 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1651 /* Do appropriate processing given the current state. Read a
1652 look-ahead token if we need one and don't already have one. */
1654 /* First try to decide what to do without reference to look-ahead token. */
1655 yyn = yypact[yystate];
1656 if (yyn == YYPACT_NINF)
1659 /* Not known => get a look-ahead token if don't already have one. */
1661 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1662 if (yychar == YYEMPTY)
1664 YYDPRINTF ((stderr, "Reading a token: "));
1668 if (yychar <= YYEOF)
1670 yychar = yytoken = YYEOF;
1671 YYDPRINTF ((stderr, "Now at end of input.\n"));
1675 yytoken = YYTRANSLATE (yychar);
1676 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1679 /* If the proper action on seeing token YYTOKEN is to reduce or to
1680 detect an error, take that action. */
1682 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1687 if (yyn == 0 || yyn == YYTABLE_NINF)
1696 /* Count tokens shifted since error; after three, turn off error
1701 /* Shift the look-ahead token. */
1702 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1704 /* Discard the shifted token unless it is eof. */
1705 if (yychar != YYEOF)
1714 /*-----------------------------------------------------------.
1715 | yydefault -- do the default action for the current state. |
1716 `-----------------------------------------------------------*/
1718 yyn = yydefact[yystate];
1724 /*-----------------------------.
1725 | yyreduce -- Do a reduction. |
1726 `-----------------------------*/
1728 /* yyn is the number of a rule to reduce with. */
1731 /* If YYLEN is nonzero, implement the default value of the action:
1734 Otherwise, the following line sets YYVAL to garbage.
1735 This behavior is undocumented and Bison
1736 users should not rely upon it. Assigning to YYVAL
1737 unconditionally makes the parser a bit smaller, and it avoids a
1738 GCC warning that YYVAL may be used uninitialized. */
1739 yyval = yyvsp[1-yylen];
1742 YY_REDUCE_PRINT (yyn);
1746 #line 246 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1748 if (CurDefmPrefix) {
1749 // If CurDefmPrefix is set, we're parsing a defm, which means that this is
1750 // actually the name of a multiclass.
1751 MultiClass *MC = MultiClasses[*(yyvsp[(1) - (1)].StrVal)];
1753 err() << "Couldn't find class '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n";
1756 (yyval.Rec) = &MC->Rec;
1758 (yyval.Rec) = Records.getClass(*(yyvsp[(1) - (1)].StrVal));
1760 if ((yyval.Rec) == 0) {
1761 err() << "Couldn't find class '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n";
1764 delete (yyvsp[(1) - (1)].StrVal);
1769 #line 268 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1771 (yyval.Ty) = new StringRecTy();
1776 #line 270 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1778 (yyval.Ty) = new BitRecTy();
1783 #line 272 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1785 (yyval.Ty) = new BitsRecTy((yyvsp[(3) - (4)].IntVal));
1790 #line 274 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1792 (yyval.Ty) = new IntRecTy();
1797 #line 276 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1799 (yyval.Ty) = new ListRecTy((yyvsp[(3) - (4)].Ty));
1804 #line 278 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1806 (yyval.Ty) = new CodeRecTy();
1811 #line 280 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1813 (yyval.Ty) = new DagRecTy();
1818 #line 282 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1820 (yyval.Ty) = new RecordRecTy((yyvsp[(1) - (1)].Rec));
1825 #line 286 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1826 { (yyval.IntVal) = 0; ;}
1830 #line 286 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1831 { (yyval.IntVal) = 1; ;}
1835 #line 288 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1836 { (yyval.Initializer) = 0; ;}
1840 #line 288 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1841 { (yyval.Initializer) = (yyvsp[(2) - (2)].Initializer); ;}
1845 #line 290 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1847 if (const RecordVal *RV = (CurRec ? CurRec->getValue(*(yyvsp[(1) - (1)].StrVal)) : 0)) {
1848 (yyval.Initializer) = new VarInit(*(yyvsp[(1) - (1)].StrVal), RV->getType());
1849 } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal))) {
1850 const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal));
1851 assert(RV && "Template arg doesn't exist??");
1852 (yyval.Initializer) = new VarInit(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal), RV->getType());
1853 } else if (CurMultiClass &&
1854 CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*(yyvsp[(1) - (1)].StrVal))) {
1855 std::string Name = CurMultiClass->Rec.getName()+"::"+*(yyvsp[(1) - (1)].StrVal);
1856 const RecordVal *RV = CurMultiClass->Rec.getValue(Name);
1857 assert(RV && "Template arg doesn't exist??");
1858 (yyval.Initializer) = new VarInit(Name, RV->getType());
1859 } else if (Record *D = Records.getDef(*(yyvsp[(1) - (1)].StrVal))) {
1860 (yyval.Initializer) = new DefInit(D);
1862 err() << "Variable not defined: '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n";
1866 delete (yyvsp[(1) - (1)].StrVal);
1871 #line 313 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1873 (yyval.Initializer) = (yyvsp[(1) - (1)].Initializer);
1878 #line 315 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1880 (yyval.Initializer) = new IntInit((yyvsp[(1) - (1)].IntVal));
1885 #line 317 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1887 (yyval.Initializer) = new StringInit(*(yyvsp[(1) - (1)].StrVal));
1888 delete (yyvsp[(1) - (1)].StrVal);
1893 #line 320 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1895 (yyval.Initializer) = new CodeInit(*(yyvsp[(1) - (1)].StrVal));
1896 delete (yyvsp[(1) - (1)].StrVal);
1901 #line 323 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1903 (yyval.Initializer) = new UnsetInit();
1908 #line 325 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1910 BitsInit *Init = new BitsInit((yyvsp[(2) - (3)].FieldList)->size());
1911 for (unsigned i = 0, e = (yyvsp[(2) - (3)].FieldList)->size(); i != e; ++i) {
1912 struct Init *Bit = (*(yyvsp[(2) - (3)].FieldList))[i]->convertInitializerTo(new BitRecTy());
1914 err() << "Element #" << i << " (" << *(*(yyvsp[(2) - (3)].FieldList))[i]
1915 << ") is not convertable to a bit!\n";
1918 Init->setBit((yyvsp[(2) - (3)].FieldList)->size()-i-1, Bit);
1920 (yyval.Initializer) = Init;
1921 delete (yyvsp[(2) - (3)].FieldList);
1926 #line 338 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1928 // This is a CLASS<initvalslist> expression. This is supposed to synthesize
1929 // a new anonymous definition, deriving from CLASS<initvalslist> with no
1931 Record *Class = Records.getClass(*(yyvsp[(1) - (4)].StrVal));
1933 err() << "Expected a class, got '" << *(yyvsp[(1) - (4)].StrVal) << "'!\n";
1936 delete (yyvsp[(1) - (4)].StrVal);
1938 static unsigned AnonCounter = 0;
1939 Record *OldRec = CurRec; // Save CurRec.
1941 // Create the new record, set it as CurRec temporarily.
1942 CurRec = new Record("anonymous.val."+utostr(AnonCounter++));
1943 addSubClass(Class, *(yyvsp[(3) - (4)].FieldList)); // Add info about the subclass to CurRec.
1944 delete (yyvsp[(3) - (4)].FieldList); // Free up the template args.
1946 CurRec->resolveReferences();
1948 Records.addDef(CurRec);
1950 // The result of the expression is a reference to the new record.
1951 (yyval.Initializer) = new DefInit(CurRec);
1953 // Restore the old CurRec
1959 #line 366 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1961 (yyval.Initializer) = (yyvsp[(1) - (4)].Initializer)->convertInitializerBitRange(*(yyvsp[(3) - (4)].BitList));
1962 if ((yyval.Initializer) == 0) {
1963 err() << "Invalid bit range for value '" << *(yyvsp[(1) - (4)].Initializer) << "'!\n";
1966 delete (yyvsp[(3) - (4)].BitList);
1971 #line 373 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1973 (yyval.Initializer) = new ListInit(*(yyvsp[(2) - (3)].FieldList));
1974 delete (yyvsp[(2) - (3)].FieldList);
1979 #line 376 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1981 if (!(yyvsp[(1) - (3)].Initializer)->getFieldType(*(yyvsp[(3) - (3)].StrVal))) {
1982 err() << "Cannot access field '" << *(yyvsp[(3) - (3)].StrVal) << "' of value '" << *(yyvsp[(1) - (3)].Initializer) << "!\n";
1985 (yyval.Initializer) = new FieldInit((yyvsp[(1) - (3)].Initializer), *(yyvsp[(3) - (3)].StrVal));
1986 delete (yyvsp[(3) - (3)].StrVal);
1991 #line 383 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
1993 (yyval.Initializer) = new DagInit((yyvsp[(2) - (4)].Initializer), *(yyvsp[(3) - (4)].DagValueList));
1994 delete (yyvsp[(3) - (4)].DagValueList);
1999 #line 386 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2001 std::reverse((yyvsp[(3) - (4)].BitList)->begin(), (yyvsp[(3) - (4)].BitList)->end());
2002 (yyval.Initializer) = (yyvsp[(1) - (4)].Initializer)->convertInitListSlice(*(yyvsp[(3) - (4)].BitList));
2003 if ((yyval.Initializer) == 0) {
2004 err() << "Invalid list slice for value '" << *(yyvsp[(1) - (4)].Initializer) << "'!\n";
2007 delete (yyvsp[(3) - (4)].BitList);
2012 #line 394 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2014 (yyval.Initializer) = (new BinOpInit(BinOpInit::SHL, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold();
2019 #line 396 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2021 (yyval.Initializer) = (new BinOpInit(BinOpInit::SRA, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold();
2026 #line 398 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2028 (yyval.Initializer) = (new BinOpInit(BinOpInit::SRL, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold();
2033 #line 400 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2035 (yyval.Initializer) = (new BinOpInit(BinOpInit::STRCONCAT, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold();
2040 #line 404 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2042 (yyval.StrVal) = new std::string();
2047 #line 407 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2049 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
2054 #line 411 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2056 (yyval.DagValueList) = new std::vector<std::pair<Init*, std::string> >();
2057 (yyval.DagValueList)->push_back(std::make_pair((yyvsp[(1) - (2)].Initializer), *(yyvsp[(2) - (2)].StrVal)));
2058 delete (yyvsp[(2) - (2)].StrVal);
2063 #line 416 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2065 (yyvsp[(1) - (4)].DagValueList)->push_back(std::make_pair((yyvsp[(3) - (4)].Initializer), *(yyvsp[(4) - (4)].StrVal)));
2066 delete (yyvsp[(4) - (4)].StrVal);
2067 (yyval.DagValueList) = (yyvsp[(1) - (4)].DagValueList);
2072 #line 422 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2074 (yyval.DagValueList) = new std::vector<std::pair<Init*, std::string> >();
2079 #line 425 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2080 { (yyval.DagValueList) = (yyvsp[(1) - (1)].DagValueList); ;}
2084 #line 428 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2086 (yyval.BitList) = new std::vector<unsigned>();
2087 (yyval.BitList)->push_back((yyvsp[(1) - (1)].IntVal));
2092 #line 431 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2094 if ((yyvsp[(1) - (3)].IntVal) < 0 || (yyvsp[(3) - (3)].IntVal) < 0) {
2095 err() << "Invalid range: " << (yyvsp[(1) - (3)].IntVal) << "-" << (yyvsp[(3) - (3)].IntVal) << "!\n";
2098 (yyval.BitList) = new std::vector<unsigned>();
2099 if ((yyvsp[(1) - (3)].IntVal) < (yyvsp[(3) - (3)].IntVal)) {
2100 for (int i = (yyvsp[(1) - (3)].IntVal); i <= (yyvsp[(3) - (3)].IntVal); ++i)
2101 (yyval.BitList)->push_back(i);
2103 for (int i = (yyvsp[(1) - (3)].IntVal); i >= (yyvsp[(3) - (3)].IntVal); --i)
2104 (yyval.BitList)->push_back(i);
2110 #line 444 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2112 (yyvsp[(2) - (2)].IntVal) = -(yyvsp[(2) - (2)].IntVal);
2113 if ((yyvsp[(1) - (2)].IntVal) < 0 || (yyvsp[(2) - (2)].IntVal) < 0) {
2114 err() << "Invalid range: " << (yyvsp[(1) - (2)].IntVal) << "-" << (yyvsp[(2) - (2)].IntVal) << "!\n";
2117 (yyval.BitList) = new std::vector<unsigned>();
2118 if ((yyvsp[(1) - (2)].IntVal) < (yyvsp[(2) - (2)].IntVal)) {
2119 for (int i = (yyvsp[(1) - (2)].IntVal); i <= (yyvsp[(2) - (2)].IntVal); ++i)
2120 (yyval.BitList)->push_back(i);
2122 for (int i = (yyvsp[(1) - (2)].IntVal); i >= (yyvsp[(2) - (2)].IntVal); --i)
2123 (yyval.BitList)->push_back(i);
2129 #line 458 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2131 ((yyval.BitList)=(yyvsp[(1) - (3)].BitList))->push_back((yyvsp[(3) - (3)].IntVal));
2136 #line 460 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2138 if ((yyvsp[(3) - (5)].IntVal) < 0 || (yyvsp[(5) - (5)].IntVal) < 0) {
2139 err() << "Invalid range: " << (yyvsp[(3) - (5)].IntVal) << "-" << (yyvsp[(5) - (5)].IntVal) << "!\n";
2142 (yyval.BitList) = (yyvsp[(1) - (5)].BitList);
2143 if ((yyvsp[(3) - (5)].IntVal) < (yyvsp[(5) - (5)].IntVal)) {
2144 for (int i = (yyvsp[(3) - (5)].IntVal); i <= (yyvsp[(5) - (5)].IntVal); ++i)
2145 (yyval.BitList)->push_back(i);
2147 for (int i = (yyvsp[(3) - (5)].IntVal); i >= (yyvsp[(5) - (5)].IntVal); --i)
2148 (yyval.BitList)->push_back(i);
2154 #line 473 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2156 (yyvsp[(4) - (4)].IntVal) = -(yyvsp[(4) - (4)].IntVal);
2157 if ((yyvsp[(3) - (4)].IntVal) < 0 || (yyvsp[(4) - (4)].IntVal) < 0) {
2158 err() << "Invalid range: " << (yyvsp[(3) - (4)].IntVal) << "-" << (yyvsp[(4) - (4)].IntVal) << "!\n";
2161 (yyval.BitList) = (yyvsp[(1) - (4)].BitList);
2162 if ((yyvsp[(3) - (4)].IntVal) < (yyvsp[(4) - (4)].IntVal)) {
2163 for (int i = (yyvsp[(3) - (4)].IntVal); i <= (yyvsp[(4) - (4)].IntVal); ++i)
2164 (yyval.BitList)->push_back(i);
2166 for (int i = (yyvsp[(3) - (4)].IntVal); i >= (yyvsp[(4) - (4)].IntVal); --i)
2167 (yyval.BitList)->push_back(i);
2173 #line 489 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2174 { (yyval.BitList) = (yyvsp[(1) - (1)].BitList); std::reverse((yyvsp[(1) - (1)].BitList)->begin(), (yyvsp[(1) - (1)].BitList)->end()); ;}
2178 #line 491 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2179 { (yyval.BitList) = 0; ;}
2183 #line 491 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2184 { (yyval.BitList) = (yyvsp[(2) - (3)].BitList); ;}
2188 #line 495 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2190 (yyval.FieldList) = new std::vector<Init*>();
2195 #line 497 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2197 (yyval.FieldList) = (yyvsp[(1) - (1)].FieldList);
2202 #line 501 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2204 (yyval.FieldList) = new std::vector<Init*>();
2205 (yyval.FieldList)->push_back((yyvsp[(1) - (1)].Initializer));
2210 #line 504 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2212 ((yyval.FieldList) = (yyvsp[(1) - (3)].FieldList))->push_back((yyvsp[(3) - (3)].Initializer));
2217 #line 508 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2219 std::string DecName = *(yyvsp[(3) - (4)].StrVal);
2220 if (ParsingTemplateArgs) {
2222 DecName = CurRec->getName() + ":" + DecName;
2224 assert(CurMultiClass);
2227 DecName = CurMultiClass->Rec.getName() + "::" + DecName;
2230 addValue(RecordVal(DecName, (yyvsp[(2) - (4)].Ty), (yyvsp[(1) - (4)].IntVal)));
2231 setValue(DecName, 0, (yyvsp[(4) - (4)].Initializer));
2232 (yyval.StrVal) = new std::string(DecName);
2237 #line 525 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2239 delete (yyvsp[(1) - (2)].StrVal);
2244 #line 527 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2246 setValue(*(yyvsp[(2) - (6)].StrVal), (yyvsp[(3) - (6)].BitList), (yyvsp[(5) - (6)].Initializer));
2247 delete (yyvsp[(2) - (6)].StrVal);
2248 delete (yyvsp[(3) - (6)].BitList);
2253 #line 536 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2255 (yyval.SubClassRef) = new SubClassRefTy((yyvsp[(1) - (1)].Rec), new std::vector<Init*>());
2260 #line 538 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2262 (yyval.SubClassRef) = new SubClassRefTy((yyvsp[(1) - (4)].Rec), (yyvsp[(3) - (4)].FieldList));
2267 #line 542 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2269 (yyval.SubClassList) = new std::vector<SubClassRefTy>();
2270 (yyval.SubClassList)->push_back(*(yyvsp[(1) - (1)].SubClassRef));
2271 delete (yyvsp[(1) - (1)].SubClassRef);
2276 #line 547 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2278 ((yyval.SubClassList)=(yyvsp[(1) - (3)].SubClassList))->push_back(*(yyvsp[(3) - (3)].SubClassRef));
2279 delete (yyvsp[(3) - (3)].SubClassRef);
2284 #line 552 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2286 (yyval.SubClassList) = new std::vector<SubClassRefTy>();
2291 #line 555 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2293 (yyval.SubClassList) = (yyvsp[(2) - (2)].SubClassList);
2298 #line 559 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2300 getActiveRec()->addTemplateArg(*(yyvsp[(1) - (1)].StrVal));
2301 delete (yyvsp[(1) - (1)].StrVal);
2306 #line 562 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2308 getActiveRec()->addTemplateArg(*(yyvsp[(3) - (3)].StrVal));
2309 delete (yyvsp[(3) - (3)].StrVal);
2314 #line 567 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2319 #line 570 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2320 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
2324 #line 570 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2325 { (yyval.StrVal) = new std::string(); ;}
2329 #line 572 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2331 static unsigned AnonCounter = 0;
2332 if ((yyvsp[(1) - (1)].StrVal)->empty())
2333 *(yyvsp[(1) - (1)].StrVal) = "anonymous."+utostr(AnonCounter++);
2334 (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal);
2339 #line 579 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2341 // If a class of this name already exists, it must be a forward ref.
2342 if ((CurRec = Records.getClass(*(yyvsp[(1) - (1)].StrVal)))) {
2343 // If the body was previously defined, this is an error.
2344 if (!CurRec->getValues().empty() ||
2345 !CurRec->getSuperClasses().empty() ||
2346 !CurRec->getTemplateArgs().empty()) {
2347 err() << "Class '" << CurRec->getName() << "' already defined!\n";
2351 // If this is the first reference to this class, create and add it.
2352 CurRec = new Record(*(yyvsp[(1) - (1)].StrVal));
2353 Records.addClass(CurRec);
2355 delete (yyvsp[(1) - (1)].StrVal);
2360 #line 597 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2362 CurRec = new Record(*(yyvsp[(1) - (1)].StrVal));
2363 delete (yyvsp[(1) - (1)].StrVal);
2365 if (!CurMultiClass) {
2366 // Top-level def definition.
2368 // Ensure redefinition doesn't happen.
2369 if (Records.getDef(CurRec->getName())) {
2370 err() << "def '" << CurRec->getName() << "' already defined!\n";
2373 Records.addDef(CurRec);
2375 // Otherwise, a def inside a multiclass, add it to the multiclass.
2376 for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); i != e; ++i)
2377 if (CurMultiClass->DefPrototypes[i]->getName() == CurRec->getName()) {
2378 err() << "def '" << CurRec->getName()
2379 << "' already defined in this multiclass!\n";
2382 CurMultiClass->DefPrototypes.push_back(CurRec);
2388 #line 622 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2390 for (unsigned i = 0, e = (yyvsp[(1) - (1)].SubClassList)->size(); i != e; ++i) {
2391 addSubClass((*(yyvsp[(1) - (1)].SubClassList))[i].first, *(*(yyvsp[(1) - (1)].SubClassList))[i].second);
2392 // Delete the template arg values for the class
2393 delete (*(yyvsp[(1) - (1)].SubClassList))[i].second;
2395 delete (yyvsp[(1) - (1)].SubClassList); // Delete the class list.
2397 // Process any variables on the let stack.
2398 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
2399 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
2400 setValue(LetStack[i][j].Name,
2401 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
2402 LetStack[i][j].Value);
2407 #line 636 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2409 (yyval.Rec) = CurRec;
2415 #line 641 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2417 ParsingTemplateArgs = true;
2422 #line 643 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2424 ParsingTemplateArgs = false;
2429 #line 645 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2431 (yyval.Rec) = (yyvsp[(6) - (6)].Rec);
2436 #line 649 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2438 if (CurMultiClass == 0) // Def's in multiclasses aren't really defs.
2439 (yyvsp[(3) - (3)].Rec)->resolveReferences();
2441 // If ObjectBody has template arguments, it's an error.
2442 assert((yyvsp[(3) - (3)].Rec)->getTemplateArgs().empty() && "How'd this get template args?");
2443 (yyval.Rec) = (yyvsp[(3) - (3)].Rec);
2448 #line 659 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2450 (yyval.Rec) = (yyvsp[(1) - (1)].Rec);
2451 // Copy the template arguments for the multiclass into the def.
2452 const std::vector<std::string> &TArgs = CurMultiClass->Rec.getTemplateArgs();
2454 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
2455 const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]);
2456 assert(RV && "Template arg doesn't exist?");
2457 (yyval.Rec)->addValue(*RV);
2463 #line 673 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2465 (yyval.RecList) = new std::vector<Record*>();
2466 (yyval.RecList)->push_back((yyvsp[(1) - (1)].Rec));
2471 #line 676 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2473 (yyval.RecList)->push_back((yyvsp[(2) - (2)].Rec));
2478 #line 680 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2480 MultiClass *&MCE = MultiClasses[*(yyvsp[(1) - (1)].StrVal)];
2482 err() << "multiclass '" << *(yyvsp[(1) - (1)].StrVal) << "' already defined!\n";
2485 MCE = CurMultiClass = new MultiClass(*(yyvsp[(1) - (1)].StrVal));
2486 delete (yyvsp[(1) - (1)].StrVal);
2491 #line 691 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2493 ParsingTemplateArgs = true;
2498 #line 693 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2500 ParsingTemplateArgs = false;
2505 #line 695 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2512 #line 700 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2513 { CurDefmPrefix = (yyvsp[(2) - (2)].StrVal); ;}
2517 #line 700 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2519 // To instantiate a multiclass, we need to first get the multiclass, then
2520 // instantiate each def contained in the multiclass with the SubClassRef
2521 // template parameters.
2522 MultiClass *MC = MultiClasses[(yyvsp[(5) - (6)].SubClassRef)->first->getName()];
2523 assert(MC && "Didn't lookup multiclass correctly?");
2524 std::vector<Init*> &TemplateVals = *(yyvsp[(5) - (6)].SubClassRef)->second;
2525 delete (yyvsp[(5) - (6)].SubClassRef);
2527 // Verify that the correct number of template arguments were specified.
2528 const std::vector<std::string> &TArgs = MC->Rec.getTemplateArgs();
2529 if (TArgs.size() < TemplateVals.size()) {
2530 err() << "ERROR: More template args specified than multiclass expects!\n";
2534 // Loop over all the def's in the multiclass, instantiating each one.
2535 for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) {
2536 Record *DefProto = MC->DefPrototypes[i];
2538 // Add the suffix to the defm name to get the new name.
2539 assert(CurRec == 0 && "A def is current?");
2540 CurRec = new Record(*(yyvsp[(2) - (6)].StrVal) + DefProto->getName());
2542 addSubClass(DefProto, std::vector<Init*>());
2544 // Loop over all of the template arguments, setting them to the specified
2545 // value or leaving them as the default if necessary.
2546 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
2547 if (i < TemplateVals.size()) { // A value is specified for this temp-arg?
2549 setValue(TArgs[i], 0, TemplateVals[i]);
2552 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
2555 CurRec->removeValue(TArgs[i]);
2557 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
2558 err() << "ERROR: Value not specified for template argument #"
2559 << i << " (" << TArgs[i] << ") of multiclassclass '"
2560 << MC->Rec.getName() << "'!\n";
2565 // If the mdef is inside a 'let' expression, add to each def.
2566 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
2567 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
2568 setValue(LetStack[i][j].Name,
2569 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
2570 LetStack[i][j].Value);
2573 // Ensure redefinition doesn't happen.
2574 if (Records.getDef(CurRec->getName())) {
2575 err() << "def '" << CurRec->getName() << "' already defined, "
2576 << "instantiating defm '" << *(yyvsp[(2) - (6)].StrVal) << "' with subdef '"
2577 << DefProto->getName() << "'!\n";
2580 Records.addDef(CurRec);
2582 CurRec->resolveReferences();
2587 delete &TemplateVals;
2588 delete (yyvsp[(2) - (6)].StrVal);
2594 #line 774 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2599 #line 774 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2604 #line 777 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2606 LetStack.back().push_back(LetRecord(*(yyvsp[(1) - (4)].StrVal), (yyvsp[(2) - (4)].BitList), (yyvsp[(4) - (4)].Initializer)));
2607 delete (yyvsp[(1) - (4)].StrVal); delete (yyvsp[(2) - (4)].BitList);
2612 #line 785 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2613 { LetStack.push_back(std::vector<LetRecord>()); ;}
2617 #line 788 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2619 LetStack.pop_back();
2624 #line 791 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2626 LetStack.pop_back();
2631 #line 795 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2636 #line 795 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2641 /* Line 1267 of yacc.c. */
2642 #line 2643 "FileParser.tab.c"
2645 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2649 YY_STACK_PRINT (yyss, yyssp);
2654 /* Now `shift' the result of the reduction. Determine what state
2655 that goes to, based on the state we popped back to and the rule
2656 number reduced by. */
2660 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2661 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2662 yystate = yytable[yystate];
2664 yystate = yydefgoto[yyn - YYNTOKENS];
2669 /*------------------------------------.
2670 | yyerrlab -- here on detecting error |
2671 `------------------------------------*/
2673 /* If not already recovering from an error, report this error. */
2677 #if ! YYERROR_VERBOSE
2678 yyerror (YY_("syntax error"));
2681 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2682 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2684 YYSIZE_T yyalloc = 2 * yysize;
2685 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2686 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2687 if (yymsg != yymsgbuf)
2688 YYSTACK_FREE (yymsg);
2689 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2691 yymsg_alloc = yyalloc;
2695 yymsg_alloc = sizeof yymsgbuf;
2699 if (0 < yysize && yysize <= yymsg_alloc)
2701 (void) yysyntax_error (yymsg, yystate, yychar);
2706 yyerror (YY_("syntax error"));
2708 goto yyexhaustedlab;
2716 if (yyerrstatus == 3)
2718 /* If just tried and failed to reuse look-ahead token after an
2719 error, discard it. */
2721 if (yychar <= YYEOF)
2723 /* Return failure if at end of input. */
2724 if (yychar == YYEOF)
2729 yydestruct ("Error: discarding",
2735 /* Else will try to reuse look-ahead token after shifting the error
2740 /*---------------------------------------------------.
2741 | yyerrorlab -- error raised explicitly by YYERROR. |
2742 `---------------------------------------------------*/
2745 /* Pacify compilers like GCC when the user code never invokes
2746 YYERROR and the label yyerrorlab therefore never appears in user
2748 if (/*CONSTCOND*/ 0)
2751 /* Do not reclaim the symbols of the rule which action triggered
2755 YY_STACK_PRINT (yyss, yyssp);
2760 /*-------------------------------------------------------------.
2761 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2762 `-------------------------------------------------------------*/
2764 yyerrstatus = 3; /* Each real token shifted decrements this. */
2768 yyn = yypact[yystate];
2769 if (yyn != YYPACT_NINF)
2772 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2780 /* Pop the current state because it cannot handle the error token. */
2785 yydestruct ("Error: popping",
2786 yystos[yystate], yyvsp);
2789 YY_STACK_PRINT (yyss, yyssp);
2798 /* Shift the error token. */
2799 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2805 /*-------------------------------------.
2806 | yyacceptlab -- YYACCEPT comes here. |
2807 `-------------------------------------*/
2812 /*-----------------------------------.
2813 | yyabortlab -- YYABORT comes here. |
2814 `-----------------------------------*/
2820 /*-------------------------------------------------.
2821 | yyexhaustedlab -- memory exhaustion comes here. |
2822 `-------------------------------------------------*/
2824 yyerror (YY_("memory exhausted"));
2830 if (yychar != YYEOF && yychar != YYEMPTY)
2831 yydestruct ("Cleanup: discarding lookahead",
2833 /* Do not reclaim the symbols of the rule which action triggered
2834 this YYABORT or YYACCEPT. */
2836 YY_STACK_PRINT (yyss, yyssp);
2837 while (yyssp != yyss)
2839 yydestruct ("Cleanup: popping",
2840 yystos[*yyssp], yyvsp);
2845 YYSTACK_FREE (yyss);
2848 if (yymsg != yymsgbuf)
2849 YYSTACK_FREE (yymsg);
2851 /* Make sure YYID is used. */
2852 return YYID (yyresult);
2856 #line 799 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y"
2859 int yyerror(const char *ErrorMsg) {
2860 err() << "Error parsing: " << ErrorMsg << "\n";