1 /* A Bison parser, made from /usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y, by GNU bison 1.75. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
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)
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.
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. */
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. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
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. */
36 /* Identify Bison output. */
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
45 /* If NAME_PREFIX is specified substitute the variables and functions
47 #define yyparse Upgradeparse
48 #define yylex Upgradelex
49 #define yyerror Upgradeerror
50 #define yylval Upgradelval
51 #define yychar Upgradechar
52 #define yydebug Upgradedebug
53 #define yynerrs Upgradenerrs
59 /* Put the tokens into the symbol table, so that GDB and other debuggers
83 ZEROINITIALIZER = 279,
128 X86_STDCALLCC_TOK = 324,
129 X86_FASTCALLCC_TOK = 325,
193 EXTRACTELEMENT = 389,
225 #define ESINT64VAL 272
226 #define EUINT64VAL 273
232 #define ZEROINITIALIZER 279
238 #define STRINGCONSTANT 285
239 #define IMPLEMENTATION 286
248 #define DOTDOTDOT 295
253 #define DLLIMPORT 300
254 #define DLLEXPORT 301
255 #define EXTERN_WEAK 302
256 #define APPENDING 303
261 #define POINTERSIZE 308
265 #define UNINITIALIZED 312
271 #define SIDEEFFECT 318
274 #define CSRETCC_TOK 321
275 #define FASTCC_TOK 322
276 #define COLDCC_TOK 323
277 #define X86_STDCALLCC_TOK 324
278 #define X86_FASTCALLCC_TOK 325
279 #define DATALAYOUT 326
286 #define UNREACHABLE 333
334 #define GETELEMENTPTR 381
342 #define EXTRACTELEMENT 389
343 #define INSERTELEMENT 390
344 #define SHUFFLEVECTOR 391
362 /* Copy the first part of user declarations. */
363 #line 14 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
365 #include "UpgradeInternals.h"
371 #define YYERROR_VERBOSE 1
372 #define YYINCLUDED_STDLIB_H
375 int yylex(); // declaration" of xxx warnings.
379 static std::string CurFilename;
380 static std::ostream *O = 0;
381 std::istream* LexInput = 0;
382 unsigned SizeOfPointer = 32;
385 // This bool controls whether attributes are ever added to function declarations
386 // definitions and calls.
387 static bool AddAttributes = false;
389 static void warning(const std::string& msg);
391 void UpgradeAssembly(const std::string &infile, std::istream& in,
392 std::ostream &out, bool debug, bool addAttrs)
395 CurFilename = infile;
398 AddAttributes = addAttrs;
402 std::cerr << "llvm-upgrade: parse failed.\n";
403 out << "llvm-upgrade: parse failed.\n";
408 namespace { // Anonymous namespace to keep our implementation local
411 /// This type is used to keep track of the signedness of values. Instead
412 /// of creating llvm::Value directly, the parser will create Value which
413 /// associates a Value* with a Signedness indication.
418 bool isConstant() const { return constant; }
419 ~Value() { delete val; }
423 /// This type is used to keep track of the signedness of the obsolete
424 /// integer types. Instead of creating an llvm::Type directly, the Lexer will
425 /// create instances of Type which retains the signedness indication so
426 /// it can be used by the parser for upgrade decisions.
427 /// For example if "uint" is encountered then the "first" field will be set
428 /// to "int32" and the "second" field will be set to "isUnsigned". If the
429 /// type is not obsolete then "second" will be set to "isSignless".
432 static const Type* get(const std::string &newType, TypeIDs oldType);
433 static const Type* get(const std::string& newType, TypeIDs oldType,
434 const Type* eTy, const Type* rTy);
436 static const Type* get(const std::string& newType, TypeIDs oldType,
437 const Type *eTy, uint64_t elems);
439 static const Type* get(const std::string& newType, TypeIDs oldType,
442 static const Type* get(const std::string& newType, const Type* resTy,
445 const Type* resolve() const;
446 bool operator<(const Type& that) const;
448 bool sameNewTyAs(const Type* that) const {
449 return this->newTy == that->newTy;
452 bool sameOldTyAs(const Type* that) const;
454 TypeIDs getElementTy() const {
456 return elemTy->oldTy;
461 unsigned getUpRefNum() const {
462 assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference");
463 return atoi(&((getNewTy().c_str())[1])); // skip the slash
466 typedef std::vector<const Type*> UpRefStack;
467 void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const;
468 std::string makeUniqueName(const std::string& BaseName) const;
470 const std::string& getNewTy() const { return newTy; }
471 const Type* getResultType() const { return resultTy; }
472 const Type* getElementType() const { return elemTy; }
474 const Type* getPointerType() const {
475 return get(newTy + "*", PointerTy, this, (Type*)0);
478 bool isUnresolved() const { return oldTy == UnresolvedTy; }
479 bool isUpReference() const { return oldTy == UpRefTy; }
480 bool isVoid() const { return oldTy == VoidTy; }
481 bool isBool() const { return oldTy == BoolTy; }
482 bool isSigned() const {
483 return oldTy == SByteTy || oldTy == ShortTy ||
484 oldTy == IntTy || oldTy == LongTy;
487 bool isUnsigned() const {
488 return oldTy == UByteTy || oldTy == UShortTy ||
489 oldTy == UIntTy || oldTy == ULongTy;
491 bool isSignless() const { return !isSigned() && !isUnsigned(); }
492 bool isInteger() const { return isSigned() || isUnsigned(); }
493 bool isIntegral() const { return oldTy == BoolTy || isInteger(); }
494 bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; }
495 bool isPacked() const { return oldTy == PackedTy; }
496 bool isPointer() const { return oldTy == PointerTy; }
497 bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; }
498 bool isArray() const { return oldTy == ArrayTy; }
499 bool isOther() const {
500 return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); }
501 bool isFunction() const { return oldTy == FunctionTy; }
502 bool isComposite() const {
503 return isStruct() || isPointer() || isArray() || isPacked();
506 bool isAttributeCandidate() const {
507 return isIntegral() && getBitWidth() < 32;
510 bool isUnresolvedDeep() const;
512 unsigned getBitWidth() const;
514 const Type* getIndexedType(const Value* V) const;
516 unsigned getNumStructElements() const {
517 return (elements ? elements->size() : 0);
520 const Type* getElement(unsigned idx) const {
522 if (idx < elements->size())
523 return (*elements)[idx];
529 : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
533 Type(const Type& that); // do not implement
534 Type& operator=(const Type& that); // do not implement
536 ~Type() { delete elements; }
540 bool operator()(const Type* X, const Type* Y) const {
541 assert(X && "Can't compare null pointer");
542 assert(Y && "Can't compare null pointer");
547 typedef std::set<const Type*, ltfunctor> TypeRegMap;
549 static const Type* add_new_type(Type* existing);
557 static TypeRegMap registry;
559 typedef std::vector<const Type*> TypeVector;
560 typedef std::map<std::string,const Type*> TypeMap;
561 typedef std::map<const Type*,std::string> TypePlaneMap;
562 typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
563 static TypeVector EnumeratedTypes;
564 static TypeMap NamedTypes;
565 static GlobalsTypeMap Globals;
568 Type::TypeRegMap Type::registry;
569 Type::TypeVector Type::EnumeratedTypes;
570 Type::TypeMap Type::NamedTypes;
571 Type::GlobalsTypeMap Type::Globals;
573 const Type* Type::get(const std::string &newType, TypeIDs oldType) {
574 Type* Ty = new Type();
577 return add_new_type(Ty);
580 const Type* Type::get(const std::string& newType, TypeIDs oldType,
581 const Type* eTy, const Type* rTy) {
582 Type* Ty= new Type();
585 Ty->elemTy = const_cast<Type*>(eTy);
586 Ty->resultTy = const_cast<Type*>(rTy);
587 return add_new_type(Ty);
590 const Type* Type::get(const std::string& newType, TypeIDs oldType,
591 const Type *eTy, uint64_t elems) {
592 Type* Ty = new Type();
595 Ty->elemTy = const_cast<Type*>(eTy);
597 return add_new_type(Ty);
600 const Type* Type::get(const std::string& newType, TypeIDs oldType,
602 Type* Ty = new Type();
606 return add_new_type(Ty);
609 const Type* Type::get(const std::string& newType, const Type* resTy,
611 Type* Ty = new Type();
613 Ty->oldTy = FunctionTy;
614 Ty->resultTy = const_cast<Type*>(resTy);
616 return add_new_type(Ty);
619 const Type* Type::resolve() const {
620 if (isUnresolved()) {
621 if (getNewTy()[0] == '%' && isdigit(newTy[1])) {
622 unsigned ref = atoi(&((newTy.c_str())[1])); // skip the %
623 if (ref < EnumeratedTypes.size()) {
624 return EnumeratedTypes[ref];
626 std::string msg("Can't resolve numbered type: ");
628 yyerror(msg.c_str());
631 Type::TypeMap::iterator I = NamedTypes.find(newTy);
632 if (I != NamedTypes.end()) {
635 std::string msg("Cannot resolve type: ");
637 yyerror(msg.c_str());
641 // otherwise its already resolved.
645 bool Type::operator<(const Type& that) const {
648 if (oldTy != that.oldTy)
649 return oldTy < that.oldTy;
652 unsigned thisUp = this->getUpRefNum();
653 unsigned thatUp = that.getUpRefNum();
654 return thisUp < thatUp;
658 if (this->nelems != that.nelems)
659 return nelems < that.nelems;
661 const Type* thisTy = this->elemTy;
662 const Type* thatTy = that.elemTy;
663 return *thisTy < *thatTy;
666 const Type* thisTy = this->resultTy;
667 const Type* thatTy = that.resultTy;
668 if (!thisTy->sameOldTyAs(thatTy))
669 return *thisTy < *thatTy;
673 case PackedStructTy: {
674 if (elements->size() != that.elements->size())
675 return elements->size() < that.elements->size();
676 for (unsigned i = 0; i < elements->size(); i++) {
677 const Type* thisTy = (*this->elements)[i];
678 const Type* thatTy = (*that.elements)[i];
679 if (!thisTy->sameOldTyAs(thatTy))
680 return *thisTy < *thatTy;
685 return this->newTy < that.newTy;
692 bool Type::sameOldTyAs(const Type* that) const {
697 if (oldTy != that->oldTy)
702 if (nelems != that->nelems)
706 const Type* thisTy = this->elemTy;
707 const Type* thatTy = that->elemTy;
708 return thisTy->sameOldTyAs(thatTy);
711 const Type* thisTy = this->resultTy;
712 const Type* thatTy = that->resultTy;
713 if (!thisTy->sameOldTyAs(thatTy))
718 case PackedStructTy: {
719 if (elements->size() != that->elements->size())
721 for (unsigned i = 0; i < elements->size(); i++) {
722 const Type* thisTy = (*this->elements)[i];
723 const Type* thatTy = (*that->elements)[i];
724 if (!thisTy->sameOldTyAs(thatTy))
730 return this->newTy == that->newTy;
732 return true; // for all others oldTy == that->oldTy is sufficient
737 bool Type::isUnresolvedDeep() const {
744 return elemTy->isUnresolvedDeep();
747 for (unsigned i = 0; i < elements->size(); i++)
748 if ((*elements)[i]->isUnresolvedDeep())
756 unsigned Type::getBitWidth() const {
760 case VoidTy : return 0;
761 case BoolTy : return 1;
762 case SByteTy: case UByteTy : return 8;
763 case ShortTy: case UShortTy : return 16;
764 case IntTy: case UIntTy: case FloatTy: return 32;
765 case LongTy: case ULongTy: case DoubleTy : return 64;
766 case PointerTy: return SizeOfPointer; // global var
769 return nelems * elemTy->getBitWidth();
771 case PackedStructTy: {
773 for (unsigned i = 0; i < elements->size(); i++) {
774 size += (*elements)[i]->getBitWidth();
781 const Type* Type::getIndexedType(const Value* V) const {
783 if (V->isConstant() && V->type->isInteger()) {
784 size_t pos = V->val->find(' ') + 1;
785 if (pos < V->val->size()) {
786 uint64_t idx = atoi(V->val->substr(pos).c_str());
787 return (*elements)[idx];
789 yyerror("Invalid value for constant integer");
793 yyerror("Structure requires constant index");
797 if (isArray() || isPacked() || isPointer())
799 yyerror("Invalid type for getIndexedType");
803 void Type::getSignedness(unsigned &sNum, unsigned &uNum,
804 UpRefStack& stack) const {
807 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy:
808 case FloatTy : case DoubleTy: case UpRefTy:
810 case SByteTy: case ShortTy: case LongTy: case IntTy:
813 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
819 stack.push_back(this);
820 elemTy->getSignedness(sNum, uNum, stack);
823 case PackedStructTy: {
824 stack.push_back(this);
825 for (unsigned i = 0; i < elements->size(); i++) {
826 (*elements)[i]->getSignedness(sNum, uNum, stack);
831 const Type* Ty = this->resolve();
832 // Let's not recurse.
833 UpRefStack::const_iterator I = stack.begin(), E = stack.end();
834 for ( ; I != E && *I != Ty; ++I)
837 Ty->getSignedness(sNum, uNum, stack);
843 std::string AddSuffix(const std::string& Name, const std::string& Suffix) {
844 if (Name[Name.size()-1] == '"') {
845 std::string Result = Name;
846 Result.insert(Result.size()-1, Suffix);
849 return Name + Suffix;
852 std::string Type::makeUniqueName(const std::string& BaseName) const {
853 if (BaseName == "\"alloca point\"")
858 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy:
859 case FloatTy : case DoubleTy: case UnresolvedTy:
861 case SByteTy: case ShortTy: case LongTy: case IntTy:
862 return AddSuffix(BaseName, ".s");
863 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
864 return AddSuffix(BaseName, ".u");
867 unsigned uNum = 0, sNum = 0;
873 Type::UpRefStack stack;
874 elemTy->resolve()->getSignedness(sNum, uNum, stack);
878 case PackedStructTy: {
879 for (unsigned i = 0; i < elements->size(); i++) {
880 Type::UpRefStack stack;
881 (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack);
886 assert(0 && "Invalid Type");
890 if (sNum == 0 && uNum == 0)
894 default: Suffix += ".nada"; break;
895 case PointerTy: Suffix += ".pntr"; break;
896 case PackedTy: Suffix += ".pckd"; break;
897 case ArrayTy: Suffix += ".arry"; break;
898 case StructTy: Suffix += ".strc"; break;
899 case PackedStructTy: Suffix += ".pstr"; break;
902 Suffix += ".s" + llvm::utostr(sNum);
903 Suffix += ".u" + llvm::utostr(uNum);
904 return AddSuffix(BaseName, Suffix);
907 Type& Type::operator=(const Type& that) {
909 nelems = that.nelems;
911 elemTy = that.elemTy;
912 resultTy = that.resultTy;
914 elements = new TypeList(that.elements->size());
915 *elements = *that.elements;
922 const Type* Type::add_new_type(Type* newTy) {
923 TypeRegMap::iterator I = registry.find(newTy);
924 if (I != registry.end()) {
928 registry.insert(newTy);
935 /// This type is used to keep track of the signedness of constants.
939 ~Constant() { delete cnst; }
942 /// This variable provides a counter for unique names. It is used in various
943 /// productions to ensure a unique name is generated.
944 static uint64_t UniqueNameCounter = 1;
946 // This is set when a DECLARE keyword is recognized so that subsequent parsing
947 // of a function prototype can know if its a declaration or definition.
948 static bool isDeclare = false;
950 // This bool is used to communicate between the InstVal and Inst rules about
951 // whether or not a cast should be deleted. When the flag is set, InstVal has
952 // determined that the cast is a candidate. However, it can only be deleted if
953 // the value being casted is the same value name as the instruction. The Inst
954 // rule makes that comparison if the flag is set and comments out the
955 // instruction if they match.
956 static bool deleteUselessCastFlag = false;
957 static std::string* deleteUselessCastName = 0;
961 const char* getCastOpcode(std::string& Source, const Type* SrcTy,
963 unsigned SrcBits = SrcTy->getBitWidth();
964 unsigned DstBits = DstTy->getBitWidth();
965 const char* opcode = "bitcast";
966 // Run through the possibilities ...
967 if (DstTy->isIntegral()) { // Casting to integral
968 if (SrcTy->isIntegral()) { // Casting from integral
969 if (DstBits < SrcBits)
971 else if (DstBits > SrcBits) { // its an extension
972 if (SrcTy->isSigned())
973 opcode ="sext"; // signed -> SEXT
975 opcode = "zext"; // unsigned -> ZEXT
977 opcode = "bitcast"; // Same size, No-op cast
979 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
980 if (DstTy->isSigned())
981 opcode = "fptosi"; // FP -> sint
983 opcode = "fptoui"; // FP -> uint
984 } else if (SrcTy->isPacked()) {
985 assert(DstBits == SrcTy->getBitWidth() &&
986 "Casting packed to integer of different width");
987 opcode = "bitcast"; // same size, no-op cast
989 assert(SrcTy->isPointer() &&
990 "Casting from a value that is not first-class type");
991 opcode = "ptrtoint"; // ptr -> int
993 } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
994 if (SrcTy->isIntegral()) { // Casting from integral
995 if (SrcTy->isSigned())
996 opcode = "sitofp"; // sint -> FP
998 opcode = "uitofp"; // uint -> FP
999 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
1000 if (DstBits < SrcBits) {
1001 opcode = "fptrunc"; // FP -> smaller FP
1002 } else if (DstBits > SrcBits) {
1003 opcode = "fpext"; // FP -> larger FP
1005 opcode ="bitcast"; // same size, no-op cast
1007 } else if (SrcTy->isPacked()) {
1008 assert(DstBits == SrcTy->getBitWidth() &&
1009 "Casting packed to floating point of different width");
1010 opcode = "bitcast"; // same size, no-op cast
1012 assert(0 && "Casting pointer or non-first class to float");
1014 } else if (DstTy->isPacked()) {
1015 if (SrcTy->isPacked()) {
1016 assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
1017 "Casting packed to packed of different widths");
1018 opcode = "bitcast"; // packed -> packed
1019 } else if (DstTy->getBitWidth() == SrcBits) {
1020 opcode = "bitcast"; // float/int -> packed
1022 assert(!"Illegal cast to packed (wrong type or size)");
1024 } else if (DstTy->isPointer()) {
1025 if (SrcTy->isPointer()) {
1026 opcode = "bitcast"; // ptr -> ptr
1027 } else if (SrcTy->isIntegral()) {
1028 opcode = "inttoptr"; // int -> ptr
1030 assert(!"Casting invalid type to pointer");
1033 assert(!"Casting to type that is not first-class");
1038 std::string getCastUpgrade(const std::string& Src, const Type* SrcTy,
1039 const Type* DstTy, bool isConst) {
1041 std::string Source = Src;
1042 if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
1043 // fp -> ptr cast is no longer supported but we must upgrade this
1044 // by doing a double cast: fp -> int -> ptr
1046 Source = "i64 fptoui(" + Source + " to i64)";
1048 *O << " %cast_upgrade" << UniqueNameCounter << " = fptoui "
1049 << Source << " to i64\n";
1050 Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter++);
1052 // Update the SrcTy for the getCastOpcode call below
1053 SrcTy = Type::get("i64", ULongTy);
1054 } else if (DstTy->isBool()) {
1055 // cast type %x to bool was previously defined as setne type %x, null
1056 // The cast semantic is now to truncate, not compare so we must retain
1057 // the original intent by replacing the cast with a setne
1058 const char* comparator = SrcTy->isPointer() ? ", null" :
1059 (SrcTy->isFloatingPoint() ? ", 0.0" :
1060 (SrcTy->isBool() ? ", false" : ", 0"));
1061 const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
1063 Result = "(" + Source + comparator + ")";
1064 Result = compareOp + Result;
1066 Result = compareOp + Source + comparator;
1067 return Result; // skip cast processing below
1069 SrcTy = SrcTy->resolve();
1070 DstTy = DstTy->resolve();
1071 std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
1073 Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
1075 Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
1079 const char* getDivRemOpcode(const std::string& opcode, const Type* TI) {
1080 const char* op = opcode.c_str();
1081 const Type* Ty = TI->resolve();
1083 Ty = Ty->getElementType();
1084 if (opcode == "div")
1085 if (Ty->isFloatingPoint())
1087 else if (Ty->isUnsigned())
1089 else if (Ty->isSigned())
1092 yyerror("Invalid type for div instruction");
1093 else if (opcode == "rem")
1094 if (Ty->isFloatingPoint())
1096 else if (Ty->isUnsigned())
1098 else if (Ty->isSigned())
1101 yyerror("Invalid type for rem instruction");
1105 std::string getCompareOp(const std::string& setcc, const Type* TI) {
1106 assert(setcc.length() == 5);
1107 char cc1 = setcc[3];
1108 char cc2 = setcc[4];
1109 assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
1110 assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
1111 std::string result("xcmp xxx");
1114 if (TI->isFloatingPoint()) {
1118 result[5] = 'u'; // NE maps to unordered
1120 result[5] = 'o'; // everything else maps to ordered
1121 } else if (TI->isIntegral() || TI->isPointer()) {
1123 if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
1125 else if (TI->isSigned())
1127 else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
1130 yyerror("Invalid integral type for setcc");
1135 const Type* getFunctionReturnType(const Type* PFTy) {
1136 PFTy = PFTy->resolve();
1137 if (PFTy->isPointer()) {
1138 const Type* ElemTy = PFTy->getElementType();
1139 ElemTy = ElemTy->resolve();
1140 if (ElemTy->isFunction())
1141 return ElemTy->getResultType();
1142 } else if (PFTy->isFunction()) {
1143 return PFTy->getResultType();
1148 const Type* ResolveUpReference(const Type* Ty,
1149 Type::UpRefStack* stack) {
1150 assert(Ty->isUpReference() && "Can't resolve a non-upreference");
1151 unsigned upref = Ty->getUpRefNum();
1152 assert(upref < stack->size() && "Invalid up reference");
1153 return (*stack)[upref - stack->size() - 1];
1156 const Type* getGEPIndexedType(const Type* PTy, ValueList* idxs) {
1157 const Type* Result = PTy = PTy->resolve();
1158 assert(PTy->isPointer() && "GEP Operand is not a pointer?");
1159 Type::UpRefStack stack;
1160 for (unsigned i = 0; i < idxs->size(); ++i) {
1161 if (Result->isComposite()) {
1162 Result = Result->getIndexedType((*idxs)[i]);
1163 Result = Result->resolve();
1164 stack.push_back(Result);
1166 yyerror("Invalid type for index");
1168 // Resolve upreferences so we can return a more natural type
1169 if (Result->isPointer()) {
1170 if (Result->getElementType()->isUpReference()) {
1171 stack.push_back(Result);
1172 Result = ResolveUpReference(Result->getElementType(), &stack);
1174 } else if (Result->isUpReference()) {
1175 Result = ResolveUpReference(Result->getElementType(), &stack);
1177 return Result->getPointerType();
1180 // This function handles appending .u or .s to integer value names that
1181 // were previously unsigned or signed, respectively. This avoids name
1182 // collisions since the unsigned and signed type planes have collapsed
1183 // into a single signless type plane.
1184 std::string getUniqueName(const std::string *Name, const Type* Ty,
1185 bool isGlobal = false, bool isDef = false) {
1187 // If its not a symbolic name, don't modify it, probably a constant val.
1188 if ((*Name)[0] != '%' && (*Name)[0] != '"')
1191 // If its a numeric reference, just leave it alone.
1192 if (isdigit((*Name)[1]))
1198 // If its a global name, get its uniquified name, if any
1199 Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
1200 if (GI != Type::Globals.end()) {
1201 Type::TypePlaneMap::iterator TPI = GI->second.begin();
1202 Type::TypePlaneMap::iterator TPE = GI->second.end();
1203 for ( ; TPI != TPE ; ++TPI) {
1204 if (TPI->first->sameNewTyAs(Ty))
1210 // We didn't find a global name, but if its supposed to be global then all
1211 // we can do is return the name. This is probably a forward reference of a
1212 // global value that hasn't been defined yet. Since we have no definition
1213 // we don't know its linkage class. Just assume its an external and the name
1214 // shouldn't change.
1218 // Default the result to the current name
1219 std::string Result = Ty->makeUniqueName(*Name);
1224 std::string getGlobalName(const std::string* Name, const std::string Linkage,
1225 const Type* Ty, bool isConstant) {
1226 // Default to given name
1227 std::string Result = *Name;
1228 // Look up the name in the Globals Map
1229 Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
1230 // Did we see this global name before?
1231 if (GI != Type::Globals.end()) {
1232 if (Ty->isUnresolvedDeep()) {
1233 // The Gval's type is unresolved. Consequently, we can't disambiguate it
1234 // by type. We'll just change its name and emit a warning.
1235 warning("Cannot disambiguate global value '" + *Name +
1236 "' because type '" + Ty->getNewTy() + "'is unresolved.\n");
1237 Result = *Name + ".unique";
1238 UniqueNameCounter++;
1239 Result += llvm::utostr(UniqueNameCounter);
1242 Type::TypePlaneMap::iterator TPI = GI->second.find(Ty);
1243 if (TPI != GI->second.end()) {
1244 // We found an existing name of the same old type. This isn't allowed
1245 // in LLVM 2.0. Consequently, we must alter the name of the global so it
1246 // can at least compile. References to the global will yield the first
1247 // definition, which is okay. We also must warn about this.
1248 Result = *Name + ".unique";
1249 UniqueNameCounter++;
1250 Result += llvm::utostr(UniqueNameCounter);
1251 warning(std::string("Global variable '") + *Name + "' was renamed to '"+
1254 // There isn't an existing definition for this name according to the
1255 // old types. Now search the TypePlanMap for types with the same new
1257 Type::TypePlaneMap::iterator TPI = GI->second.begin();
1258 Type::TypePlaneMap::iterator TPE = GI->second.end();
1259 for ( ; TPI != TPE; ++TPI) {
1260 if (TPI->first->sameNewTyAs(Ty)) {
1261 // The new types are the same but the old types are different so
1262 // this is a global name collision resulting from type planes
1264 if (Linkage == "external" || Linkage == "dllimport" ||
1265 Linkage == "extern_weak" || Linkage == "") {
1266 // The linkage of this gval is external so we can't reliably
1267 // rename it because it could potentially create a linking
1268 // problem. However, we can't leave the name conflict in the
1269 // output either or it won't assemble with LLVM 2.0. So, all we
1270 // can do is rename this one to something unique and emit a
1271 // warning about the problem.
1272 Result = *Name + ".unique";
1273 UniqueNameCounter++;
1274 Result += llvm::utostr(UniqueNameCounter);
1275 warning("Renaming global value '" + *Name + "' to '" + Result +
1276 "' may cause linkage errors.");
1279 // Its linkage is internal and its type is known so we can
1280 // disambiguate the name collision successfully based on the type.
1281 Result = getUniqueName(Name, Ty);
1282 TPI->second = Result;
1287 // We didn't find an entry in the type plane with the same new type and
1288 // the old types differ so this is a new type plane for this global
1289 // variable. We just fall through to the logic below which inserts
1295 // Its a new global name, if it is external we can't change it
1296 if (isConstant || Linkage == "external" || Linkage == "dllimport" ||
1297 Linkage == "extern_weak" || Linkage == "") {
1298 Type::Globals[Result][Ty] = Result;
1302 // Its a new global name, and it is internal, change the name to make it
1303 // unique for its type.
1304 // Result = getUniqueName(Name, Ty);
1305 Type::Globals[*Name][Ty] = Result;
1309 } // End anonymous namespace
1311 // This function is used by the Lexer to create a Type. It can't be
1312 // in the anonymous namespace.
1313 const Type* getType(const std::string& newTy, TypeIDs oldTy) {
1314 return Type::get(newTy, oldTy);
1319 /* Enabling traces. */
1324 /* Enabling verbose error messages. */
1325 #ifdef YYERROR_VERBOSE
1326 # undef YYERROR_VERBOSE
1327 # define YYERROR_VERBOSE 1
1329 # define YYERROR_VERBOSE 0
1333 #line 971 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
1335 std::string* String;
1342 /* Line 188 of /usr/local/share/bison/yacc.c. */
1343 #line 1344 "UpgradeParser.tab.c"
1344 # define YYSTYPE yystype
1345 # define YYSTYPE_IS_TRIVIAL 1
1349 typedef struct yyltype
1356 # define YYLTYPE yyltype
1357 # define YYLTYPE_IS_TRIVIAL 1
1360 /* Copy the second part of user declarations. */
1363 /* Line 213 of /usr/local/share/bison/yacc.c. */
1364 #line 1365 "UpgradeParser.tab.c"
1366 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1368 /* The parser invokes alloca or malloc; define the necessary symbols. */
1370 # if YYSTACK_USE_ALLOCA
1371 # define YYSTACK_ALLOC alloca
1373 # ifndef YYSTACK_USE_ALLOCA
1374 # if defined (alloca) || defined (_ALLOCA_H)
1375 # define YYSTACK_ALLOC alloca
1378 # define YYSTACK_ALLOC __builtin_alloca
1384 # ifdef YYSTACK_ALLOC
1385 /* Pacify GCC's `empty if-body' warning. */
1386 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1388 # if defined (__STDC__) || defined (__cplusplus)
1389 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1390 # define YYSIZE_T size_t
1392 # define YYSTACK_ALLOC malloc
1393 # define YYSTACK_FREE free
1395 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1398 #if (! defined (yyoverflow) \
1399 && (! defined (__cplusplus) \
1400 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1402 /* A type that is properly aligned for any stack member. */
1409 /* The size of the maximum gap between one aligned stack and the next. */
1410 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
1412 /* The size of an array large to enough to hold all stacks, each with
1414 # define YYSTACK_BYTES(N) \
1415 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
1418 /* Copy COUNT objects from FROM to TO. The source and destination do
1422 # define YYCOPY(To, From, Count) \
1423 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1425 # define YYCOPY(To, From, Count) \
1428 register YYSIZE_T yyi; \
1429 for (yyi = 0; yyi < (Count); yyi++) \
1430 (To)[yyi] = (From)[yyi]; \
1436 /* Relocate STACK from its old location to the new one. The
1437 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1438 elements in the stack, and YYPTR gives the new location of the
1439 stack. Advance YYPTR to a properly aligned location for the next
1441 # define YYSTACK_RELOCATE(Stack) \
1444 YYSIZE_T yynewbytes; \
1445 YYCOPY (&yyptr->Stack, Stack, yysize); \
1446 Stack = &yyptr->Stack; \
1447 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
1448 yyptr += yynewbytes / sizeof (*yyptr); \
1454 #if defined (__STDC__) || defined (__cplusplus)
1455 typedef signed char yysigned_char;
1457 typedef short yysigned_char;
1460 /* YYFINAL -- State number of the termination state. */
1464 /* YYNTOKENS -- Number of terminals. */
1465 #define YYNTOKENS 164
1466 /* YYNNTS -- Number of nonterminals. */
1468 /* YYNRULES -- Number of rules. */
1469 #define YYNRULES 301
1470 /* YYNRULES -- Number of states. */
1471 #define YYNSTATES 585
1473 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1474 #define YYUNDEFTOK 2
1475 #define YYMAXUTOK 404
1477 #define YYTRANSLATE(X) \
1478 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
1480 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1481 static const unsigned char yytranslate[] =
1483 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1487 153, 154, 162, 2, 151, 2, 2, 2, 2, 2,
1488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1489 158, 150, 159, 2, 2, 2, 2, 2, 2, 2,
1490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1492 2, 155, 152, 157, 2, 2, 2, 2, 2, 163,
1493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1495 156, 2, 2, 160, 2, 161, 2, 2, 2, 2,
1496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1508 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1509 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1510 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1511 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1512 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1513 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1514 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1515 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1516 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1517 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1518 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1519 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1520 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1521 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1522 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1523 145, 146, 147, 148, 149
1527 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1529 static const unsigned short yyprhs[] =
1531 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1532 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1533 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1534 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1535 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1536 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1537 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1538 139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1539 159, 161, 164, 165, 167, 169, 171, 173, 175, 177,
1540 179, 180, 182, 184, 186, 188, 190, 192, 195, 196,
1541 197, 200, 201, 205, 208, 209, 211, 212, 216, 218,
1542 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1543 241, 243, 245, 247, 249, 251, 253, 255, 257, 259,
1544 261, 264, 269, 275, 281, 285, 288, 294, 299, 302,
1545 304, 308, 310, 314, 316, 317, 322, 326, 330, 335,
1546 340, 344, 347, 350, 353, 356, 359, 362, 365, 368,
1547 371, 374, 381, 387, 396, 403, 410, 417, 425, 433,
1548 440, 447, 456, 465, 469, 471, 473, 475, 477, 480,
1549 483, 488, 491, 493, 495, 497, 502, 505, 510, 517,
1550 524, 531, 538, 542, 547, 548, 550, 552, 554, 558,
1551 562, 566, 570, 574, 578, 580, 581, 583, 585, 587,
1552 588, 591, 595, 597, 599, 603, 605, 606, 615, 617,
1553 619, 623, 625, 627, 631, 632, 634, 636, 637, 642,
1554 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
1555 665, 667, 673, 675, 677, 679, 681, 684, 687, 689,
1556 692, 695, 696, 698, 700, 702, 705, 708, 712, 722,
1557 732, 741, 756, 758, 760, 767, 773, 776, 783, 791,
1558 793, 797, 799, 800, 803, 805, 811, 817, 823, 830,
1559 837, 842, 847, 854, 859, 864, 871, 878, 881, 889,
1560 891, 894, 895, 897, 898, 902, 909, 913, 920, 923,
1564 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1565 static const short yyrhs[] =
1567 198, 0, -1, 19, -1, 20, -1, 17, -1, 18,
1568 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1569 -1, 84, -1, 85, -1, 86, -1, 87, -1, 88,
1570 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1571 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1572 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1573 -1, 106, -1, 117, -1, 118, -1, 119, -1, 120,
1574 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1575 -1, 112, -1, 113, -1, 114, -1, 115, -1, 116,
1576 -1, 117, -1, 118, -1, 119, -1, 120, -1, 25,
1577 -1, 26, -1, 129, -1, 130, -1, 131, -1, 132,
1578 -1, 138, -1, 139, -1, 140, -1, 141, -1, 142,
1579 -1, 143, -1, 144, -1, 145, -1, 146, -1, 147,
1580 -1, 148, -1, 149, -1, 137, -1, 11, -1, 9,
1581 -1, 7, -1, 5, -1, 12, -1, 10, -1, 8,
1582 -1, 6, -1, 174, -1, 175, -1, 13, -1, 14,
1583 -1, 207, 150, -1, -1, 42, -1, 43, -1, 44,
1584 -1, 48, -1, 45, -1, 46, -1, 47, -1, -1,
1585 65, -1, 66, -1, 67, -1, 68, -1, 69, -1,
1586 70, -1, 64, 18, -1, -1, -1, 56, 18, -1,
1587 -1, 151, 56, 18, -1, 37, 30, -1, -1, 183,
1588 -1, -1, 151, 186, 185, -1, 183, -1, 56, 18,
1589 -1, 189, -1, 3, -1, 191, -1, 3, -1, 191,
1590 -1, 4, -1, 5, -1, 6, -1, 7, -1, 8,
1591 -1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
1592 -1, 14, -1, 15, -1, 16, -1, 222, -1, 190,
1593 -1, 152, 18, -1, 188, 153, 193, 154, -1, 155,
1594 18, 156, 191, 157, -1, 158, 18, 156, 191, 159,
1595 -1, 160, 192, 161, -1, 160, 161, -1, 158, 160,
1596 192, 161, 159, -1, 158, 160, 161, 159, -1, 191,
1597 162, -1, 191, -1, 192, 151, 191, -1, 192, -1,
1598 192, 151, 40, -1, 40, -1, -1, 189, 155, 196,
1599 157, -1, 189, 155, 157, -1, 189, 163, 30, -1,
1600 189, 158, 196, 159, -1, 189, 160, 196, 161, -1,
1601 189, 160, 161, -1, 189, 22, -1, 189, 23, -1,
1602 189, 222, -1, 189, 195, -1, 189, 24, -1, 174,
1603 166, -1, 175, 166, -1, 4, 25, -1, 4, 26,
1604 -1, 177, 21, -1, 173, 153, 194, 39, 189, 154,
1605 -1, 126, 153, 194, 237, 154, -1, 128, 153, 194,
1606 151, 194, 151, 194, 154, -1, 167, 153, 194, 151,
1607 194, 154, -1, 168, 153, 194, 151, 194, 154, -1,
1608 169, 153, 194, 151, 194, 154, -1, 99, 170, 153,
1609 194, 151, 194, 154, -1, 100, 171, 153, 194, 151,
1610 194, 154, -1, 172, 153, 194, 151, 194, 154, -1,
1611 134, 153, 194, 151, 194, 154, -1, 135, 153, 194,
1612 151, 194, 151, 194, 154, -1, 136, 153, 194, 151,
1613 194, 151, 194, 154, -1, 196, 151, 194, -1, 194,
1614 -1, 35, -1, 36, -1, 199, -1, 199, 216, -1,
1615 199, 218, -1, 199, 62, 61, 202, -1, 199, 31,
1616 -1, 201, -1, 49, -1, 57, -1, 201, 178, 27,
1617 187, -1, 201, 218, -1, 201, 62, 61, 202, -1,
1618 201, 178, 179, 197, 194, 185, -1, 201, 178, 200,
1619 197, 189, 185, -1, 201, 178, 45, 197, 189, 185,
1620 -1, 201, 178, 47, 197, 189, 185, -1, 201, 50,
1621 204, -1, 201, 58, 150, 205, -1, -1, 30, -1,
1622 55, -1, 54, -1, 52, 150, 203, -1, 53, 150,
1623 18, -1, 51, 150, 30, -1, 71, 150, 30, -1,
1624 155, 206, 157, -1, 206, 151, 30, -1, 30, -1,
1625 -1, 28, -1, 30, -1, 207, -1, -1, 189, 208,
1626 -1, 210, 151, 209, -1, 209, -1, 210, -1, 210,
1627 151, 40, -1, 40, -1, -1, 180, 187, 207, 153,
1628 211, 154, 184, 181, -1, 32, -1, 160, -1, 179,
1629 212, 213, -1, 33, -1, 161, -1, 214, 225, 215,
1630 -1, -1, 45, -1, 47, -1, -1, 34, 219, 217,
1631 212, -1, -1, 63, -1, 17, -1, 18, -1, 21,
1632 -1, 25, -1, 26, -1, 22, -1, 23, -1, 24,
1633 -1, 158, 196, 159, -1, 195, -1, 61, 220, 30,
1634 151, 30, -1, 165, -1, 207, -1, 222, -1, 221,
1635 -1, 189, 223, -1, 225, 226, -1, 226, -1, 227,
1636 229, -1, 227, 231, -1, -1, 29, -1, 77, -1,
1637 76, -1, 72, 224, -1, 72, 3, -1, 73, 15,
1638 223, -1, 73, 4, 223, 151, 15, 223, 151, 15,
1639 223, -1, 74, 176, 223, 151, 15, 223, 155, 230,
1640 157, -1, 74, 176, 223, 151, 15, 223, 155, 157,
1641 -1, 178, 75, 180, 187, 223, 153, 234, 154, 39,
1642 15, 223, 228, 15, 223, -1, 228, -1, 78, -1,
1643 230, 176, 221, 151, 15, 223, -1, 176, 221, 151,
1644 15, 223, -1, 178, 236, -1, 189, 155, 223, 151,
1645 223, 157, -1, 232, 151, 155, 223, 151, 223, 157,
1646 -1, 224, -1, 233, 151, 224, -1, 233, -1, -1,
1647 60, 59, -1, 59, -1, 167, 189, 223, 151, 223,
1648 -1, 168, 189, 223, 151, 223, -1, 169, 189, 223,
1649 151, 223, -1, 99, 170, 189, 223, 151, 223, -1,
1650 100, 171, 189, 223, 151, 223, -1, 172, 224, 151,
1651 224, -1, 173, 224, 39, 189, -1, 128, 224, 151,
1652 224, 151, 224, -1, 133, 224, 151, 189, -1, 134,
1653 224, 151, 224, -1, 135, 224, 151, 224, 151, 224,
1654 -1, 136, 224, 151, 224, 151, 224, -1, 127, 232,
1655 -1, 235, 180, 187, 223, 153, 234, 154, -1, 239,
1656 -1, 151, 233, -1, -1, 38, -1, -1, 121, 189,
1657 182, -1, 121, 189, 151, 10, 223, 182, -1, 122,
1658 189, 182, -1, 122, 189, 151, 10, 223, 182, -1,
1659 123, 224, -1, 238, 124, 189, 223, -1, 238, 125,
1660 224, 151, 189, 223, -1, 126, 189, 223, 237, -1
1663 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1664 static const unsigned short yyrline[] =
1666 0, 1036, 1036, 1036, 1037, 1037, 1041, 1041, 1041, 1041,
1667 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1043, 1043, 1043,
1668 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045,
1669 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046,
1670 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047,
1671 1047, 1047, 1048, 1048, 1048, 1048, 1049, 1049, 1049, 1049,
1672 1049, 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1055,
1673 1055, 1055, 1055, 1056, 1056, 1056, 1056, 1057, 1057, 1058,
1674 1058, 1061, 1064, 1069, 1069, 1069, 1069, 1069, 1069, 1070,
1675 1071, 1074, 1074, 1074, 1074, 1074, 1075, 1076, 1081, 1086,
1676 1087, 1090, 1091, 1099, 1105, 1106, 1109, 1110, 1119, 1120,
1677 1133, 1133, 1134, 1134, 1135, 1139, 1139, 1139, 1139, 1139,
1678 1139, 1139, 1140, 1140, 1140, 1140, 1140, 1142, 1145, 1148,
1679 1151, 1155, 1168, 1174, 1180, 1190, 1193, 1203, 1206, 1214,
1680 1218, 1225, 1226, 1231, 1236, 1246, 1253, 1259, 1266, 1273,
1681 1280, 1286, 1293, 1300, 1308, 1315, 1322, 1329, 1336, 1343,
1682 1350, 1358, 1372, 1384, 1389, 1395, 1400, 1406, 1411, 1416,
1683 1424, 1429, 1434, 1444, 1449, 1454, 1454, 1464, 1469, 1472,
1684 1477, 1481, 1485, 1488, 1488, 1491, 1501, 1506, 1511, 1521,
1685 1531, 1541, 1551, 1556, 1561, 1566, 1568, 1568, 1571, 1576,
1686 1583, 1588, 1595, 1602, 1607, 1608, 1616, 1616, 1617, 1617,
1687 1619, 1628, 1632, 1636, 1639, 1644, 1647, 1650, 1673, 1674,
1688 1678, 1689, 1690, 1692, 1701, 1702, 1703, 1707, 1707, 1721,
1689 1722, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1726, 1727,
1690 1732, 1733, 1742, 1742, 1746, 1752, 1763, 1772, 1775, 1783,
1691 1787, 1792, 1795, 1801, 1801, 1803, 1808, 1813, 1818, 1826,
1692 1836, 1845, 1867, 1872, 1878, 1884, 1892, 1910, 1919, 1929,
1693 1933, 1940, 1941, 1945, 1950, 1953, 1964, 1974, 1985, 1995,
1694 2005, 2016, 2046, 2055, 2062, 2071, 2078, 2085, 2091, 2142,
1695 2147, 2148, 2152, 2153, 2156, 2165, 2175, 2184, 2195, 2202,
1700 #if YYDEBUG || YYERROR_VERBOSE
1701 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1702 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1703 static const char *const yytname[] =
1705 "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT",
1706 "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "LABEL",
1707 "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL", "FPVAL",
1708 "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "TYPE",
1709 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", "BEGINTOK",
1710 "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1711 "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK", "DLLIMPORT",
1712 "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "EXTERNAL", "TARGET", "TRIPLE",
1713 "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "UNINITIALIZED",
1714 "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK",
1715 "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK",
1716 "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR",
1717 "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1718 "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM", "SREM", "FREM",
1719 "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ",
1720 "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "OEQ",
1721 "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "ULT",
1722 "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1723 "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR",
1724 "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST",
1725 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI",
1726 "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','",
1727 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1728 "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps",
1729 "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps",
1730 "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1731 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign",
1732 "SectionString", "OptSection", "GlobalVarAttributes",
1733 "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType",
1734 "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr",
1735 "ConstVector", "GlobalType", "Module", "DefinitionList", "External",
1736 "ConstPool", "AsmBlock", "BigOrLittle", "TargetDefinition",
1737 "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal",
1738 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1739 "END", "Function", "FnDeclareLinkage", "FunctionProto", "@1",
1740 "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1741 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1742 "Unwind", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1743 "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList",
1744 "OptVolatile", "MemoryInst", 0
1749 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1751 static const unsigned short yytoknum[] =
1753 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1754 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1755 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1756 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1757 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1758 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1759 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1760 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1761 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1762 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1763 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1764 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1765 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1766 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1767 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1768 61, 44, 92, 40, 41, 91, 120, 93, 60, 62,
1773 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1774 static const unsigned char yyr1[] =
1776 0, 164, 165, 165, 166, 166, 167, 167, 167, 167,
1777 167, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1778 169, 169, 169, 169, 169, 169, 170, 170, 170, 170,
1779 170, 170, 170, 170, 170, 170, 171, 171, 171, 171,
1780 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1781 171, 171, 172, 172, 172, 172, 173, 173, 173, 173,
1782 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1783 174, 174, 174, 175, 175, 175, 175, 176, 176, 177,
1784 177, 178, 178, 179, 179, 179, 179, 179, 179, 179,
1785 179, 180, 180, 180, 180, 180, 180, 180, 180, 181,
1786 181, 182, 182, 183, 184, 184, 185, 185, 186, 186,
1787 187, 187, 188, 188, 189, 190, 190, 190, 190, 190,
1788 190, 190, 190, 190, 190, 190, 190, 191, 191, 191,
1789 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1790 192, 193, 193, 193, 193, 194, 194, 194, 194, 194,
1791 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
1792 194, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1793 195, 195, 195, 196, 196, 197, 197, 198, 199, 199,
1794 199, 199, 199, 200, 200, 201, 201, 201, 201, 201,
1795 201, 201, 201, 201, 201, 202, 203, 203, 204, 204,
1796 204, 204, 205, 206, 206, 206, 207, 207, 208, 208,
1797 209, 210, 210, 211, 211, 211, 211, 212, 213, 213,
1798 214, 215, 215, 216, 217, 217, 217, 219, 218, 220,
1799 220, 221, 221, 221, 221, 221, 221, 221, 221, 221,
1800 221, 221, 222, 222, 223, 223, 224, 225, 225, 226,
1801 227, 227, 227, 228, 228, 229, 229, 229, 229, 229,
1802 229, 229, 229, 229, 230, 230, 231, 232, 232, 233,
1803 233, 234, 234, 235, 235, 236, 236, 236, 236, 236,
1804 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1805 237, 237, 238, 238, 239, 239, 239, 239, 239, 239,
1809 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1810 static const unsigned char yyr2[] =
1812 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1813 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1814 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1815 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1816 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1817 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1818 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1819 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1820 1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1821 0, 1, 1, 1, 1, 1, 1, 2, 0, 0,
1822 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1823 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1825 2, 4, 5, 5, 3, 2, 5, 4, 2, 1,
1826 3, 1, 3, 1, 0, 4, 3, 3, 4, 4,
1827 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1828 2, 6, 5, 8, 6, 6, 6, 7, 7, 6,
1829 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1830 4, 2, 1, 1, 1, 4, 2, 4, 6, 6,
1831 6, 6, 3, 4, 0, 1, 1, 1, 3, 3,
1832 3, 3, 3, 3, 1, 0, 1, 1, 1, 0,
1833 2, 3, 1, 1, 3, 1, 0, 8, 1, 1,
1834 3, 1, 1, 3, 0, 1, 1, 0, 4, 0,
1835 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1836 1, 5, 1, 1, 1, 1, 2, 2, 1, 2,
1837 2, 0, 1, 1, 1, 2, 2, 3, 9, 9,
1838 8, 14, 1, 1, 6, 5, 2, 6, 7, 1,
1839 3, 1, 0, 2, 1, 5, 5, 5, 6, 6,
1840 4, 4, 6, 4, 4, 6, 6, 2, 7, 1,
1841 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
1845 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1846 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1847 means the default is an error. */
1848 static const unsigned short yydefact[] =
1850 194, 0, 90, 182, 1, 181, 227, 83, 84, 85,
1851 87, 88, 89, 86, 0, 98, 251, 178, 179, 206,
1852 207, 0, 0, 0, 90, 0, 186, 224, 0, 0,
1853 91, 92, 93, 94, 95, 96, 0, 0, 252, 251,
1854 248, 82, 0, 0, 0, 0, 192, 0, 0, 0,
1855 0, 0, 183, 184, 0, 0, 81, 225, 226, 98,
1856 195, 180, 97, 111, 115, 116, 117, 118, 119, 120,
1857 121, 122, 123, 124, 125, 126, 127, 2, 3, 0,
1858 0, 0, 0, 242, 0, 0, 110, 129, 114, 243,
1859 128, 218, 219, 220, 221, 222, 223, 247, 0, 0,
1860 0, 254, 253, 263, 293, 262, 249, 250, 0, 0,
1861 0, 0, 205, 193, 187, 185, 175, 176, 0, 0,
1862 0, 0, 228, 130, 0, 0, 0, 113, 135, 139,
1863 0, 0, 144, 138, 256, 0, 255, 0, 0, 72,
1864 76, 71, 75, 70, 74, 69, 73, 77, 78, 0,
1865 292, 274, 0, 98, 6, 7, 8, 9, 10, 11,
1866 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1867 22, 23, 24, 25, 0, 0, 0, 0, 0, 0,
1868 0, 0, 52, 53, 54, 55, 0, 0, 0, 0,
1869 68, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1870 65, 66, 67, 0, 0, 0, 0, 0, 98, 266,
1871 0, 289, 200, 197, 196, 198, 199, 201, 204, 0,
1872 106, 106, 115, 116, 117, 118, 119, 120, 121, 122,
1873 123, 124, 125, 0, 0, 0, 0, 106, 106, 0,
1874 0, 0, 0, 0, 134, 216, 143, 141, 0, 231,
1875 232, 233, 236, 237, 238, 234, 235, 229, 0, 0,
1876 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1877 0, 240, 245, 244, 246, 0, 257, 0, 273, 0,
1878 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1879 0, 50, 51, 36, 37, 38, 39, 40, 41, 42,
1880 43, 44, 45, 46, 47, 48, 49, 0, 101, 101,
1881 298, 0, 0, 287, 0, 0, 0, 0, 0, 0,
1882 0, 0, 0, 0, 0, 0, 0, 0, 202, 0,
1883 190, 191, 158, 159, 4, 5, 156, 157, 160, 151,
1884 152, 155, 0, 0, 0, 0, 154, 153, 188, 189,
1885 112, 112, 137, 0, 140, 215, 209, 212, 213, 0,
1886 0, 131, 230, 0, 0, 0, 0, 0, 0, 0,
1887 0, 174, 0, 0, 0, 0, 0, 0, 0, 0,
1888 0, 0, 0, 0, 294, 0, 296, 291, 0, 0,
1889 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1890 0, 0, 0, 203, 0, 0, 108, 106, 146, 0,
1891 0, 150, 0, 147, 132, 133, 136, 208, 210, 0,
1892 104, 142, 0, 0, 0, 291, 0, 0, 0, 0,
1893 0, 239, 0, 0, 0, 0, 0, 0, 0, 0,
1894 0, 0, 0, 0, 0, 0, 301, 0, 0, 0,
1895 283, 284, 0, 0, 0, 0, 0, 280, 281, 0,
1896 299, 0, 103, 109, 107, 145, 148, 149, 214, 211,
1897 105, 99, 0, 0, 0, 0, 0, 0, 0, 0,
1898 173, 0, 0, 0, 0, 0, 0, 0, 272, 0,
1899 0, 101, 102, 101, 269, 290, 0, 0, 0, 0,
1900 0, 275, 276, 277, 272, 0, 0, 217, 241, 0,
1901 0, 162, 0, 0, 0, 0, 0, 0, 0, 0,
1902 0, 0, 0, 271, 0, 278, 279, 0, 295, 297,
1903 0, 0, 0, 282, 285, 286, 0, 300, 100, 0,
1904 0, 0, 170, 0, 0, 164, 165, 166, 169, 161,
1905 0, 260, 0, 0, 0, 270, 267, 0, 288, 167,
1906 168, 0, 0, 0, 258, 0, 259, 0, 0, 268,
1907 163, 171, 172, 0, 0, 0, 0, 0, 0, 265,
1911 /* YYDEFGOTO[NTERM-NUM]. */
1912 static const short yydefgoto[] =
1914 -1, 83, 336, 266, 267, 268, 290, 307, 269, 270,
1915 233, 234, 149, 235, 24, 15, 36, 507, 384, 406,
1916 471, 330, 407, 84, 85, 236, 87, 88, 130, 248,
1917 371, 271, 372, 118, 1, 2, 55, 3, 61, 215,
1918 46, 113, 219, 89, 418, 357, 358, 359, 37, 93,
1919 16, 96, 17, 59, 18, 27, 363, 272, 90, 274,
1920 494, 39, 40, 41, 105, 106, 553, 107, 313, 523,
1921 524, 208, 209, 446, 210, 211
1924 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1926 #define YYPACT_NINF -537
1927 static const short yypact[] =
1929 -537, 75, 61, 1145, -537, -537, -537, -537, -537, -537,
1930 -537, -537, -537, -537, 18, 180, 55, -537, -537, -537,
1931 -537, -28, -61, 33, 130, -40, -537, 102, 87, 117,
1932 -537, -537, -537, -537, -537, -537, 838, -24, -537, -15,
1933 -537, 48, -11, -2, 6, 12, -537, 11, 87, 838,
1934 -9, -9, -537, -537, -9, -9, -537, -537, -537, 180,
1935 -537, -537, -537, 32, -537, -537, -537, -537, -537, -537,
1936 -537, -537, -537, -537, -537, -537, -537, -537, -537, 164,
1937 171, -6, 512, -537, 135, 41, -537, -537, -103, -537,
1938 -537, -537, -537, -537, -537, -537, -537, -537, 883, 45,
1939 192, -537, -537, -537, 1324, -537, -537, -537, 175, 126,
1940 190, 188, 203, -537, -537, -537, -537, -537, 911, 911,
1941 957, 911, -537, -537, 81, 97, 561, -537, -537, -103,
1942 -109, 121, 641, -537, 32, 1140, -537, 1140, 1140, -537,
1943 -537, -537, -537, -537, -537, -537, -537, -537, -537, 1140,
1944 -537, -537, 219, 180, -537, -537, -537, -537, -537, -537,
1945 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1946 -537, -537, -537, -537, 10, 112, 911, 911, 911, 911,
1947 911, 911, -537, -537, -537, -537, 911, 911, 911, 911,
1948 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1949 -537, -537, -537, 911, 911, 911, 911, 911, 180, -537,
1950 59, -537, -537, -537, -537, -537, -537, -537, -537, -71,
1951 129, 129, 167, 193, 195, 218, 222, 224, 234, 243,
1952 250, 261, 263, 252, 252, 264, 993, 129, 129, 911,
1953 911, 127, -97, 911, -537, 680, -537, 136, 137, -537,
1954 -537, -537, -537, -537, -537, -537, -537, 229, 10, 112,
1955 140, 141, 144, 145, 146, 957, 147, 148, 150, 154,
1956 155, -537, -537, -537, -537, 158, -537, 160, -537, 838,
1957 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1958 911, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1959 -537, -537, -537, -537, -537, -537, -537, 911, 163, 165,
1960 -537, 1140, 162, 169, 170, 172, 173, 174, 176, 1140,
1961 1140, 1140, 177, 276, 838, 911, 911, 288, -537, -8,
1962 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1963 -537, -537, 724, 957, 590, 292, -537, -537, -537, -537,
1964 -106, -104, -537, 179, -103, -537, 135, -537, 178, 181,
1965 752, -537, -537, 296, 183, 187, 957, 957, 957, 957,
1966 957, -537, -131, 957, 957, 957, 957, 957, 315, 316,
1967 1140, 1140, 1140, 1, -537, 7, -537, 191, 1140, 186,
1968 911, 911, 911, 911, 911, 194, 197, 201, 911, 911,
1969 1140, 1140, 202, -537, 304, 326, -537, 129, -537, -60,
1970 -78, -537, -74, -537, -537, -537, -537, -537, -537, 799,
1971 309, -537, 208, 957, 957, 191, 210, 213, 223, 225,
1972 957, -537, 230, 231, 235, 236, 308, 1140, 1140, 227,
1973 237, 238, 1140, 357, 1140, 911, -537, 239, 1140, 241,
1974 -537, -537, 242, 244, 1140, 1140, 1140, -537, -537, 248,
1975 -537, 911, -537, -537, -537, -537, -537, -537, -537, -537,
1976 -537, 338, 366, 246, 251, 249, 957, 957, 957, 957,
1977 -537, 957, 957, 957, 957, 911, 253, 258, 911, 1140,
1978 1140, 254, -537, 254, -537, 255, 1140, 256, 911, 911,
1979 911, -537, -537, -537, 911, 1140, 390, -537, -537, 957,
1980 957, -537, 265, 260, 266, 267, 268, 272, 274, 275,
1981 277, 400, 29, 255, 280, -537, -537, 363, -537, -537,
1982 911, 278, 1140, -537, -537, -537, 282, -537, -537, 283,
1983 287, 957, -537, 957, 957, -537, -537, -537, -537, -537,
1984 1140, -537, 1229, 60, 381, -537, -537, 286, -537, -537,
1985 -537, 290, 293, 294, -537, 270, -537, 1229, 435, -537,
1986 -537, -537, -537, 436, 302, 1140, 1140, 441, 196, -537,
1987 1140, 442, -537, 1140, -537
1990 /* YYPGOTO[NTERM-NUM]. */
1991 static const short yypgoto[] =
1993 -537, -537, 226, 361, 362, 365, 209, 214, 368, 370,
1994 -99, -98, -507, -537, 420, 452, -134, -537, -303, 57,
1995 -537, -216, -537, -45, -537, -36, -537, -79, -30, -537,
1996 -111, 245, -210, 104, -537, -537, -537, -537, 431, -537,
1997 -537, -537, -537, 4, -537, 63, -537, -537, 421, -537,
1998 -537, -537, -537, -537, 480, -537, -537, -536, -105, 58,
1999 -88, -537, 445, -537, -93, -537, -537, -537, -537, 42,
2000 -18, -537, -537, 64, -537, -537
2003 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2004 positive, shift that token. If negative, reduce the rule which
2005 number is the opposite. If zero, do what YYDEFACT says.
2006 If YYTABLE_NINF, parse error. */
2007 #define YYTABLE_NINF -178
2008 static const short yytable[] =
2010 86, 147, 148, 129, 115, 331, 386, 25, 91, 237,
2011 136, 442, 125, 86, 38, 552, 565, 444, 94, 279,
2012 430, 348, 349, 42, 43, 44, 116, 117, 431, 404,
2013 273, 574, 273, 273, 139, 140, 141, 142, 143, 144,
2014 145, 146, 243, 45, 273, 25, 567, 129, 405, 137,
2015 -112, 414, 244, 129, 243, 415, 133, 443, 133, 133,
2016 138, -177, 135, 443, 353, 139, 140, 141, 142, 143,
2017 144, 145, 146, 430, 324, 4, 19, 430, 20, 28,
2018 327, 466, 220, 221, 38, 238, 328, 467, 131, 47,
2019 310, 430, 5, 314, 48, 6, 242, 465, 315, 316,
2020 317, 318, 247, 7, 8, 9, 10, 11, 12, 13,
2021 56, 280, 281, 282, 283, 284, 285, 60, 322, 323,
2022 98, 99, 100, 14, 101, 102, 103, 286, 287, 288,
2023 289, 347, 409, 410, 412, 62, 92, 291, 292, 108,
2024 308, 309, 135, 311, 312, 135, 95, 57, 109, 58,
2025 135, 135, 135, 135, 126, 119, 110, 49, 120, 121,
2026 350, 351, 111, 19, 354, 20, 112, 319, 320, 321,
2027 135, 135, 7, 8, 9, 50, 11, 51, 13, 52,
2028 213, 214, 123, 325, 326, -113, 551, 53, 528, 124,
2029 529, 464, 332, 333, 132, 275, 276, 139, 140, 141,
2030 142, 143, 144, 145, 146, 212, 273, 277, 216, 356,
2031 -72, -72, -76, -76, 273, 273, 273, 566, 217, 293,
2032 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
2033 304, 305, 306, 218, 380, -71, -71, 239, 402, -75,
2034 -75, -70, -70, 86, 29, 30, 31, 32, 33, 34,
2035 35, -74, -74, 240, 381, 425, 426, 427, 428, 429,
2036 -69, -69, 432, 433, 434, 435, 436, -73, -73, 334,
2037 335, 382, 101, 102, 245, 273, 273, 273, 278, 400,
2038 329, 354, -79, 273, -80, 338, 352, 360, 86, 401,
2039 135, 361, 362, 366, 367, 273, 273, 368, 369, 370,
2040 373, 374, 449, 375, 451, 452, 453, 376, 377, 378,
2041 457, 379, 473, 474, 383, 399, 385, 388, 403, 480,
2042 389, 390, 413, 391, 392, 393, 422, 394, 398, 419,
2043 437, 438, 273, 273, 462, 420, 423, 273, 416, 273,
2044 424, 448, 445, 273, 463, 454, 404, 485, 455, 273,
2045 273, 273, 456, 461, 135, 450, 135, 135, 135, 472,
2046 417, 476, 135, 458, 477, 512, 513, 514, 515, 387,
2047 516, 517, 518, 519, 478, 492, 479, 395, 396, 397,
2048 488, 481, 482, 356, 273, 273, 483, 484, 489, 490,
2049 496, 273, 498, 499, 506, 500, 508, 509, 539, 540,
2050 273, 504, 510, 511, 521, 527, 530, 532, 538, 135,
2051 533, 534, 535, 522, 542, 550, 541, 543, 544, 443,
2052 568, 573, 545, 147, 148, 505, 546, 273, 547, 548,
2053 561, 549, 562, 563, 554, 556, 558, 559, 439, 440,
2054 441, 560, 555, 569, 570, 273, 447, 571, 572, 520,
2055 575, 576, 135, 577, 147, 148, 580, 583, 459, 460,
2056 337, 104, 135, 135, 135, 203, 204, 364, 135, 205,
2057 273, 273, 206, 365, 207, 273, 54, 470, 273, 114,
2058 122, 346, 469, 26, 97, 581, 536, 495, 0, 475,
2059 0, 0, 0, 0, 135, 486, 487, 0, 0, 0,
2060 491, 0, 493, 0, 0, 0, 497, 0, 0, 0,
2061 0, 0, 501, 502, 503, 127, 64, 65, 66, 67,
2062 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2063 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2064 19, 0, 20, 0, 0, 0, 0, 525, 526, 0,
2065 0, 0, 0, 0, 531, 0, 0, 0, 0, 0,
2066 0, 0, 0, 537, 127, 64, 65, 66, 67, 68,
2067 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2068 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2069 557, 20, 0, 127, 222, 223, 224, 225, 226, 227,
2070 228, 229, 230, 231, 232, 75, 76, 0, 564, 77,
2071 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2072 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2073 0, 0, 0, 578, 579, 0, 0, 0, 582, 0,
2074 0, 584, 0, 0, 127, 64, 65, 66, 67, 68,
2075 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2076 77, 78, 0, 0, 79, 0, 0, 80, 0, 19,
2077 81, 20, 82, 128, 0, 0, 0, 0, 0, 0,
2078 0, 246, 0, 127, 64, 65, 66, 67, 68, 69,
2079 70, 71, 72, 73, 74, 75, 76, 0, 0, 77,
2080 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2081 20, 0, 0, 79, 0, 0, 80, 0, 0, 81,
2082 355, 82, 241, 0, 0, 0, 0, 127, 222, 223,
2083 224, 225, 226, 227, 228, 229, 230, 231, 232, 75,
2084 76, 0, 79, 77, 78, 80, 0, 0, 81, 0,
2085 82, 411, 19, 0, 20, 127, 64, 65, 66, 67,
2086 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2087 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2088 19, 0, 20, 0, 0, 0, 0, 0, 0, 0,
2089 0, 0, 421, 79, 0, 0, 80, 0, 0, 81,
2090 0, 82, 127, 64, 65, 66, 67, 68, 69, 70,
2091 71, 72, 73, 74, 75, 76, 0, 0, 77, 78,
2092 0, 0, 0, 0, 0, 0, 0, 19, 0, 20,
2093 0, 0, 79, 0, 0, 80, 0, 0, 81, 468,
2094 82, 63, 64, 65, 66, 67, 68, 69, 70, 71,
2095 72, 73, 74, 75, 76, 0, 0, 77, 78, 0,
2096 0, 0, 0, 0, 0, 0, 19, 0, 20, 0,
2097 0, 0, 0, 0, 0, 0, 79, 0, 0, 80,
2098 0, 408, 81, 0, 82, 0, 134, 64, 65, 66,
2099 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2100 0, 0, 77, 78, 79, 0, 0, 80, 0, 0,
2101 81, 19, 82, 20, 127, 64, 65, 66, 67, 68,
2102 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2103 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2104 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
2105 0, 79, 0, 0, 80, 0, 0, 81, 0, 82,
2106 127, 222, 223, 224, 225, 226, 227, 228, 229, 230,
2107 231, 232, 75, 76, 0, 0, 77, 78, 0, 0,
2108 0, 0, 0, 0, 0, 19, 0, 20, 0, 0,
2109 79, 0, 0, 80, 0, 0, 81, 0, 82, 0,
2110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2111 0, 0, 77, 78, 0, 339, 340, 341, 0, 0,
2112 0, 19, 0, 20, 0, 0, 0, 0, 0, 0,
2113 0, 0, 0, 0, 0, 79, 0, 0, 80, 0,
2114 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
2115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 79, 0, 0, 80, 0, 0, 81,
2117 0, 82, 154, 155, 156, 157, 158, 159, 160, 161,
2118 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
2119 172, 173, 258, 259, 0, 0, 0, 0, 0, 0,
2120 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,
2121 0, 0, 80, 0, 0, 81, 0, 82, 0, 260,
2122 0, 261, 182, 183, 184, 185, 0, 262, 263, 264,
2123 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
2124 200, 201, 202, 0, 0, 0, 0, 0, 342, 0,
2125 0, 343, 0, 344, 0, 0, 345, 249, 250, 77,
2126 78, 251, 252, 253, 254, 255, 256, 0, 19, 0,
2127 20, 0, -82, 19, 0, 20, 0, 0, 0, 6,
2128 -82, -82, 0, 0, 0, 0, 0, -82, -82, -82,
2129 -82, -82, -82, -82, -82, 21, 0, 0, 0, 0,
2130 0, 257, -82, 22, 0, 0, 0, 23, 0, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 154,
2132 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
2133 165, 166, 167, 168, 169, 170, 171, 172, 173, 258,
2134 259, 0, 0, 0, 0, 0, 249, 250, 0, 0,
2135 251, 252, 253, 254, 255, 256, 0, 0, 0, 0,
2136 0, 0, 0, 0, 0, 0, 260, 0, 261, 182,
2137 183, 184, 185, 0, 262, 263, 264, 190, 191, 192,
2138 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
2139 257, 0, 0, 0, 0, 0, 0, 0, 265, 0,
2140 0, 0, 0, 0, 0, 0, 0, 0, 154, 155,
2141 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2142 166, 167, 168, 169, 170, 171, 172, 173, 258, 259,
2143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2145 0, 0, 0, 0, 0, 260, 0, 261, 182, 183,
2146 184, 185, 150, 262, 263, 264, 190, 191, 192, 193,
2147 194, 195, 196, 197, 198, 199, 200, 201, 202, 0,
2148 0, 0, 0, 151, 152, 0, 0, 265, 0, 0,
2149 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
2150 0, 0, 0, 154, 155, 156, 157, 158, 159, 160,
2151 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
2152 171, 172, 173, 174, 175, 0, 0, 0, 0, 0,
2153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0, 0, 0, 0, 0, 176, 177, 178, 0, 0,
2155 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2156 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2160 static const short yycheck[] =
2162 36, 100, 100, 82, 49, 221, 309, 3, 32, 120,
2163 98, 10, 18, 49, 29, 522, 552, 10, 33, 153,
2164 151, 237, 238, 51, 52, 53, 35, 36, 159, 37,
2165 135, 567, 137, 138, 5, 6, 7, 8, 9, 10,
2166 11, 12, 151, 71, 149, 41, 553, 126, 56, 4,
2167 153, 157, 161, 132, 151, 159, 162, 56, 162, 162,
2168 15, 0, 98, 56, 161, 5, 6, 7, 8, 9,
2169 10, 11, 12, 151, 208, 0, 28, 151, 30, 61,
2170 151, 159, 118, 119, 29, 121, 157, 161, 84, 150,
2171 178, 151, 31, 181, 61, 34, 126, 157, 186, 187,
2172 188, 189, 132, 42, 43, 44, 45, 46, 47, 48,
2173 150, 101, 102, 103, 104, 105, 106, 30, 206, 207,
2174 72, 73, 74, 62, 76, 77, 78, 117, 118, 119,
2175 120, 236, 342, 343, 344, 18, 160, 25, 26, 150,
2176 176, 177, 178, 179, 180, 181, 161, 45, 150, 47,
2177 186, 187, 188, 189, 160, 51, 150, 27, 54, 55,
2178 239, 240, 150, 28, 243, 30, 155, 203, 204, 205,
2179 206, 207, 42, 43, 44, 45, 46, 47, 48, 49,
2180 54, 55, 18, 124, 125, 153, 157, 57, 491, 18,
2181 493, 407, 25, 26, 153, 137, 138, 5, 6, 7,
2182 8, 9, 10, 11, 12, 30, 311, 149, 18, 245,
2183 17, 18, 17, 18, 319, 320, 321, 157, 30, 107,
2184 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2185 118, 119, 120, 30, 279, 17, 18, 156, 326, 17,
2186 18, 17, 18, 279, 64, 65, 66, 67, 68, 69,
2187 70, 17, 18, 156, 290, 366, 367, 368, 369, 370,
2188 17, 18, 373, 374, 375, 376, 377, 17, 18, 17,
2189 18, 307, 76, 77, 153, 380, 381, 382, 59, 324,
2190 151, 360, 21, 388, 21, 21, 159, 151, 324, 325,
2191 326, 154, 63, 153, 153, 400, 401, 153, 153, 153,
2192 153, 153, 390, 153, 392, 393, 394, 153, 153, 151,
2193 398, 151, 423, 424, 151, 39, 151, 155, 30, 430,
2194 151, 151, 30, 151, 151, 151, 30, 151, 151, 151,
2195 15, 15, 437, 438, 30, 154, 153, 442, 159, 444,
2196 153, 155, 151, 448, 18, 151, 37, 39, 151, 454,
2197 455, 456, 151, 151, 390, 391, 392, 393, 394, 151,
2198 356, 151, 398, 399, 151, 476, 477, 478, 479, 311,
2199 481, 482, 483, 484, 151, 18, 151, 319, 320, 321,
2200 153, 151, 151, 419, 489, 490, 151, 151, 151, 151,
2201 151, 496, 151, 151, 56, 151, 30, 151, 509, 510,
2202 505, 153, 151, 154, 151, 151, 151, 151, 18, 445,
2203 498, 499, 500, 155, 154, 15, 151, 151, 151, 56,
2204 39, 151, 154, 522, 522, 461, 154, 532, 154, 154,
2205 541, 154, 543, 544, 154, 157, 154, 154, 380, 381,
2206 382, 154, 530, 157, 154, 550, 388, 154, 154, 485,
2207 15, 15, 488, 151, 553, 553, 15, 15, 400, 401,
2208 234, 41, 498, 499, 500, 104, 104, 258, 504, 104,
2209 575, 576, 104, 259, 104, 580, 24, 420, 583, 48,
2210 59, 236, 419, 3, 39, 578, 504, 445, -1, 425,
2211 -1, -1, -1, -1, 530, 437, 438, -1, -1, -1,
2212 442, -1, 444, -1, -1, -1, 448, -1, -1, -1,
2213 -1, -1, 454, 455, 456, 3, 4, 5, 6, 7,
2214 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2215 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2216 28, -1, 30, -1, -1, -1, -1, 489, 490, -1,
2217 -1, -1, -1, -1, 496, -1, -1, -1, -1, -1,
2218 -1, -1, -1, 505, 3, 4, 5, 6, 7, 8,
2219 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2220 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2221 532, 30, -1, 3, 4, 5, 6, 7, 8, 9,
2222 10, 11, 12, 13, 14, 15, 16, -1, 550, 19,
2223 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2224 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2225 -1, -1, -1, 575, 576, -1, -1, -1, 580, -1,
2226 -1, 583, -1, -1, 3, 4, 5, 6, 7, 8,
2227 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2228 19, 20, -1, -1, 152, -1, -1, 155, -1, 28,
2229 158, 30, 160, 161, -1, -1, -1, -1, -1, -1,
2230 -1, 40, -1, 3, 4, 5, 6, 7, 8, 9,
2231 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
2232 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2233 30, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2234 40, 160, 161, -1, -1, -1, -1, 3, 4, 5,
2235 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2236 16, -1, 152, 19, 20, 155, -1, -1, 158, -1,
2237 160, 161, 28, -1, 30, 3, 4, 5, 6, 7,
2238 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2239 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2240 28, -1, 30, -1, -1, -1, -1, -1, -1, -1,
2241 -1, -1, 40, 152, -1, -1, 155, -1, -1, 158,
2242 -1, 160, 3, 4, 5, 6, 7, 8, 9, 10,
2243 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2244 -1, -1, -1, -1, -1, -1, -1, 28, -1, 30,
2245 -1, -1, 152, -1, -1, 155, -1, -1, 158, 40,
2246 160, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2247 12, 13, 14, 15, 16, -1, -1, 19, 20, -1,
2248 -1, -1, -1, -1, -1, -1, 28, -1, 30, -1,
2249 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2250 -1, 157, 158, -1, 160, -1, 3, 4, 5, 6,
2251 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2252 -1, -1, 19, 20, 152, -1, -1, 155, -1, -1,
2253 158, 28, 160, 30, 3, 4, 5, 6, 7, 8,
2254 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2255 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2256 -1, 30, -1, -1, -1, -1, -1, -1, -1, -1,
2257 -1, 152, -1, -1, 155, -1, -1, 158, -1, 160,
2258 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2259 13, 14, 15, 16, -1, -1, 19, 20, -1, -1,
2260 -1, -1, -1, -1, -1, 28, -1, 30, -1, -1,
2261 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
2262 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2263 -1, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2264 -1, 28, -1, 30, -1, -1, -1, -1, -1, -1,
2265 -1, -1, -1, -1, -1, 152, -1, -1, 155, -1,
2266 -1, 158, -1, 160, -1, -1, -1, -1, -1, -1,
2267 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2268 -1, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2269 -1, 160, 79, 80, 81, 82, 83, 84, 85, 86,
2270 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2271 97, 98, 99, 100, -1, -1, -1, -1, -1, -1,
2272 -1, -1, -1, -1, -1, -1, -1, -1, -1, 152,
2273 -1, -1, 155, -1, -1, 158, -1, 160, -1, 126,
2274 -1, 128, 129, 130, 131, 132, -1, 134, 135, 136,
2275 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2276 147, 148, 149, -1, -1, -1, -1, -1, 155, -1,
2277 -1, 158, -1, 160, -1, -1, 163, 17, 18, 19,
2278 20, 21, 22, 23, 24, 25, 26, -1, 28, -1,
2279 30, -1, 27, 28, -1, 30, -1, -1, -1, 34,
2280 35, 36, -1, -1, -1, -1, -1, 42, 43, 44,
2281 45, 46, 47, 48, 49, 50, -1, -1, -1, -1,
2282 -1, 61, 57, 58, -1, -1, -1, 62, -1, -1,
2283 -1, -1, -1, -1, -1, -1, -1, -1, -1, 79,
2284 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2285 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
2286 100, -1, -1, -1, -1, -1, 17, 18, -1, -1,
2287 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
2288 -1, -1, -1, -1, -1, -1, 126, -1, 128, 129,
2289 130, 131, 132, -1, 134, 135, 136, 137, 138, 139,
2290 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
2291 61, -1, -1, -1, -1, -1, -1, -1, 158, -1,
2292 -1, -1, -1, -1, -1, -1, -1, -1, 79, 80,
2293 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2294 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2296 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2297 -1, -1, -1, -1, -1, 126, -1, 128, 129, 130,
2298 131, 132, 38, 134, 135, 136, 137, 138, 139, 140,
2299 141, 142, 143, 144, 145, 146, 147, 148, 149, -1,
2300 -1, -1, -1, 59, 60, -1, -1, 158, -1, -1,
2301 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2302 -1, -1, -1, 79, 80, 81, 82, 83, 84, 85,
2303 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2304 96, 97, 98, 99, 100, -1, -1, -1, -1, -1,
2305 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2306 -1, -1, -1, -1, -1, 121, 122, 123, -1, -1,
2307 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2308 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2312 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2313 symbol of state STATE-NUM. */
2314 static const unsigned char yystos[] =
2316 0, 198, 199, 201, 0, 31, 34, 42, 43, 44,
2317 45, 46, 47, 48, 62, 179, 214, 216, 218, 28,
2318 30, 50, 58, 62, 178, 207, 218, 219, 61, 64,
2319 65, 66, 67, 68, 69, 70, 180, 212, 29, 225,
2320 226, 227, 51, 52, 53, 71, 204, 150, 61, 27,
2321 45, 47, 49, 57, 179, 200, 150, 45, 47, 217,
2322 30, 202, 18, 3, 4, 5, 6, 7, 8, 9,
2323 10, 11, 12, 13, 14, 15, 16, 19, 20, 152,
2324 155, 158, 160, 165, 187, 188, 189, 190, 191, 207,
2325 222, 32, 160, 213, 33, 161, 215, 226, 72, 73,
2326 74, 76, 77, 78, 178, 228, 229, 231, 150, 150,
2327 150, 150, 155, 205, 202, 187, 35, 36, 197, 197,
2328 197, 197, 212, 18, 18, 18, 160, 3, 161, 191,
2329 192, 207, 153, 162, 3, 189, 224, 4, 15, 5,
2330 6, 7, 8, 9, 10, 11, 12, 174, 175, 176,
2331 38, 59, 60, 75, 79, 80, 81, 82, 83, 84,
2332 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2333 95, 96, 97, 98, 99, 100, 121, 122, 123, 126,
2334 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2335 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2336 147, 148, 149, 167, 168, 169, 172, 173, 235, 236,
2337 238, 239, 30, 54, 55, 203, 18, 30, 30, 206,
2338 189, 189, 4, 5, 6, 7, 8, 9, 10, 11,
2339 12, 13, 14, 174, 175, 177, 189, 194, 189, 156,
2340 156, 161, 192, 151, 161, 153, 40, 192, 193, 17,
2341 18, 21, 22, 23, 24, 25, 26, 61, 99, 100,
2342 126, 128, 134, 135, 136, 158, 167, 168, 169, 172,
2343 173, 195, 221, 222, 223, 223, 223, 223, 59, 180,
2344 101, 102, 103, 104, 105, 106, 117, 118, 119, 120,
2345 170, 25, 26, 107, 108, 109, 110, 111, 112, 113,
2346 114, 115, 116, 117, 118, 119, 120, 171, 189, 189,
2347 224, 189, 189, 232, 224, 224, 224, 224, 224, 189,
2348 189, 189, 224, 224, 180, 124, 125, 151, 157, 151,
2349 185, 185, 25, 26, 17, 18, 166, 166, 21, 22,
2350 23, 24, 155, 158, 160, 163, 195, 222, 185, 185,
2351 191, 191, 159, 161, 191, 40, 189, 209, 210, 211,
2352 151, 154, 63, 220, 170, 171, 153, 153, 153, 153,
2353 153, 194, 196, 153, 153, 153, 153, 153, 151, 151,
2354 187, 189, 189, 151, 182, 151, 182, 223, 155, 151,
2355 151, 151, 151, 151, 151, 223, 223, 223, 151, 39,
2356 187, 189, 224, 30, 37, 56, 183, 186, 157, 196,
2357 196, 161, 196, 30, 157, 159, 159, 207, 208, 151,
2358 154, 40, 30, 153, 153, 194, 194, 194, 194, 194,
2359 151, 159, 194, 194, 194, 194, 194, 15, 15, 223,
2360 223, 223, 10, 56, 10, 151, 237, 223, 155, 224,
2361 189, 224, 224, 224, 151, 151, 151, 224, 189, 223,
2362 223, 151, 30, 18, 185, 157, 159, 161, 40, 209,
2363 183, 184, 151, 194, 194, 237, 151, 151, 151, 151,
2364 194, 151, 151, 151, 151, 39, 223, 223, 153, 151,
2365 151, 223, 18, 223, 224, 233, 151, 223, 151, 151,
2366 151, 223, 223, 223, 153, 189, 56, 181, 30, 151,
2367 151, 154, 194, 194, 194, 194, 194, 194, 194, 194,
2368 189, 151, 155, 233, 234, 223, 223, 151, 182, 182,
2369 151, 223, 151, 224, 224, 224, 234, 223, 18, 194,
2370 194, 151, 154, 151, 151, 154, 154, 154, 154, 154,
2371 15, 157, 176, 230, 154, 224, 157, 223, 154, 154,
2372 154, 194, 194, 194, 223, 221, 157, 176, 39, 157,
2373 154, 154, 154, 151, 221, 15, 15, 151, 223, 223,
2374 15, 228, 223, 15, 223
2377 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2378 # define YYSIZE_T __SIZE_TYPE__
2380 #if ! defined (YYSIZE_T) && defined (size_t)
2381 # define YYSIZE_T size_t
2383 #if ! defined (YYSIZE_T)
2384 # if defined (__STDC__) || defined (__cplusplus)
2385 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2386 # define YYSIZE_T size_t
2389 #if ! defined (YYSIZE_T)
2390 # define YYSIZE_T unsigned int
2393 #define yyerrok (yyerrstatus = 0)
2394 #define yyclearin (yychar = YYEMPTY)
2398 #define YYACCEPT goto yyacceptlab
2399 #define YYABORT goto yyabortlab
2400 #define YYERROR goto yyerrlab1
2402 /* Like YYERROR except do call yyerror. This remains here temporarily
2403 to ease the transition to the new meaning of YYERROR, for GCC.
2404 Once GCC version 2 has supplanted version 1, this can go. */
2406 #define YYFAIL goto yyerrlab
2408 #define YYRECOVERING() (!!yyerrstatus)
2410 #define YYBACKUP(Token, Value) \
2412 if (yychar == YYEMPTY && yylen == 1) \
2416 yychar1 = YYTRANSLATE (yychar); \
2422 yyerror ("syntax error: cannot back up"); \
2428 #define YYERRCODE 256
2430 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
2433 #ifndef YYLLOC_DEFAULT
2434 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2435 Current.first_line = Rhs[1].first_line; \
2436 Current.first_column = Rhs[1].first_column; \
2437 Current.last_line = Rhs[N].last_line; \
2438 Current.last_column = Rhs[N].last_column;
2441 /* YYLEX -- calling `yylex' with the right arguments. */
2443 #define YYLEX yylex ()
2445 /* Enable debugging if requested. */
2449 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2450 # define YYFPRINTF fprintf
2453 # define YYDPRINTF(Args) \
2458 # define YYDSYMPRINT(Args) \
2463 /* Nonzero means print parse trace. It is left uninitialized so that
2464 multiple parsers can coexist. */
2466 #else /* !YYDEBUG */
2467 # define YYDPRINTF(Args)
2468 # define YYDSYMPRINT(Args)
2469 #endif /* !YYDEBUG */
2471 /* YYINITDEPTH -- initial size of the parser's stacks. */
2473 # define YYINITDEPTH 200
2476 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2477 if the built-in stack extension method is used).
2479 Do not make this value too large; the results are undefined if
2480 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
2481 evaluated with infinite-precision integer arithmetic. */
2488 # define YYMAXDEPTH 10000
2496 # if defined (__GLIBC__) && defined (_STRING_H)
2497 # define yystrlen strlen
2499 /* Return the length of YYSTR. */
2501 # if defined (__STDC__) || defined (__cplusplus)
2502 yystrlen (const char *yystr)
2508 register const char *yys = yystr;
2510 while (*yys++ != '\0')
2513 return yys - yystr - 1;
2519 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2520 # define yystpcpy stpcpy
2522 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2525 # if defined (__STDC__) || defined (__cplusplus)
2526 yystpcpy (char *yydest, const char *yysrc)
2528 yystpcpy (yydest, yysrc)
2533 register char *yyd = yydest;
2534 register const char *yys = yysrc;
2536 while ((*yyd++ = *yys++) != '\0')
2544 #endif /* !YYERROR_VERBOSE */
2549 /*-----------------------------.
2550 | Print this symbol on YYOUT. |
2551 `-----------------------------*/
2554 #if defined (__STDC__) || defined (__cplusplus)
2555 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
2557 yysymprint (yyout, yytype, yyvalue)
2563 /* Pacify ``unused variable'' warnings. */
2566 if (yytype < YYNTOKENS)
2568 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
2570 YYPRINT (yyout, yytoknum[yytype], yyvalue);
2574 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
2581 YYFPRINTF (yyout, ")");
2583 #endif /* YYDEBUG. */
2586 /*-----------------------------------------------.
2587 | Release the memory associated to this symbol. |
2588 `-----------------------------------------------*/
2591 #if defined (__STDC__) || defined (__cplusplus)
2592 yydestruct (int yytype, YYSTYPE yyvalue)
2594 yydestruct (yytype, yyvalue)
2599 /* Pacify ``unused variable'' warnings. */
2611 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2612 into yyparse. The argument should have type void *.
2613 It should actually point to an object.
2614 Grammar actions can access the variable by casting it
2615 to the proper pointer type. */
2617 #ifdef YYPARSE_PARAM
2618 # if defined (__STDC__) || defined (__cplusplus)
2619 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2620 # define YYPARSE_PARAM_DECL
2622 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
2623 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2625 #else /* !YYPARSE_PARAM */
2626 # define YYPARSE_PARAM_ARG
2627 # define YYPARSE_PARAM_DECL
2628 #endif /* !YYPARSE_PARAM */
2630 /* Prevent warning if -Wstrict-prototypes. */
2632 # ifdef YYPARSE_PARAM
2633 int yyparse (void *);
2640 /* The lookahead symbol. */
2643 /* The semantic value of the lookahead symbol. */
2646 /* Number of parse errors so far. */
2651 yyparse (YYPARSE_PARAM_ARG)
2655 register int yystate;
2658 /* Number of tokens to shift before error messages enabled. */
2660 /* Lookahead token as an internal (translated) token number. */
2663 /* Three stacks and their tools:
2664 `yyss': related to states,
2665 `yyvs': related to semantic values,
2666 `yyls': related to locations.
2668 Refer to the stacks thru separate pointers, to allow yyoverflow
2669 to reallocate them elsewhere. */
2671 /* The state stack. */
2672 short yyssa[YYINITDEPTH];
2673 short *yyss = yyssa;
2674 register short *yyssp;
2676 /* The semantic value stack. */
2677 YYSTYPE yyvsa[YYINITDEPTH];
2678 YYSTYPE *yyvs = yyvsa;
2679 register YYSTYPE *yyvsp;
2683 #define YYPOPSTACK (yyvsp--, yyssp--)
2685 YYSIZE_T yystacksize = YYINITDEPTH;
2687 /* The variables used to return semantic value and location from the
2692 /* When reducing, the number of symbols on the RHS of the reduced
2696 YYDPRINTF ((stderr, "Starting parse\n"));
2701 yychar = YYEMPTY; /* Cause a token to be read. */
2703 /* Initialize stack pointers.
2704 Waste one element of value and location stack
2705 so that they stay on the same level as the state stack.
2706 The wasted elements are never initialized. */
2713 /*------------------------------------------------------------.
2714 | yynewstate -- Push a new state, which is found in yystate. |
2715 `------------------------------------------------------------*/
2717 /* In all cases, when you get here, the value and location stacks
2718 have just been pushed. so pushing a state here evens the stacks.
2725 if (yyssp >= yyss + yystacksize - 1)
2727 /* Get the current used size of the three stacks, in elements. */
2728 YYSIZE_T yysize = yyssp - yyss + 1;
2732 /* Give user a chance to reallocate the stack. Use copies of
2733 these so that the &'s don't force the real ones into
2735 YYSTYPE *yyvs1 = yyvs;
2736 short *yyss1 = yyss;
2739 /* Each stack pointer address is followed by the size of the
2740 data in use in that stack, in bytes. This used to be a
2741 conditional around just the two extra args, but that might
2742 be undefined if yyoverflow is a macro. */
2743 yyoverflow ("parser stack overflow",
2744 &yyss1, yysize * sizeof (*yyssp),
2745 &yyvs1, yysize * sizeof (*yyvsp),
2752 #else /* no yyoverflow */
2753 # ifndef YYSTACK_RELOCATE
2756 /* Extend the stack our own way. */
2757 if (yystacksize >= YYMAXDEPTH)
2760 if (yystacksize > YYMAXDEPTH)
2761 yystacksize = YYMAXDEPTH;
2764 short *yyss1 = yyss;
2765 union yyalloc *yyptr =
2766 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2769 YYSTACK_RELOCATE (yyss);
2770 YYSTACK_RELOCATE (yyvs);
2772 # undef YYSTACK_RELOCATE
2774 YYSTACK_FREE (yyss1);
2777 #endif /* no yyoverflow */
2779 yyssp = yyss + yysize - 1;
2780 yyvsp = yyvs + yysize - 1;
2783 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2784 (unsigned long int) yystacksize));
2786 if (yyssp >= yyss + yystacksize - 1)
2790 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2799 /* Do appropriate processing given the current state. */
2800 /* Read a lookahead token if we need one and don't already have one. */
2803 /* First try to decide what to do without reference to lookahead token. */
2805 yyn = yypact[yystate];
2806 if (yyn == YYPACT_NINF)
2809 /* Not known => get a lookahead token if don't already have one. */
2811 /* yychar is either YYEMPTY or YYEOF
2812 or a valid token in external form. */
2814 if (yychar == YYEMPTY)
2816 YYDPRINTF ((stderr, "Reading a token: "));
2820 /* Convert token to internal form (in yychar1) for indexing tables with. */
2822 if (yychar <= 0) /* This means end of input. */
2825 yychar = YYEOF; /* Don't call YYLEX any more. */
2827 YYDPRINTF ((stderr, "Now at end of input.\n"));
2831 yychar1 = YYTRANSLATE (yychar);
2833 /* We have to keep this `#if YYDEBUG', since we use variables
2834 which are defined only if `YYDEBUG' is set. */
2835 YYDPRINTF ((stderr, "Next token is "));
2836 YYDSYMPRINT ((stderr, yychar1, yylval));
2837 YYDPRINTF ((stderr, "\n"));
2840 /* If the proper action on seeing token YYCHAR1 is to reduce or to
2841 detect an error, take that action. */
2843 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
2848 if (yyn == 0 || yyn == YYTABLE_NINF)
2857 /* Shift the lookahead token. */
2858 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
2859 yychar, yytname[yychar1]));
2861 /* Discard the token being shifted unless it is eof. */
2862 if (yychar != YYEOF)
2868 /* Count tokens shifted since error; after three, turn off error
2877 /*-----------------------------------------------------------.
2878 | yydefault -- do the default action for the current state. |
2879 `-----------------------------------------------------------*/
2881 yyn = yydefact[yystate];
2887 /*-----------------------------.
2888 | yyreduce -- Do a reduction. |
2889 `-----------------------------*/
2891 /* yyn is the number of a rule to reduce with. */
2894 /* If YYLEN is nonzero, implement the default value of the action:
2897 Otherwise, the following line sets YYVAL to garbage.
2898 This behavior is undocumented and Bison
2899 users should not rely upon it. Assigning to YYVAL
2900 unconditionally makes the parser a bit smaller, and it avoids a
2901 GCC warning that YYVAL may be used uninitialized. */
2902 yyval = yyvsp[1-yylen];
2907 /* We have to keep this `#if YYDEBUG', since we use variables which
2908 are defined only if `YYDEBUG' is set. */
2913 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
2914 yyn - 1, yyrline[yyn]);
2916 /* Print the symbols being reduced, and their result. */
2917 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
2918 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2919 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2925 #line 1061 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2927 yyval.String = yyvsp[-1].String;
2932 #line 1064 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2934 yyval.String = new std::string("");
2939 #line 1071 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2940 { yyval.String = new std::string(""); }
2944 #line 1076 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2946 *yyvsp[-1].String += *yyvsp[0].String;
2947 delete yyvsp[0].String;
2948 yyval.String = yyvsp[-1].String;
2953 #line 1081 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2954 { yyval.String = new std::string(""); }
2958 #line 1086 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2959 { yyval.String = new std::string(); }
2963 #line 1087 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2964 { *yyvsp[-1].String += " " + *yyvsp[0].String; delete yyvsp[0].String; yyval.String = yyvsp[-1].String; }
2968 #line 1090 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2969 { yyval.String = new std::string(); }
2973 #line 1091 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2975 yyvsp[-1].String->insert(0, ", ");
2976 *yyvsp[-1].String += " " + *yyvsp[0].String;
2977 delete yyvsp[0].String;
2978 yyval.String = yyvsp[-1].String;
2983 #line 1099 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2985 *yyvsp[-1].String += " " + *yyvsp[0].String;
2986 delete yyvsp[0].String;
2987 yyval.String = yyvsp[-1].String;
2992 #line 1105 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2993 { yyval.String = new std::string(); }
2997 #line 1109 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2998 { yyval.String = new std::string(); }
3002 #line 1110 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3004 yyvsp[-1].String->insert(0, ", ");
3005 if (!yyvsp[0].String->empty())
3006 *yyvsp[-1].String += " " + *yyvsp[0].String;
3007 delete yyvsp[0].String;
3008 yyval.String = yyvsp[-1].String;
3013 #line 1120 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3015 *yyvsp[-1].String += " " + *yyvsp[0].String;
3016 delete yyvsp[0].String;
3017 yyval.String = yyvsp[-1].String;
3022 #line 1142 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3024 yyval.Ty = Type::get(*yyvsp[0].String, OpaqueTy);
3029 #line 1145 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3031 yyval.Ty = Type::get(*yyvsp[0].String, UnresolvedTy);
3036 #line 1148 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3038 yyval.Ty = yyvsp[0].Ty;
3043 #line 1151 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3044 { // Type UpReference
3045 yyvsp[0].String->insert(0, "\\");
3046 yyval.Ty = Type::get(*yyvsp[0].String, UpRefTy);
3051 #line 1155 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3052 { // Function derived type?
3053 std::string newTy( yyvsp[-3].Ty->getNewTy() + "(");
3054 for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
3057 if ((*yyvsp[-1].TypeVec)[i]->isVoid())
3060 newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
3063 yyval.Ty = Type::get(newTy, yyvsp[-3].Ty, yyvsp[-1].TypeVec);
3068 #line 1168 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3069 { // Sized array type?
3070 uint64_t elems = atoi(yyvsp[-3].String->c_str());
3071 yyvsp[-3].String->insert(0,"[ ");
3072 *yyvsp[-3].String += " x " + yyvsp[-1].Ty->getNewTy() + " ]";
3073 yyval.Ty = Type::get(*yyvsp[-3].String, ArrayTy, yyvsp[-1].Ty, elems);
3078 #line 1174 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3079 { // Packed array type?
3080 uint64_t elems = atoi(yyvsp[-3].String->c_str());
3081 yyvsp[-3].String->insert(0,"< ");
3082 *yyvsp[-3].String += " x " + yyvsp[-1].Ty->getNewTy() + " >";
3083 yyval.Ty = Type::get(*yyvsp[-3].String, PackedTy, yyvsp[-1].Ty, elems);
3088 #line 1180 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3089 { // Structure type?
3090 std::string newTy("{");
3091 for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
3094 newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
3097 yyval.Ty = Type::get(newTy, StructTy, yyvsp[-1].TypeVec);
3102 #line 1190 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3103 { // Empty structure type?
3104 yyval.Ty = Type::get("{}", StructTy, new TypeList());
3109 #line 1193 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3110 { // Packed Structure type?
3111 std::string newTy("<{");
3112 for (unsigned i = 0; i < yyvsp[-2].TypeVec->size(); ++i) {
3115 newTy += (*yyvsp[-2].TypeVec)[i]->getNewTy();
3118 yyval.Ty = Type::get(newTy, PackedStructTy, yyvsp[-2].TypeVec);
3123 #line 1203 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3124 { // Empty packed structure type?
3125 yyval.Ty = Type::get("<{}>", PackedStructTy, new TypeList());
3130 #line 1206 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3132 yyval.Ty = yyvsp[-1].Ty->getPointerType();
3137 #line 1214 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3139 yyval.TypeVec = new TypeList();
3140 yyval.TypeVec->push_back(yyvsp[0].Ty);
3145 #line 1218 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3147 yyval.TypeVec = yyvsp[-2].TypeVec;
3148 yyval.TypeVec->push_back(yyvsp[0].Ty);
3153 #line 1226 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3155 yyval.TypeVec = yyvsp[-2].TypeVec;
3156 yyval.TypeVec->push_back(Type::get("void",VoidTy));
3157 delete yyvsp[0].String;
3162 #line 1231 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3164 yyval.TypeVec = new TypeList();
3165 yyval.TypeVec->push_back(Type::get("void",VoidTy));
3166 delete yyvsp[0].String;
3171 #line 1236 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3173 yyval.TypeVec = new TypeList();
3178 #line 1246 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3179 { // Nonempty unsized arr
3180 yyval.Const = new Constant;
3181 yyval.Const->type = yyvsp[-3].Ty;
3182 yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3183 *yyval.Const->cnst += " [ " + *yyvsp[-1].String + " ]";
3184 delete yyvsp[-1].String;
3189 #line 1253 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3191 yyval.Const = new Constant;
3192 yyval.Const->type = yyvsp[-2].Ty;
3193 yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3194 *yyval.Const->cnst += "[ ]";
3199 #line 1259 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3201 yyval.Const = new Constant;
3202 yyval.Const->type = yyvsp[-2].Ty;
3203 yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3204 *yyval.Const->cnst += " c" + *yyvsp[0].String;
3205 delete yyvsp[0].String;
3210 #line 1266 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3211 { // Nonempty unsized arr
3212 yyval.Const = new Constant;
3213 yyval.Const->type = yyvsp[-3].Ty;
3214 yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3215 *yyval.Const->cnst += " < " + *yyvsp[-1].String + " >";
3216 delete yyvsp[-1].String;
3221 #line 1273 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3223 yyval.Const = new Constant;
3224 yyval.Const->type = yyvsp[-3].Ty;
3225 yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3226 *yyval.Const->cnst += " { " + *yyvsp[-1].String + " }";
3227 delete yyvsp[-1].String;
3232 #line 1280 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3234 yyval.Const = new Constant;
3235 yyval.Const->type = yyvsp[-2].Ty;
3236 yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3237 *yyval.Const->cnst += " {}";
3242 #line 1286 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3244 yyval.Const = new Constant;
3245 yyval.Const->type = yyvsp[-1].Ty;
3246 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3247 *yyval.Const->cnst += " " + *yyvsp[0].String;
3248 delete yyvsp[0].String;
3253 #line 1293 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3255 yyval.Const = new Constant;
3256 yyval.Const->type = yyvsp[-1].Ty;
3257 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3258 *yyval.Const->cnst += " " + *yyvsp[0].String;
3259 delete yyvsp[0].String;
3264 #line 1300 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3266 yyval.Const = new Constant;
3267 std::string Name = getUniqueName(yyvsp[0].String, yyvsp[-1].Ty->resolve(), true);
3268 yyval.Const->type = yyvsp[-1].Ty;
3269 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3270 *yyval.Const->cnst += " " + Name;
3271 delete yyvsp[0].String;
3276 #line 1308 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3278 yyval.Const = new Constant;
3279 yyval.Const->type = yyvsp[-1].Ty;
3280 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3281 *yyval.Const->cnst += " " + *yyvsp[0].String;
3282 delete yyvsp[0].String;
3287 #line 1315 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3289 yyval.Const = new Constant;
3290 yyval.Const->type = yyvsp[-1].Ty;
3291 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3292 *yyval.Const->cnst += " " + *yyvsp[0].String;
3293 delete yyvsp[0].String;
3298 #line 1322 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3299 { // integral constants
3300 yyval.Const = new Constant;
3301 yyval.Const->type = yyvsp[-1].Ty;
3302 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3303 *yyval.Const->cnst += " " + *yyvsp[0].String;
3304 delete yyvsp[0].String;
3309 #line 1329 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3310 { // integral constants
3311 yyval.Const = new Constant;
3312 yyval.Const->type = yyvsp[-1].Ty;
3313 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3314 *yyval.Const->cnst += " " + *yyvsp[0].String;
3315 delete yyvsp[0].String;
3320 #line 1336 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3321 { // Boolean constants
3322 yyval.Const = new Constant;
3323 yyval.Const->type = yyvsp[-1].Ty;
3324 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3325 *yyval.Const->cnst += " " + *yyvsp[0].String;
3326 delete yyvsp[0].String;
3331 #line 1343 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3332 { // Boolean constants
3333 yyval.Const = new Constant;
3334 yyval.Const->type = yyvsp[-1].Ty;
3335 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3336 *yyval.Const->cnst += " " + *yyvsp[0].String;
3337 delete yyvsp[0].String;
3342 #line 1350 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3343 { // Float & Double constants
3344 yyval.Const = new Constant;
3345 yyval.Const->type = yyvsp[-1].Ty;
3346 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3347 *yyval.Const->cnst += " " + *yyvsp[0].String;
3348 delete yyvsp[0].String;
3353 #line 1358 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3355 std::string source = *yyvsp[-3].Const->cnst;
3356 const Type* SrcTy = yyvsp[-3].Const->type->resolve();
3357 const Type* DstTy = yyvsp[-1].Ty->resolve();
3358 if (*yyvsp[-5].String == "cast") {
3359 // Call getCastUpgrade to upgrade the old cast
3360 yyval.String = new std::string(getCastUpgrade(source, SrcTy, DstTy, true));
3362 // Nothing to upgrade, just create the cast constant expr
3363 yyval.String = new std::string(*yyvsp[-5].String);
3364 *yyval.String += "( " + source + " to " + yyvsp[-1].Ty->getNewTy() + ")";
3366 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-2].String;
3371 #line 1372 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3373 *yyvsp[-4].String += "(" + *yyvsp[-2].Const->cnst;
3374 for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
3375 Value* V = (*yyvsp[-1].ValList)[i];
3376 *yyvsp[-4].String += ", " + *V->val;
3379 *yyvsp[-4].String += ")";
3380 yyval.String = yyvsp[-4].String;
3381 delete yyvsp[-2].Const;
3382 delete yyvsp[-1].ValList;
3387 #line 1384 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3389 *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3390 delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3391 yyval.String = yyvsp[-7].String;
3396 #line 1389 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3398 const char* op = getDivRemOpcode(*yyvsp[-5].String, yyvsp[-3].Const->type);
3399 yyval.String = new std::string(op);
3400 *yyval.String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3401 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3406 #line 1395 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3408 *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3409 delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3410 yyval.String = yyvsp[-5].String;
3415 #line 1400 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3417 *yyvsp[-5].String = getCompareOp(*yyvsp[-5].String, yyvsp[-3].Const->type);
3418 *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3419 delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3420 yyval.String = yyvsp[-5].String;
3425 #line 1406 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3427 *yyvsp[-6].String += " " + *yyvsp[-5].String + " (" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3428 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3429 yyval.String = yyvsp[-6].String;
3434 #line 1411 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3436 *yyvsp[-6].String += " " + *yyvsp[-5].String + " (" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3437 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3438 yyval.String = yyvsp[-6].String;
3443 #line 1416 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3445 const char* shiftop = yyvsp[-5].String->c_str();
3446 if (*yyvsp[-5].String == "shr")
3447 shiftop = (yyvsp[-3].Const->type->isUnsigned()) ? "lshr" : "ashr";
3448 yyval.String = new std::string(shiftop);
3449 *yyval.String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3450 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3455 #line 1424 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3457 *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3458 delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3459 yyval.String = yyvsp[-5].String;
3464 #line 1429 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3466 *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3467 delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3468 yyval.String = yyvsp[-7].String;
3473 #line 1434 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3475 *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3476 delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3477 yyval.String = yyvsp[-7].String;
3482 #line 1444 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3484 *yyvsp[-2].String += ", " + *yyvsp[0].Const->cnst;
3485 delete yyvsp[0].Const;
3486 yyval.String = yyvsp[-2].String;
3491 #line 1449 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3492 { yyval.String = new std::string(*yyvsp[0].Const->cnst); delete yyvsp[0].Const; }
3496 #line 1464 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3502 #line 1469 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3509 #line 1472 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3511 *O << *yyvsp[0].String << '\n';
3512 delete yyvsp[0].String;
3518 #line 1477 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3520 *O << "module asm " << ' ' << *yyvsp[0].String << '\n';
3526 #line 1481 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3528 *O << "implementation\n";
3534 #line 1485 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3535 { yyval.String = 0; }
3539 #line 1488 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3540 { yyval.String = yyvsp[0].String; *yyval.String = "external"; }
3544 #line 1491 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3546 Type::EnumeratedTypes.push_back(yyvsp[0].Ty);
3547 if (!yyvsp[-2].String->empty()) {
3548 Type::NamedTypes[*yyvsp[-2].String] = yyvsp[0].Ty;
3549 *O << *yyvsp[-2].String << " = ";
3551 *O << "type " << yyvsp[0].Ty->getNewTy() << '\n';
3552 delete yyvsp[-2].String; delete yyvsp[-1].String;
3558 #line 1501 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3559 { // Function prototypes can be in const pool
3560 *O << *yyvsp[0].String << '\n';
3561 delete yyvsp[0].String;
3567 #line 1506 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3568 { // Asm blocks can be in the const pool
3569 *O << *yyvsp[-2].String << ' ' << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3570 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3576 #line 1511 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3578 if (!yyvsp[-4].String->empty()) {
3579 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String, yyvsp[-1].Const->type->getPointerType(),
3580 *yyvsp[-2].String == "constant");
3581 *O << Name << " = ";
3583 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << *yyvsp[-1].Const->cnst << ' ' << *yyvsp[0].String << '\n';
3584 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3590 #line 1521 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3592 if (!yyvsp[-4].String->empty()) {
3593 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3594 *yyvsp[-2].String == "constant");
3595 *O << Name << " = ";
3597 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3598 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3604 #line 1531 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3606 if (!yyvsp[-4].String->empty()) {
3607 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3608 *yyvsp[-2].String == "constant");
3609 *O << Name << " = ";
3611 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3612 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3618 #line 1541 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3620 if (!yyvsp[-4].String->empty()) {
3621 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3622 *yyvsp[-2].String == "constant");
3623 *O << Name << " = ";
3625 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3626 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3632 #line 1551 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3634 *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3635 delete yyvsp[-1].String; delete yyvsp[0].String;
3641 #line 1556 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3643 *O << *yyvsp[-2].String << " = " << *yyvsp[0].String << '\n';
3644 delete yyvsp[-2].String; delete yyvsp[0].String;
3650 #line 1561 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3657 #line 1571 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3659 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3660 delete yyvsp[0].String;
3661 yyval.String = yyvsp[-2].String;
3666 #line 1576 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3668 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3669 if (*yyvsp[0].String == "64")
3671 delete yyvsp[0].String;
3672 yyval.String = yyvsp[-2].String;
3677 #line 1583 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3679 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3680 delete yyvsp[0].String;
3681 yyval.String = yyvsp[-2].String;
3686 #line 1588 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3688 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3689 delete yyvsp[0].String;
3690 yyval.String = yyvsp[-2].String;
3695 #line 1595 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3697 yyvsp[-1].String->insert(0, "[ ");
3698 *yyvsp[-1].String += " ]";
3699 yyval.String = yyvsp[-1].String;
3704 #line 1602 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3706 *yyvsp[-2].String += ", " + *yyvsp[0].String;
3707 delete yyvsp[0].String;
3708 yyval.String = yyvsp[-2].String;
3713 #line 1608 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3715 yyval.String = new std::string();
3720 #line 1617 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3721 { yyval.String = new std::string(); }
3725 #line 1619 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3727 yyval.String = new std::string(yyvsp[-1].Ty->getNewTy());
3728 if (!yyvsp[0].String->empty()) {
3729 std::string Name = getUniqueName(yyvsp[0].String, yyvsp[-1].Ty->resolve());
3730 *yyval.String += " " + Name;
3732 delete yyvsp[0].String;
3737 #line 1628 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3739 *yyvsp[-2].String += ", " + *yyvsp[0].String;
3740 delete yyvsp[0].String;
3745 #line 1632 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3747 yyval.String = yyvsp[0].String;
3752 #line 1636 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3754 yyval.String = yyvsp[0].String;
3759 #line 1639 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3761 *yyvsp[-2].String += ", ...";
3762 yyval.String = yyvsp[-2].String;
3763 delete yyvsp[0].String;
3768 #line 1644 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3770 yyval.String = yyvsp[0].String;
3775 #line 1647 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3776 { yyval.String = new std::string(); }
3780 #line 1650 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3782 if (*yyvsp[-5].String == "%llvm.va_start" || *yyvsp[-5].String == "%llvm.va_end") {
3783 *yyvsp[-3].String = "i8*";
3784 } else if (*yyvsp[-5].String == "%llvm.va_copy") {
3785 *yyvsp[-3].String = "i8*, i8*";
3787 if (!yyvsp[-7].String->empty()) {
3788 *yyvsp[-7].String += " ";
3790 *yyvsp[-7].String += yyvsp[-6].Ty->getNewTy() + " " + *yyvsp[-5].String + "(" + *yyvsp[-3].String + ")";
3791 if (!yyvsp[-1].String->empty()) {
3792 *yyvsp[-7].String += " " + *yyvsp[-1].String;
3794 if (!yyvsp[0].String->empty()) {
3795 *yyvsp[-7].String += " " + *yyvsp[0].String;
3797 delete yyvsp[-5].String;
3798 delete yyvsp[-3].String;
3799 delete yyvsp[-1].String;
3800 delete yyvsp[0].String;
3801 yyval.String = yyvsp[-7].String;
3806 #line 1673 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3807 { yyval.String = new std::string("{"); delete yyvsp[0].String; }
3811 #line 1674 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3812 { yyval.String = new std::string ("{"); }
3816 #line 1678 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3819 if (!yyvsp[-2].String->empty()) {
3820 *O << *yyvsp[-2].String << ' ';
3822 *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3823 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3829 #line 1689 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3830 { yyval.String = new std::string("}"); delete yyvsp[0].String; }
3834 #line 1690 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3835 { yyval.String = new std::string("}"); }
3839 #line 1692 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3841 if (yyvsp[-1].String)
3842 *O << *yyvsp[-1].String;
3843 *O << *yyvsp[0].String << "\n\n";
3844 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3850 #line 1701 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3851 { yyval.String = new std::string(); }
3855 #line 1707 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3856 { isDeclare = true; }
3860 #line 1707 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3862 if (!yyvsp[-1].String->empty())
3863 *yyvsp[-3].String += " " + *yyvsp[-1].String;
3864 *yyvsp[-3].String += " " + *yyvsp[0].String;
3865 delete yyvsp[-1].String;
3866 delete yyvsp[0].String;
3867 yyval.String = yyvsp[-3].String;
3873 #line 1721 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3874 { yyval.String = new std::string(); }
3878 #line 1727 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3880 yyvsp[-1].String->insert(0, "<");
3881 *yyvsp[-1].String += ">";
3882 yyval.String = yyvsp[-1].String;
3887 #line 1733 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3889 if (!yyvsp[-3].String->empty()) {
3890 *yyvsp[-4].String += " " + *yyvsp[-3].String;
3892 *yyvsp[-4].String += " " + *yyvsp[-2].String + ", " + *yyvsp[0].String;
3893 delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3894 yyval.String = yyvsp[-4].String;
3899 #line 1746 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3901 yyval.Val = new Value;
3902 yyval.Val->val = yyvsp[0].String;
3903 yyval.Val->constant = false;
3904 yyval.Val->type = 0;
3909 #line 1752 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3911 yyval.Val = new Value;
3912 yyval.Val->val = yyvsp[0].String;
3913 yyval.Val->constant = true;
3914 yyval.Val->type = 0;
3919 #line 1763 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3921 yyvsp[-1].Ty = yyvsp[-1].Ty->resolve();
3922 std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
3923 yyval.Val = yyvsp[0].Val;
3924 delete yyval.Val->val;
3925 yyval.Val->val = new std::string(yyvsp[-1].Ty->getNewTy() + " " + Name);
3926 yyval.Val->type = yyvsp[-1].Ty;
3931 #line 1772 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3938 #line 1775 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3939 { // Do not allow functions with 0 basic blocks
3945 #line 1783 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3952 #line 1787 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3954 *O << " " << *yyvsp[0].String << '\n';
3955 delete yyvsp[0].String;
3961 #line 1792 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3968 #line 1795 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3970 *O << *yyvsp[0].String << '\n';
3971 delete yyvsp[0].String;
3977 #line 1801 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3978 { yyval.String = yyvsp[0].String; *yyval.String = "unwind"; }
3982 #line 1803 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3983 { // Return with a result...
3984 *O << " " << *yyvsp[-1].String << ' ' << *yyvsp[0].Val->val << '\n';
3985 delete yyvsp[-1].String; delete yyvsp[0].Val;
3991 #line 1808 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3992 { // Return with no result...
3993 *O << " " << *yyvsp[-1].String << ' ' << yyvsp[0].Ty->getNewTy() << '\n';
3994 delete yyvsp[-1].String;
4000 #line 1813 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4001 { // Unconditional Branch...
4002 *O << " " << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].Val->val << '\n';
4003 delete yyvsp[-2].String; delete yyvsp[0].Val;
4009 #line 1818 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4011 std::string Name = getUniqueName(yyvsp[-6].Val->val, yyvsp[-7].Ty);
4012 *O << " " << *yyvsp[-8].String << ' ' << yyvsp[-7].Ty->getNewTy() << ' ' << Name << ", "
4013 << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << ", " << yyvsp[-1].Ty->getNewTy() << ' '
4014 << *yyvsp[0].Val->val << '\n';
4015 delete yyvsp[-8].String; delete yyvsp[-6].Val; delete yyvsp[-3].Val; delete yyvsp[0].Val;
4021 #line 1826 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4023 std::string Name = getUniqueName(yyvsp[-6].Val->val, yyvsp[-7].Ty);
4024 *O << " " << *yyvsp[-8].String << ' ' << yyvsp[-7].Ty->getNewTy() << ' ' << Name << ", "
4025 << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << " [" << *yyvsp[-1].String << " ]\n";
4026 delete yyvsp[-8].String;
4027 delete yyvsp[-6].Val;
4028 delete yyvsp[-3].Val;
4029 delete yyvsp[-1].String;
4035 #line 1836 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4037 std::string Name = getUniqueName(yyvsp[-5].Val->val, yyvsp[-6].Ty);
4038 *O << " " << *yyvsp[-7].String << ' ' << yyvsp[-6].Ty->getNewTy() << ' ' << Name << ", "
4039 << yyvsp[-3].Ty->getNewTy() << ' ' << *yyvsp[-2].Val->val << "[]\n";
4040 delete yyvsp[-7].String;
4041 delete yyvsp[-5].Val;
4042 delete yyvsp[-2].Val;
4048 #line 1846 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4050 const Type* ResTy = getFunctionReturnType(yyvsp[-10].Ty);
4052 if (!yyvsp[-13].String->empty()) {
4053 std::string Name = getUniqueName(yyvsp[-13].String, ResTy);
4054 *O << Name << " = ";
4056 *O << *yyvsp[-12].String << ' ' << *yyvsp[-11].String << ' ' << yyvsp[-10].Ty->getNewTy() << ' ' << *yyvsp[-9].Val->val << " (";
4057 for (unsigned i = 0; i < yyvsp[-7].ValList->size(); ++i) {
4058 Value* V = (*yyvsp[-7].ValList)[i];
4060 if (i+1 < yyvsp[-7].ValList->size())
4064 *O << ") " << *yyvsp[-5].String << ' ' << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << ' '
4065 << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].Val->val << '\n';
4066 delete yyvsp[-13].String; delete yyvsp[-12].String; delete yyvsp[-11].String; delete yyvsp[-9].Val; delete yyvsp[-7].ValList;
4067 delete yyvsp[-5].String; delete yyvsp[-3].Val; delete yyvsp[-2].String; delete yyvsp[0].Val;
4073 #line 1867 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4075 *O << " " << *yyvsp[0].String << '\n';
4076 delete yyvsp[0].String;
4082 #line 1872 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4084 *O << " " << *yyvsp[0].String << '\n';
4085 delete yyvsp[0].String;
4091 #line 1878 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4093 *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + " " + *yyvsp[-3].String + ", " + yyvsp[-1].Ty->getNewTy() + " " +
4095 delete yyvsp[-3].String; delete yyvsp[0].Val;
4096 yyval.String = yyvsp[-5].String;
4101 #line 1884 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4103 yyvsp[-3].String->insert(0, yyvsp[-4].Ty->getNewTy() + " " );
4104 *yyvsp[-3].String += ", " + yyvsp[-1].Ty->getNewTy() + " " + *yyvsp[0].Val->val;
4105 delete yyvsp[0].Val;
4106 yyval.String = yyvsp[-3].String;
4111 #line 1892 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4113 if (!yyvsp[-1].String->empty()) {
4114 // Get a unique name for this value, based on its type.
4115 std::string Name = getUniqueName(yyvsp[-1].String, yyvsp[0].Val->type);
4116 *yyvsp[-1].String = Name + " = ";
4117 if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
4118 // don't actually delete it, just comment it out
4119 yyvsp[-1].String->insert(0, "; USELSS BITCAST: ");
4120 delete deleteUselessCastName;
4123 *yyvsp[-1].String += *yyvsp[0].Val->val;
4124 delete yyvsp[0].Val;
4125 deleteUselessCastFlag = false;
4126 yyval.String = yyvsp[-1].String;
4131 #line 1910 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4132 { // Used for PHI nodes
4133 std::string Name = getUniqueName(yyvsp[-3].Val->val, yyvsp[-5].Ty);
4134 Name.insert(0, yyvsp[-5].Ty->getNewTy() + "[");
4135 Name += "," + *yyvsp[-1].Val->val + "]";
4136 yyval.Val = new Value;
4137 yyval.Val->val = new std::string(Name);
4138 yyval.Val->type = yyvsp[-5].Ty;
4139 delete yyvsp[-3].Val; delete yyvsp[-1].Val;
4144 #line 1919 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4146 std::string Name = getUniqueName(yyvsp[-3].Val->val, yyvsp[-6].Val->type);
4147 *yyvsp[-6].Val->val += ", [" + Name + "," + *yyvsp[-1].Val->val + "]";
4148 delete yyvsp[-3].Val;
4149 delete yyvsp[-1].Val;
4150 yyval.Val = yyvsp[-6].Val;
4155 #line 1929 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4157 yyval.ValList = new ValueList();
4158 yyval.ValList->push_back(yyvsp[0].Val);
4163 #line 1933 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4165 yyval.ValList = yyvsp[-2].ValList;
4166 yyval.ValList->push_back(yyvsp[0].Val);
4171 #line 1940 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4172 { yyval.ValList = yyvsp[0].ValList; }
4176 #line 1941 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4177 { yyval.ValList = new ValueList(); }
4181 #line 1945 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4183 *yyvsp[-1].String += " " + *yyvsp[0].String;
4184 delete yyvsp[0].String;
4185 yyval.String = yyvsp[-1].String;
4190 #line 1953 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4192 const char* op = getDivRemOpcode(*yyvsp[-4].String, yyvsp[-3].Ty);
4193 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4194 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4195 yyval.Val = yyvsp[-2].Val;
4196 delete yyval.Val->val;
4197 yyval.Val->val = new std::string(op);
4198 *yyval.Val->val += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4199 yyval.Val->type = yyvsp[-3].Ty;
4200 delete yyvsp[-4].String; delete yyvsp[0].Val;
4205 #line 1964 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4207 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4208 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4209 *yyvsp[-4].String += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4210 yyval.Val = yyvsp[-2].Val;
4211 delete yyval.Val->val;
4212 yyval.Val->val = yyvsp[-4].String;
4213 yyval.Val->type = yyvsp[-3].Ty;
4214 delete yyvsp[0].Val;
4219 #line 1974 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4221 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4222 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4223 *yyvsp[-4].String = getCompareOp(*yyvsp[-4].String, yyvsp[-3].Ty);
4224 *yyvsp[-4].String += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4225 yyval.Val = yyvsp[-2].Val;
4226 delete yyval.Val->val;
4227 yyval.Val->val = yyvsp[-4].String;
4228 yyval.Val->type = Type::get("i1",BoolTy);
4229 delete yyvsp[0].Val;
4234 #line 1985 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4236 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4237 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4238 *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + "," + Name2;
4239 yyval.Val = yyvsp[-2].Val;
4240 delete yyval.Val->val;
4241 yyval.Val->val = yyvsp[-5].String;
4242 yyval.Val->type = Type::get("i1",BoolTy);
4243 delete yyvsp[-4].String; delete yyvsp[0].Val;
4248 #line 1995 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4250 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4251 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4252 *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + "," + Name2;
4253 yyval.Val = yyvsp[-2].Val;
4254 delete yyval.Val->val;
4255 yyval.Val->val = yyvsp[-5].String;
4256 yyval.Val->type = Type::get("i1",BoolTy);
4257 delete yyvsp[-4].String; delete yyvsp[0].Val;
4262 #line 2005 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4264 const char* shiftop = yyvsp[-3].String->c_str();
4265 if (*yyvsp[-3].String == "shr")
4266 shiftop = (yyvsp[-2].Val->type->isUnsigned()) ? "lshr" : "ashr";
4267 std::string *val = new std::string(shiftop);
4268 *val += " " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4269 yyval.Val = yyvsp[-2].Val;
4270 delete yyval.Val->val;
4271 yyval.Val->val = val;
4272 delete yyvsp[-3].String; delete yyvsp[0].Val;
4277 #line 2016 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4279 std::string source = *yyvsp[-2].Val->val;
4280 const Type* SrcTy = yyvsp[-2].Val->type->resolve();
4281 const Type* DstTy = yyvsp[0].Ty->resolve();
4282 yyval.Val = yyvsp[-2].Val;
4283 delete yyval.Val->val;
4284 yyval.Val->val = new std::string();
4285 yyval.Val->type = DstTy;
4286 if (*yyvsp[-3].String == "cast") {
4287 *yyval.Val->val += getCastUpgrade(source, SrcTy, DstTy, false);
4289 *yyval.Val->val += *yyvsp[-3].String + " " + source + " to " + DstTy->getNewTy();
4291 // Check to see if this is a useless cast of a value to the same name
4292 // and the same type. Such casts will probably cause redefinition errors
4293 // when assembled and perform no code gen action so just remove them.
4294 if (*yyvsp[-3].String == "cast" || *yyvsp[-3].String == "bitcast")
4295 if (SrcTy->isInteger() && DstTy->isInteger() &&
4296 SrcTy->getBitWidth() == DstTy->getBitWidth()) {
4297 deleteUselessCastFlag = true; // Flag the "Inst" rule
4298 deleteUselessCastName = new std::string(*yyvsp[-2].Val->val); // save the name
4299 size_t pos = deleteUselessCastName->find_first_of("%\"",0);
4300 if (pos != std::string::npos) {
4301 // remove the type portion before val
4302 deleteUselessCastName->erase(0, pos);
4305 delete yyvsp[-3].String;
4306 delete yyvsp[-1].String;
4311 #line 2046 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4313 *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4314 yyval.Val = yyvsp[-4].Val;
4315 delete yyval.Val->val;
4316 yyval.Val->val = yyvsp[-5].String;
4317 yyval.Val->type = yyvsp[-2].Val->type;
4318 delete yyvsp[-2].Val;
4319 delete yyvsp[0].Val;
4324 #line 2055 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4326 *yyvsp[-3].String += " " + *yyvsp[-2].Val->val + ", " + yyvsp[0].Ty->getNewTy();
4327 yyval.Val = yyvsp[-2].Val;
4328 delete yyval.Val->val;
4329 yyval.Val->val = yyvsp[-3].String;
4330 yyval.Val->type = yyvsp[0].Ty;
4335 #line 2062 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4337 *yyvsp[-3].String += " " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4338 yyval.Val = yyvsp[-2].Val;
4339 delete yyval.Val->val;
4340 yyval.Val->val = yyvsp[-3].String;
4341 yyval.Val->type = yyval.Val->type->resolve();
4342 yyval.Val->type = yyval.Val->type->getElementType();
4343 delete yyvsp[0].Val;
4348 #line 2071 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4350 *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4351 yyval.Val = yyvsp[-4].Val;
4352 delete yyval.Val->val;
4353 yyval.Val->val = yyvsp[-5].String;
4354 delete yyvsp[-2].Val; delete yyvsp[0].Val;
4359 #line 2078 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4361 *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4362 yyval.Val = yyvsp[-4].Val;
4363 delete yyval.Val->val;
4364 yyval.Val->val = yyvsp[-5].String;
4365 delete yyvsp[-2].Val; delete yyvsp[0].Val;
4370 #line 2085 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4372 *yyvsp[-1].String += " " + *yyvsp[0].Val->val;
4373 yyval.Val = yyvsp[0].Val;
4374 delete yyvsp[0].Val->val;
4375 yyval.Val->val = yyvsp[-1].String;
4380 #line 2091 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4382 // map llvm.isunordered to "fcmp uno"
4383 yyval.Val = new Value;
4384 if (*yyvsp[-3].Val->val == "%llvm.isunordered.f32" ||
4385 *yyvsp[-3].Val->val == "%llvm.isunordered.f64") {
4386 yyval.Val->val = new std::string( "fcmp uno " + *(*yyvsp[-1].ValList)[0]->val + ", ");
4387 size_t pos = (*yyvsp[-1].ValList)[1]->val->find(' ');
4388 assert(pos != std::string::npos && "no space?");
4389 *yyval.Val->val += (*yyvsp[-1].ValList)[1]->val->substr(pos+1);
4390 yyval.Val->type = Type::get("i1", BoolTy);
4392 static unsigned upgradeCount = 1;
4393 if (*yyvsp[-3].Val->val == "%llvm.va_start" || *yyvsp[-3].Val->val == "%llvm.va_end") {
4394 if (!yyvsp[-1].ValList->empty()) {
4395 std::string name("%va_upgrade");
4396 name += llvm::utostr(upgradeCount++);
4397 yyvsp[-6].String->insert(0, name + " = bitcast " + *(*yyvsp[-1].ValList)[0]->val + " to i8*\n ");
4398 *(*yyvsp[-1].ValList)[0]->val = "i8* " + name;
4399 (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
4401 } else if (*yyvsp[-3].Val->val == "%llvm.va_copy") {
4402 std::string name0("%va_upgrade");
4403 name0 += llvm::utostr(upgradeCount++);
4404 std::string name1("%va_upgrade");
4405 name1 += llvm::utostr(upgradeCount++);
4406 yyvsp[-6].String->insert(0, name0 + " = bitcast " + *(*yyvsp[-1].ValList)[0]->val + " to i8*\n " +
4407 name1 + " = bitcast " + *(*yyvsp[-1].ValList)[1]->val + " to i8*\n ");
4408 *(*yyvsp[-1].ValList)[0]->val = "i8* " + name0;
4409 (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
4410 *(*yyvsp[-1].ValList)[1]->val = "i8* " + name1;
4411 (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
4413 if (!yyvsp[-5].String->empty())
4414 *yyvsp[-6].String += " " + *yyvsp[-5].String;
4415 if (!yyvsp[-6].String->empty())
4416 *yyvsp[-6].String += " ";
4417 *yyvsp[-6].String += yyvsp[-4].Ty->getNewTy() + " " + *yyvsp[-3].Val->val + "(";
4418 for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
4419 Value* V = (*yyvsp[-1].ValList)[i];
4420 *yyvsp[-6].String += *V->val;
4421 if (i+1 < yyvsp[-1].ValList->size())
4422 *yyvsp[-6].String += ", ";
4425 *yyvsp[-6].String += ")";
4426 yyval.Val = new Value;
4427 yyval.Val->val = yyvsp[-6].String;
4428 yyval.Val->type = getFunctionReturnType(yyvsp[-4].Ty);
4430 delete yyvsp[-5].String; delete yyvsp[-3].Val; delete yyvsp[-1].ValList;
4435 #line 2147 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4436 { yyval.ValList = yyvsp[0].ValList; }
4440 #line 2148 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4441 { yyval.ValList = new ValueList(); }
4445 #line 2153 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4446 { yyval.String = new std::string(); }
4450 #line 2156 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4452 *yyvsp[-2].String += " " + yyvsp[-1].Ty->getNewTy();
4453 if (!yyvsp[0].String->empty())
4454 *yyvsp[-2].String += " " + *yyvsp[0].String;
4455 yyval.Val = new Value;
4456 yyval.Val->val = yyvsp[-2].String;
4457 yyval.Val->type = yyvsp[-1].Ty->getPointerType();
4458 delete yyvsp[0].String;
4463 #line 2165 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4465 std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4466 *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + ", " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4467 if (!yyvsp[0].String->empty())
4468 *yyvsp[-5].String += " " + *yyvsp[0].String;
4469 yyval.Val = new Value;
4470 yyval.Val->val = yyvsp[-5].String;
4471 yyval.Val->type = yyvsp[-4].Ty->getPointerType();
4472 delete yyvsp[-1].Val; delete yyvsp[0].String;
4477 #line 2175 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4479 *yyvsp[-2].String += " " + yyvsp[-1].Ty->getNewTy();
4480 if (!yyvsp[0].String->empty())
4481 *yyvsp[-2].String += " " + *yyvsp[0].String;
4482 yyval.Val = new Value;
4483 yyval.Val->val = yyvsp[-2].String;
4484 yyval.Val->type = yyvsp[-1].Ty->getPointerType();
4485 delete yyvsp[0].String;
4490 #line 2184 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4492 std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4493 *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + ", " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4494 if (!yyvsp[0].String->empty())
4495 *yyvsp[-5].String += " " + *yyvsp[0].String;
4496 yyval.Val = yyvsp[-1].Val;
4497 delete yyval.Val->val;
4498 yyval.Val->val = yyvsp[-5].String;
4499 yyval.Val->type = yyvsp[-4].Ty->getPointerType();
4500 delete yyvsp[0].String;
4505 #line 2195 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4507 *yyvsp[-1].String += " " + *yyvsp[0].Val->val;
4508 yyval.Val = yyvsp[0].Val;
4509 delete yyvsp[0].Val->val;
4510 yyval.Val->val = yyvsp[-1].String;
4511 yyval.Val->type = Type::get("void", VoidTy);
4516 #line 2202 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4518 std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
4519 if (!yyvsp[-3].String->empty())
4520 *yyvsp[-3].String += " ";
4521 *yyvsp[-3].String += *yyvsp[-2].String + " " + yyvsp[-1].Ty->getNewTy() + " " + Name;
4522 yyval.Val = yyvsp[0].Val;
4523 delete yyval.Val->val;
4524 yyval.Val->val = yyvsp[-3].String;
4525 yyval.Val->type = yyvsp[-1].Ty->getElementType();
4526 delete yyvsp[-2].String;
4531 #line 2213 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4533 std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
4534 if (!yyvsp[-5].String->empty())
4535 *yyvsp[-5].String += " ";
4536 *yyvsp[-5].String += *yyvsp[-4].String + " " + *yyvsp[-3].Val->val + ", " + yyvsp[-1].Ty->getNewTy() + " " + Name;
4537 yyval.Val = yyvsp[-3].Val;
4538 delete yyval.Val->val;
4539 yyval.Val->val = yyvsp[-5].String;
4540 yyval.Val->type = Type::get("void", VoidTy);
4541 delete yyvsp[-4].String; delete yyvsp[0].Val;
4546 #line 2224 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4548 std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4549 // Upgrade the indices
4550 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
4551 Value* V = (*yyvsp[0].ValList)[i];
4552 if (V->type->isUnsigned() && !V->isConstant() &&
4553 V->type->getBitWidth() < 64) {
4554 *O << " %gep_upgrade" << UniqueNameCounter << " = zext " << *V->val
4556 *V->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++);
4557 V->type = Type::get("i64",ULongTy);
4560 *yyvsp[-3].String += " " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4561 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
4562 Value* V = (*yyvsp[0].ValList)[i];
4563 *yyvsp[-3].String += ", " + *V->val;
4565 yyval.Val = yyvsp[-1].Val;
4566 delete yyval.Val->val;
4567 yyval.Val->val = yyvsp[-3].String;
4568 yyval.Val->type = getGEPIndexedType(yyvsp[-2].Ty,yyvsp[0].ValList);
4569 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i)
4570 delete (*yyvsp[0].ValList)[i];
4571 delete yyvsp[0].ValList;
4578 /* Line 1016 of /usr/local/share/bison/yacc.c. */
4579 #line 4580 "UpgradeParser.tab.c"
4588 short *yyssp1 = yyss - 1;
4589 YYFPRINTF (stderr, "state stack now");
4590 while (yyssp1 != yyssp)
4591 YYFPRINTF (stderr, " %d", *++yyssp1);
4592 YYFPRINTF (stderr, "\n");
4599 /* Now `shift' the result of the reduction. Determine what state
4600 that goes to, based on the state we popped back to and the rule
4601 number reduced by. */
4605 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4606 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4607 yystate = yytable[yystate];
4609 yystate = yydefgoto[yyn - YYNTOKENS];
4614 /*------------------------------------.
4615 | yyerrlab -- here on detecting error |
4616 `------------------------------------*/
4618 /* If not already recovering from an error, report this error. */
4623 yyn = yypact[yystate];
4625 if (YYPACT_NINF < yyn && yyn < YYLAST)
4627 YYSIZE_T yysize = 0;
4628 int yytype = YYTRANSLATE (yychar);
4633 /* Start YYX at -YYN if negative to avoid negative indexes in
4635 for (yyx = yyn < 0 ? -yyn : 0;
4636 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
4637 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4638 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
4639 yysize += yystrlen ("parse error, unexpected ") + 1;
4640 yysize += yystrlen (yytname[yytype]);
4641 yymsg = (char *) YYSTACK_ALLOC (yysize);
4644 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
4645 yyp = yystpcpy (yyp, yytname[yytype]);
4650 for (yyx = yyn < 0 ? -yyn : 0;
4651 yyx < (int) (sizeof (yytname) / sizeof (char *));
4653 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4655 const char *yyq = ! yycount ? ", expecting " : " or ";
4656 yyp = yystpcpy (yyp, yyq);
4657 yyp = yystpcpy (yyp, yytname[yyx]);
4662 YYSTACK_FREE (yymsg);
4665 yyerror ("parse error; also virtual memory exhausted");
4668 #endif /* YYERROR_VERBOSE */
4669 yyerror ("parse error");
4674 /*----------------------------------------------------.
4675 | yyerrlab1 -- error raised explicitly by an action. |
4676 `----------------------------------------------------*/
4678 if (yyerrstatus == 3)
4680 /* If just tried and failed to reuse lookahead token after an
4681 error, discard it. */
4683 /* Return failure if at end of input. */
4684 if (yychar == YYEOF)
4686 /* Pop the error token. */
4688 /* Pop the rest of the stack. */
4689 while (yyssp > yyss)
4691 YYDPRINTF ((stderr, "Error: popping "));
4692 YYDSYMPRINT ((stderr,
4695 YYDPRINTF ((stderr, "\n"));
4696 yydestruct (yystos[*yyssp], *yyvsp);
4702 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
4703 yychar, yytname[yychar1]));
4704 yydestruct (yychar1, yylval);
4708 /* Else will try to reuse lookahead token after shifting the error
4711 yyerrstatus = 3; /* Each real token shifted decrements this. */
4715 yyn = yypact[yystate];
4716 if (yyn != YYPACT_NINF)
4719 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4727 /* Pop the current state because it cannot handle the error token. */
4731 YYDPRINTF ((stderr, "Error: popping "));
4732 YYDSYMPRINT ((stderr,
4733 yystos[*yyssp], *yyvsp));
4734 YYDPRINTF ((stderr, "\n"));
4736 yydestruct (yystos[yystate], *yyvsp);
4744 short *yyssp1 = yyss - 1;
4745 YYFPRINTF (stderr, "Error: state stack now");
4746 while (yyssp1 != yyssp)
4747 YYFPRINTF (stderr, " %d", *++yyssp1);
4748 YYFPRINTF (stderr, "\n");
4756 YYDPRINTF ((stderr, "Shifting error token, "));
4765 /*-------------------------------------.
4766 | yyacceptlab -- YYACCEPT comes here. |
4767 `-------------------------------------*/
4772 /*-----------------------------------.
4773 | yyabortlab -- YYABORT comes here. |
4774 `-----------------------------------*/
4780 /*----------------------------------------------.
4781 | yyoverflowlab -- parser overflow comes here. |
4782 `----------------------------------------------*/
4784 yyerror ("parser stack overflow");
4792 YYSTACK_FREE (yyss);
4798 #line 2251 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4801 int yyerror(const char *ErrorMsg) {
4803 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4804 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
4805 std::string errMsg = where + "error: " + std::string(ErrorMsg) +
4807 if (yychar == YYEMPTY || yychar == 0)
4808 errMsg += "end-of-file.";
4810 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
4811 std::cerr << "llvm-upgrade: " << errMsg << '\n';
4812 *O << "llvm-upgrade parse failed.\n";
4816 void warning(const std::string& ErrorMsg) {
4818 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4819 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
4820 std::string errMsg = where + "warning: " + std::string(ErrorMsg) +
4822 if (yychar == YYEMPTY || yychar == 0)
4823 errMsg += "end-of-file.";
4825 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
4826 std::cerr << "llvm-upgrade: " << errMsg << '\n';