1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
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., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, 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. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
90 ZEROINITIALIZER = 281,
133 X86_STDCALLCC_TOK = 324,
134 X86_FASTCALLCC_TOK = 325,
210 EXTRACTELEMENT = 401,
218 #define ESINT64VAL 258
219 #define EUINT64VAL 259
239 #define STRINGCONSTANT 279
240 #define IMPLEMENTATION 280
241 #define ZEROINITIALIZER 281
252 #define DOTDOTDOT 292
259 #define APPENDING 299
260 #define DLLIMPORT 300
261 #define DLLEXPORT 301
262 #define EXTERN_WEAK 302
269 #define POINTERSIZE 309
278 #define SIDEEFFECT 318
281 #define CSRETCC_TOK 321
282 #define FASTCC_TOK 322
283 #define COLDCC_TOK 323
284 #define X86_STDCALLCC_TOK 324
285 #define X86_FASTCALLCC_TOK 325
286 #define DATALAYOUT 326
292 #define UNREACHABLE 332
342 #define GETELEMENTPTR 382
361 #define EXTRACTELEMENT 401
362 #define INSERTELEMENT 402
363 #define SHUFFLEVECTOR 403
364 #define VAARG_old 404
365 #define VANEXT_old 405
370 /* Copy the first part of user declarations. */
371 #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
373 #include "ParserInternals.h"
374 #include "llvm/CallingConv.h"
375 #include "llvm/InlineAsm.h"
376 #include "llvm/Instructions.h"
377 #include "llvm/Module.h"
378 #include "llvm/SymbolTable.h"
379 #include "llvm/Assembly/AutoUpgrade.h"
380 #include "llvm/Support/GetElementPtrTypeIterator.h"
381 #include "llvm/ADT/STLExtras.h"
382 #include "llvm/Support/MathExtras.h"
383 #include "llvm/Support/Streams.h"
388 // The following is a gross hack. In order to rid the libAsmParser library of
389 // exceptions, we have to have a way of getting the yyparse function to go into
390 // an error situation. So, whenever we want an error to occur, the GenerateError
391 // function (see bottom of file) sets TriggerError. Then, at the end of each
392 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
393 // (a goto) to put YACC in error state. Furthermore, several calls to
394 // GenerateError are made from inside productions and they must simulate the
395 // previous exception behavior by exiting the production immediately. We have
396 // replaced these with the GEN_ERROR macro which calls GeneratError and then
397 // immediately invokes YYERROR. This would be so much cleaner if it was a
398 // recursive descent parser.
399 static bool TriggerError = false;
400 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
401 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
403 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
404 int yylex(); // declaration" of xxx warnings.
408 std::string CurFilename;
410 using namespace llvm;
412 static Module *ParserResult;
414 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
415 // relating to upreferences in the input stream.
417 //#define DEBUG_UPREFS 1
419 #define UR_OUT(X) llvm_cerr << X
424 #define YYERROR_VERBOSE 1
426 static bool ObsoleteVarArgs;
427 static bool NewVarArgs;
428 static BasicBlock *CurBB;
429 static GlobalVariable *CurGV;
432 // This contains info used when building the body of a function. It is
433 // destroyed when the function is completed.
435 typedef std::vector<Value *> ValueList; // Numbered defs
437 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
438 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
440 static struct PerModuleInfo {
441 Module *CurrentModule;
442 std::map<const Type *, ValueList> Values; // Module level numbered definitions
443 std::map<const Type *,ValueList> LateResolveValues;
444 std::vector<PATypeHolder> Types;
445 std::map<ValID, PATypeHolder> LateResolveTypes;
447 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
448 /// how they were referenced and on which line of the input they came from so
449 /// that we can resolve them later and print error messages as appropriate.
450 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
452 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
453 // references to global values. Global values may be referenced before they
454 // are defined, and if so, the temporary object that they represent is held
455 // here. This is used for forward references of GlobalValues.
457 typedef std::map<std::pair<const PointerType *,
458 ValID>, GlobalValue*> GlobalRefsType;
459 GlobalRefsType GlobalRefs;
462 // If we could not resolve some functions at function compilation time
463 // (calls to functions before they are defined), resolve them now... Types
464 // are resolved when the constant pool has been completely parsed.
466 ResolveDefinitions(LateResolveValues);
470 // Check to make sure that all global value forward references have been
473 if (!GlobalRefs.empty()) {
474 std::string UndefinedReferences = "Unresolved global references exist:\n";
476 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
478 UndefinedReferences += " " + I->first.first->getDescription() + " " +
479 I->first.second.getName() + "\n";
481 GenerateError(UndefinedReferences);
485 Values.clear(); // Clear out function local definitions
490 // GetForwardRefForGlobal - Check to see if there is a forward reference
491 // for this global. If so, remove it from the GlobalRefs map and return it.
492 // If not, just return null.
493 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
494 // Check to see if there is a forward reference to this global variable...
495 // if there is, eliminate it and patch the reference to use the new def'n.
496 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
497 GlobalValue *Ret = 0;
498 if (I != GlobalRefs.end()) {
506 static struct PerFunctionInfo {
507 Function *CurrentFunction; // Pointer to current function being created
509 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
510 std::map<const Type*, ValueList> LateResolveValues;
511 bool isDeclare; // Is this function a forward declararation?
512 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
514 /// BBForwardRefs - When we see forward references to basic blocks, keep
515 /// track of them here.
516 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
517 std::vector<BasicBlock*> NumberedBlocks;
520 inline PerFunctionInfo() {
523 Linkage = GlobalValue::ExternalLinkage;
526 inline void FunctionStart(Function *M) {
531 void FunctionDone() {
532 NumberedBlocks.clear();
534 // Any forward referenced blocks left?
535 if (!BBForwardRefs.empty()) {
536 GenerateError("Undefined reference to label " +
537 BBForwardRefs.begin()->first->getName());
541 // Resolve all forward references now.
542 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
544 Values.clear(); // Clear out function local definitions
547 Linkage = GlobalValue::ExternalLinkage;
549 } CurFun; // Info for the current function...
551 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
554 //===----------------------------------------------------------------------===//
555 // Code to handle definitions of all the types
556 //===----------------------------------------------------------------------===//
558 static int InsertValue(Value *V,
559 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
560 if (V->hasName()) return -1; // Is this a numbered definition?
562 // Yes, insert the value into the value table...
563 ValueList &List = ValueTab[V->getType()];
565 return List.size()-1;
568 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
570 case ValID::NumberVal: // Is it a numbered definition?
571 // Module constants occupy the lowest numbered slots...
572 if ((unsigned)D.Num < CurModule.Types.size())
573 return CurModule.Types[(unsigned)D.Num];
575 case ValID::NameVal: // Is it a named definition?
576 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
577 D.destroy(); // Free old strdup'd memory...
582 GenerateError("Internal parser error: Invalid symbol type reference!");
586 // If we reached here, we referenced either a symbol that we don't know about
587 // or an id number that hasn't been read yet. We may be referencing something
588 // forward, so just create an entry to be resolved later and get to it...
590 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
593 if (inFunctionScope()) {
594 if (D.Type == ValID::NameVal) {
595 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
598 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
603 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
604 if (I != CurModule.LateResolveTypes.end())
607 Type *Typ = OpaqueType::get();
608 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
612 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
613 SymbolTable &SymTab =
614 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
615 CurModule.CurrentModule->getSymbolTable();
616 return SymTab.lookup(Ty, Name);
619 // getValNonImprovising - Look up the value specified by the provided type and
620 // the provided ValID. If the value exists and has already been defined, return
621 // it. Otherwise return null.
623 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
624 if (isa<FunctionType>(Ty)) {
625 GenerateError("Functions are not values and "
626 "must be referenced as pointers");
631 case ValID::NumberVal: { // Is it a numbered definition?
632 unsigned Num = (unsigned)D.Num;
634 // Module constants occupy the lowest numbered slots...
635 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
636 if (VI != CurModule.Values.end()) {
637 if (Num < VI->second.size())
638 return VI->second[Num];
639 Num -= VI->second.size();
642 // Make sure that our type is within bounds
643 VI = CurFun.Values.find(Ty);
644 if (VI == CurFun.Values.end()) return 0;
646 // Check that the number is within bounds...
647 if (VI->second.size() <= Num) return 0;
649 return VI->second[Num];
652 case ValID::NameVal: { // Is it a named definition?
653 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
654 if (N == 0) return 0;
656 D.destroy(); // Free old strdup'd memory...
660 // Check to make sure that "Ty" is an integral type, and that our
661 // value will fit into the specified type...
662 case ValID::ConstSIntVal: // Is it a constant pool reference??
663 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
664 GenerateError("Signed integral constant '" +
665 itostr(D.ConstPool64) + "' is invalid for type '" +
666 Ty->getDescription() + "'!");
669 return ConstantInt::get(Ty, D.ConstPool64);
671 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
672 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
673 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
674 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
675 "' is invalid or out of range!");
677 } else { // This is really a signed reference. Transmogrify.
678 return ConstantInt::get(Ty, D.ConstPool64);
681 return ConstantInt::get(Ty, D.UConstPool64);
684 case ValID::ConstFPVal: // Is it a floating point const pool reference?
685 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
686 GenerateError("FP constant invalid for type!!");
689 return ConstantFP::get(Ty, D.ConstPoolFP);
691 case ValID::ConstNullVal: // Is it a null value?
692 if (!isa<PointerType>(Ty)) {
693 GenerateError("Cannot create a a non pointer null!");
696 return ConstantPointerNull::get(cast<PointerType>(Ty));
698 case ValID::ConstUndefVal: // Is it an undef value?
699 return UndefValue::get(Ty);
701 case ValID::ConstZeroVal: // Is it a zero value?
702 return Constant::getNullValue(Ty);
704 case ValID::ConstantVal: // Fully resolved constant?
705 if (D.ConstantValue->getType() != Ty) {
706 GenerateError("Constant expression type different from required type!");
709 return D.ConstantValue;
711 case ValID::InlineAsmVal: { // Inline asm expression
712 const PointerType *PTy = dyn_cast<PointerType>(Ty);
713 const FunctionType *FTy =
714 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
715 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
716 GenerateError("Invalid type for asm constraint string!");
719 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
720 D.IAD->HasSideEffects);
721 D.destroy(); // Free InlineAsmDescriptor.
725 assert(0 && "Unhandled case!");
729 assert(0 && "Unhandled case!");
733 // getVal - This function is identical to getValNonImprovising, except that if a
734 // value is not already defined, it "improvises" by creating a placeholder var
735 // that looks and acts just like the requested variable. When the value is
736 // defined later, all uses of the placeholder variable are replaced with the
739 static Value *getVal(const Type *Ty, const ValID &ID) {
740 if (Ty == Type::LabelTy) {
741 GenerateError("Cannot use a basic block here");
745 // See if the value has already been defined.
746 Value *V = getValNonImprovising(Ty, ID);
748 if (TriggerError) return 0;
750 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
751 GenerateError("Invalid use of a composite type!");
755 // If we reached here, we referenced either a symbol that we don't know about
756 // or an id number that hasn't been read yet. We may be referencing something
757 // forward, so just create an entry to be resolved later and get to it...
759 V = new Argument(Ty);
761 // Remember where this forward reference came from. FIXME, shouldn't we try
762 // to recycle these things??
763 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
766 if (inFunctionScope())
767 InsertValue(V, CurFun.LateResolveValues);
769 InsertValue(V, CurModule.LateResolveValues);
773 /// getBBVal - This is used for two purposes:
774 /// * If isDefinition is true, a new basic block with the specified ID is being
776 /// * If isDefinition is true, this is a reference to a basic block, which may
777 /// or may not be a forward reference.
779 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
780 assert(inFunctionScope() && "Can't get basic block at global scope!");
786 GenerateError("Illegal label reference " + ID.getName());
788 case ValID::NumberVal: // Is it a numbered definition?
789 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
790 CurFun.NumberedBlocks.resize(ID.Num+1);
791 BB = CurFun.NumberedBlocks[ID.Num];
793 case ValID::NameVal: // Is it a named definition?
795 if (Value *N = CurFun.CurrentFunction->
796 getSymbolTable().lookup(Type::LabelTy, Name))
797 BB = cast<BasicBlock>(N);
801 // See if the block has already been defined.
803 // If this is the definition of the block, make sure the existing value was
804 // just a forward reference. If it was a forward reference, there will be
805 // an entry for it in the PlaceHolderInfo map.
806 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
807 // The existing value was a definition, not a forward reference.
808 GenerateError("Redefinition of label " + ID.getName());
812 ID.destroy(); // Free strdup'd memory.
816 // Otherwise this block has not been seen before.
817 BB = new BasicBlock("", CurFun.CurrentFunction);
818 if (ID.Type == ValID::NameVal) {
819 BB->setName(ID.Name);
821 CurFun.NumberedBlocks[ID.Num] = BB;
824 // If this is not a definition, keep track of it so we can use it as a forward
827 // Remember where this forward reference came from.
828 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
830 // The forward declaration could have been inserted anywhere in the
831 // function: insert it into the correct place now.
832 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
833 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
840 //===----------------------------------------------------------------------===//
841 // Code to handle forward references in instructions
842 //===----------------------------------------------------------------------===//
844 // This code handles the late binding needed with statements that reference
845 // values not defined yet... for example, a forward branch, or the PHI node for
848 // This keeps a table (CurFun.LateResolveValues) of all such forward references
849 // and back patchs after we are done.
852 // ResolveDefinitions - If we could not resolve some defs at parsing
853 // time (forward branches, phi functions for loops, etc...) resolve the
857 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
858 std::map<const Type*,ValueList> *FutureLateResolvers) {
859 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
860 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
861 E = LateResolvers.end(); LRI != E; ++LRI) {
862 ValueList &List = LRI->second;
863 while (!List.empty()) {
864 Value *V = List.back();
867 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
868 CurModule.PlaceHolderInfo.find(V);
869 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
871 ValID &DID = PHI->second.first;
873 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
877 V->replaceAllUsesWith(TheRealValue);
879 CurModule.PlaceHolderInfo.erase(PHI);
880 } else if (FutureLateResolvers) {
881 // Functions have their unresolved items forwarded to the module late
883 InsertValue(V, *FutureLateResolvers);
885 if (DID.Type == ValID::NameVal) {
886 GenerateError("Reference to an invalid definition: '" +DID.getName()+
887 "' of type '" + V->getType()->getDescription() + "'",
891 GenerateError("Reference to an invalid definition: #" +
892 itostr(DID.Num) + " of type '" +
893 V->getType()->getDescription() + "'",
901 LateResolvers.clear();
904 // ResolveTypeTo - A brand new type was just declared. This means that (if
905 // name is not null) things referencing Name can be resolved. Otherwise, things
906 // refering to the number can be resolved. Do this now.
908 static void ResolveTypeTo(char *Name, const Type *ToTy) {
910 if (Name) D = ValID::create(Name);
911 else D = ValID::create((int)CurModule.Types.size());
913 std::map<ValID, PATypeHolder>::iterator I =
914 CurModule.LateResolveTypes.find(D);
915 if (I != CurModule.LateResolveTypes.end()) {
916 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
917 CurModule.LateResolveTypes.erase(I);
921 // setValueName - Set the specified value to the name given. The name may be
922 // null potentially, in which case this is a noop. The string passed in is
923 // assumed to be a malloc'd string buffer, and is free'd by this function.
925 static void setValueName(Value *V, char *NameStr) {
927 std::string Name(NameStr); // Copy string
928 free(NameStr); // Free old string
930 if (V->getType() == Type::VoidTy) {
931 GenerateError("Can't assign name '" + Name+"' to value with void type!");
935 assert(inFunctionScope() && "Must be in function scope!");
936 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
937 if (ST.lookup(V->getType(), Name)) {
938 GenerateError("Redefinition of value named '" + Name + "' in the '" +
939 V->getType()->getDescription() + "' type plane!");
948 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
949 /// this is a declaration, otherwise it is a definition.
950 static GlobalVariable *
951 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
952 bool isConstantGlobal, const Type *Ty,
953 Constant *Initializer) {
954 if (isa<FunctionType>(Ty)) {
955 GenerateError("Cannot declare global vars of function type!");
959 const PointerType *PTy = PointerType::get(Ty);
963 Name = NameStr; // Copy string
964 free(NameStr); // Free old string
967 // See if this global value was forward referenced. If so, recycle the
971 ID = ValID::create((char*)Name.c_str());
973 ID = ValID::create((int)CurModule.Values[PTy].size());
976 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
977 // Move the global to the end of the list, from whereever it was
978 // previously inserted.
979 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
980 CurModule.CurrentModule->getGlobalList().remove(GV);
981 CurModule.CurrentModule->getGlobalList().push_back(GV);
982 GV->setInitializer(Initializer);
983 GV->setLinkage(Linkage);
984 GV->setConstant(isConstantGlobal);
985 InsertValue(GV, CurModule.Values);
989 // If this global has a name, check to see if there is already a definition
990 // of this global in the module. If so, merge as appropriate. Note that
991 // this is really just a hack around problems in the CFE. :(
993 // We are a simple redefinition of a value, check to see if it is defined
994 // the same as the old one.
995 if (GlobalVariable *EGV =
996 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
997 // We are allowed to redefine a global variable in two circumstances:
998 // 1. If at least one of the globals is uninitialized or
999 // 2. If both initializers have the same value.
1001 if (!EGV->hasInitializer() || !Initializer ||
1002 EGV->getInitializer() == Initializer) {
1004 // Make sure the existing global version gets the initializer! Make
1005 // sure that it also gets marked const if the new version is.
1006 if (Initializer && !EGV->hasInitializer())
1007 EGV->setInitializer(Initializer);
1008 if (isConstantGlobal)
1009 EGV->setConstant(true);
1010 EGV->setLinkage(Linkage);
1014 GenerateError("Redefinition of global variable named '" + Name +
1015 "' in the '" + Ty->getDescription() + "' type plane!");
1020 // Otherwise there is no existing GV to use, create one now.
1021 GlobalVariable *GV =
1022 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1023 CurModule.CurrentModule);
1024 InsertValue(GV, CurModule.Values);
1028 // setTypeName - Set the specified type to the name given. The name may be
1029 // null potentially, in which case this is a noop. The string passed in is
1030 // assumed to be a malloc'd string buffer, and is freed by this function.
1032 // This function returns true if the type has already been defined, but is
1033 // allowed to be redefined in the specified context. If the name is a new name
1034 // for the type plane, it is inserted and false is returned.
1035 static bool setTypeName(const Type *T, char *NameStr) {
1036 assert(!inFunctionScope() && "Can't give types function-local names!");
1037 if (NameStr == 0) return false;
1039 std::string Name(NameStr); // Copy string
1040 free(NameStr); // Free old string
1042 // We don't allow assigning names to void type
1043 if (T == Type::VoidTy) {
1044 GenerateError("Can't assign name '" + Name + "' to the void type!");
1048 // Set the type name, checking for conflicts as we do so.
1049 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1051 if (AlreadyExists) { // Inserting a name that is already defined???
1052 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1053 assert(Existing && "Conflict but no matching type?");
1055 // There is only one case where this is allowed: when we are refining an
1056 // opaque type. In this case, Existing will be an opaque type.
1057 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1058 // We ARE replacing an opaque type!
1059 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1063 // Otherwise, this is an attempt to redefine a type. That's okay if
1064 // the redefinition is identical to the original. This will be so if
1065 // Existing and T point to the same Type object. In this one case we
1066 // allow the equivalent redefinition.
1067 if (Existing == T) return true; // Yes, it's equal.
1069 // Any other kind of (non-equivalent) redefinition is an error.
1070 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1071 T->getDescription() + "' type plane!");
1077 //===----------------------------------------------------------------------===//
1078 // Code for handling upreferences in type names...
1081 // TypeContains - Returns true if Ty directly contains E in it.
1083 static bool TypeContains(const Type *Ty, const Type *E) {
1084 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1085 E) != Ty->subtype_end();
1089 struct UpRefRecord {
1090 // NestingLevel - The number of nesting levels that need to be popped before
1091 // this type is resolved.
1092 unsigned NestingLevel;
1094 // LastContainedTy - This is the type at the current binding level for the
1095 // type. Every time we reduce the nesting level, this gets updated.
1096 const Type *LastContainedTy;
1098 // UpRefTy - This is the actual opaque type that the upreference is
1099 // represented with.
1100 OpaqueType *UpRefTy;
1102 UpRefRecord(unsigned NL, OpaqueType *URTy)
1103 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1107 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1108 static std::vector<UpRefRecord> UpRefs;
1110 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1111 /// called. It loops through the UpRefs vector, which is a list of the
1112 /// currently active types. For each type, if the up reference is contained in
1113 /// the newly completed type, we decrement the level count. When the level
1114 /// count reaches zero, the upreferenced type is the type that is passed in:
1115 /// thus we can complete the cycle.
1117 static PATypeHolder HandleUpRefs(const Type *ty) {
1118 // If Ty isn't abstract, or if there are no up-references in it, then there is
1119 // nothing to resolve here.
1120 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1122 PATypeHolder Ty(ty);
1123 UR_OUT("Type '" << Ty->getDescription() <<
1124 "' newly formed. Resolving upreferences.\n" <<
1125 UpRefs.size() << " upreferences active!\n");
1127 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1128 // to zero), we resolve them all together before we resolve them to Ty. At
1129 // the end of the loop, if there is anything to resolve to Ty, it will be in
1131 OpaqueType *TypeToResolve = 0;
1133 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1134 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1135 << UpRefs[i].second->getDescription() << ") = "
1136 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1137 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1138 // Decrement level of upreference
1139 unsigned Level = --UpRefs[i].NestingLevel;
1140 UpRefs[i].LastContainedTy = Ty;
1141 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1142 if (Level == 0) { // Upreference should be resolved!
1143 if (!TypeToResolve) {
1144 TypeToResolve = UpRefs[i].UpRefTy;
1146 UR_OUT(" * Resolving upreference for "
1147 << UpRefs[i].second->getDescription() << "\n";
1148 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1149 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1150 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1151 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1153 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1154 --i; // Do not skip the next element...
1159 if (TypeToResolve) {
1160 UR_OUT(" * Resolving upreference for "
1161 << UpRefs[i].second->getDescription() << "\n";
1162 std::string OldName = TypeToResolve->getDescription());
1163 TypeToResolve->refineAbstractTypeTo(Ty);
1169 // common code from the two 'RunVMAsmParser' functions
1170 static Module* RunParser(Module * M) {
1172 llvmAsmlineno = 1; // Reset the current line number...
1173 ObsoleteVarArgs = false;
1175 CurModule.CurrentModule = M;
1177 // Check to make sure the parser succeeded
1180 delete ParserResult;
1184 // Check to make sure that parsing produced a result
1188 // Reset ParserResult variable while saving its value for the result.
1189 Module *Result = ParserResult;
1192 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1195 if ((F = Result->getNamedFunction("llvm.va_start"))
1196 && F->getFunctionType()->getNumParams() == 0)
1197 ObsoleteVarArgs = true;
1198 if((F = Result->getNamedFunction("llvm.va_copy"))
1199 && F->getFunctionType()->getNumParams() == 1)
1200 ObsoleteVarArgs = true;
1203 if (ObsoleteVarArgs && NewVarArgs) {
1205 "This file is corrupt: it uses both new and old style varargs");
1209 if(ObsoleteVarArgs) {
1210 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1211 if (F->arg_size() != 0) {
1212 GenerateError("Obsolete va_start takes 0 argument!");
1218 //bar = alloca typeof(foo)
1222 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1223 const Type* ArgTy = F->getFunctionType()->getReturnType();
1224 const Type* ArgTyPtr = PointerType::get(ArgTy);
1225 Function* NF = Result->getOrInsertFunction("llvm.va_start",
1226 RetTy, ArgTyPtr, (Type *)0);
1228 while (!F->use_empty()) {
1229 CallInst* CI = cast<CallInst>(F->use_back());
1230 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1231 new CallInst(NF, bar, "", CI);
1232 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1233 CI->replaceAllUsesWith(foo);
1234 CI->getParent()->getInstList().erase(CI);
1236 Result->getFunctionList().erase(F);
1239 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1240 if(F->arg_size() != 1) {
1241 GenerateError("Obsolete va_end takes 1 argument!");
1247 //bar = alloca 1 of typeof(foo)
1249 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1250 const Type* ArgTy = F->getFunctionType()->getParamType(0);
1251 const Type* ArgTyPtr = PointerType::get(ArgTy);
1252 Function* NF = Result->getOrInsertFunction("llvm.va_end",
1253 RetTy, ArgTyPtr, (Type *)0);
1255 while (!F->use_empty()) {
1256 CallInst* CI = cast<CallInst>(F->use_back());
1257 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1258 new StoreInst(CI->getOperand(1), bar, CI);
1259 new CallInst(NF, bar, "", CI);
1260 CI->getParent()->getInstList().erase(CI);
1262 Result->getFunctionList().erase(F);
1265 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1266 if(F->arg_size() != 1) {
1267 GenerateError("Obsolete va_copy takes 1 argument!");
1272 //a = alloca 1 of typeof(foo)
1273 //b = alloca 1 of typeof(foo)
1278 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1279 const Type* ArgTy = F->getFunctionType()->getReturnType();
1280 const Type* ArgTyPtr = PointerType::get(ArgTy);
1281 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
1282 RetTy, ArgTyPtr, ArgTyPtr,
1285 while (!F->use_empty()) {
1286 CallInst* CI = cast<CallInst>(F->use_back());
1287 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1288 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1289 new StoreInst(CI->getOperand(1), b, CI);
1290 new CallInst(NF, a, b, "", CI);
1291 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1292 CI->replaceAllUsesWith(foo);
1293 CI->getParent()->getInstList().erase(CI);
1295 Result->getFunctionList().erase(F);
1302 //===----------------------------------------------------------------------===//
1303 // RunVMAsmParser - Define an interface to this parser
1304 //===----------------------------------------------------------------------===//
1306 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1309 CurFilename = Filename;
1310 return RunParser(new Module(CurFilename));
1313 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1314 set_scan_string(AsmString);
1316 CurFilename = "from_memory";
1318 return RunParser(new Module (CurFilename));
1320 return RunParser(M);
1326 /* Enabling traces. */
1331 /* Enabling verbose error messages. */
1332 #ifdef YYERROR_VERBOSE
1333 # undef YYERROR_VERBOSE
1334 # define YYERROR_VERBOSE 1
1336 # define YYERROR_VERBOSE 0
1339 /* Enabling the token table. */
1340 #ifndef YYTOKEN_TABLE
1341 # define YYTOKEN_TABLE 0
1344 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1345 #line 968 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
1346 typedef union YYSTYPE {
1347 llvm::Module *ModuleVal;
1348 llvm::Function *FunctionVal;
1349 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1350 llvm::BasicBlock *BasicBlockVal;
1351 llvm::TerminatorInst *TermInstVal;
1352 llvm::Instruction *InstVal;
1353 llvm::Constant *ConstVal;
1355 const llvm::Type *PrimType;
1356 llvm::PATypeHolder *TypeVal;
1357 llvm::Value *ValueVal;
1359 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1360 std::vector<llvm::Value*> *ValueList;
1361 std::list<llvm::PATypeHolder> *TypeList;
1362 // Represent the RHS of PHI node
1363 std::list<std::pair<llvm::Value*,
1364 llvm::BasicBlock*> > *PHIList;
1365 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1366 std::vector<llvm::Constant*> *ConstVector;
1368 llvm::GlobalValue::LinkageTypes Linkage;
1376 char *StrVal; // This memory is strdup'd!
1377 llvm::ValID ValIDVal; // strdup'd memory maybe!
1379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
1384 llvm::Module::Endianness Endianness;
1385 llvm::ICmpInst::Predicate IPredicate;
1386 llvm::FCmpInst::Predicate FPredicate;
1388 /* Line 196 of yacc.c. */
1389 #line 1390 "llvmAsmParser.tab.c"
1390 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391 # define YYSTYPE_IS_DECLARED 1
1392 # define YYSTYPE_IS_TRIVIAL 1
1397 /* Copy the second part of user declarations. */
1400 /* Line 219 of yacc.c. */
1401 #line 1402 "llvmAsmParser.tab.c"
1403 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1404 # define YYSIZE_T __SIZE_TYPE__
1406 #if ! defined (YYSIZE_T) && defined (size_t)
1407 # define YYSIZE_T size_t
1409 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1410 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1411 # define YYSIZE_T size_t
1413 #if ! defined (YYSIZE_T)
1414 # define YYSIZE_T unsigned int
1420 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1421 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1425 # define YY_(msgid) msgid
1429 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1431 /* The parser invokes alloca or malloc; define the necessary symbols. */
1433 # ifdef YYSTACK_USE_ALLOCA
1434 # if YYSTACK_USE_ALLOCA
1436 # define YYSTACK_ALLOC __builtin_alloca
1438 # define YYSTACK_ALLOC alloca
1439 # if defined (__STDC__) || defined (__cplusplus)
1440 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1441 # define YYINCLUDED_STDLIB_H
1447 # ifdef YYSTACK_ALLOC
1448 /* Pacify GCC's `empty if-body' warning. */
1449 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1450 # ifndef YYSTACK_ALLOC_MAXIMUM
1451 /* The OS might guarantee only one guard page at the bottom of the stack,
1452 and a page size can be as small as 4096 bytes. So we cannot safely
1453 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1454 to allow for a few compiler-allocated temporary stack slots. */
1455 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1458 # define YYSTACK_ALLOC YYMALLOC
1459 # define YYSTACK_FREE YYFREE
1460 # ifndef YYSTACK_ALLOC_MAXIMUM
1461 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1467 # define YYMALLOC malloc
1468 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1469 && (defined (__STDC__) || defined (__cplusplus)))
1470 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1474 # define YYFREE free
1475 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1476 && (defined (__STDC__) || defined (__cplusplus)))
1477 void free (void *); /* INFRINGES ON USER NAME SPACE */
1484 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1487 #if (! defined (yyoverflow) \
1488 && (! defined (__cplusplus) \
1489 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1491 /* A type that is properly aligned for any stack member. */
1498 /* The size of the maximum gap between one aligned stack and the next. */
1499 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1501 /* The size of an array large to enough to hold all stacks, each with
1503 # define YYSTACK_BYTES(N) \
1504 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1505 + YYSTACK_GAP_MAXIMUM)
1507 /* Copy COUNT objects from FROM to TO. The source and destination do
1510 # if defined (__GNUC__) && 1 < __GNUC__
1511 # define YYCOPY(To, From, Count) \
1512 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1514 # define YYCOPY(To, From, Count) \
1518 for (yyi = 0; yyi < (Count); yyi++) \
1519 (To)[yyi] = (From)[yyi]; \
1525 /* Relocate STACK from its old location to the new one. The
1526 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1527 elements in the stack, and YYPTR gives the new location of the
1528 stack. Advance YYPTR to a properly aligned location for the next
1530 # define YYSTACK_RELOCATE(Stack) \
1533 YYSIZE_T yynewbytes; \
1534 YYCOPY (&yyptr->Stack, Stack, yysize); \
1535 Stack = &yyptr->Stack; \
1536 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1537 yyptr += yynewbytes / sizeof (*yyptr); \
1543 #if defined (__STDC__) || defined (__cplusplus)
1544 typedef signed char yysigned_char;
1546 typedef short int yysigned_char;
1549 /* YYFINAL -- State number of the termination state. */
1551 /* YYLAST -- Last index in YYTABLE. */
1554 /* YYNTOKENS -- Number of terminals. */
1555 #define YYNTOKENS 165
1556 /* YYNNTS -- Number of nonterminals. */
1558 /* YYNRULES -- Number of rules. */
1559 #define YYNRULES 297
1560 /* YYNRULES -- Number of states. */
1561 #define YYNSTATES 586
1563 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1564 #define YYUNDEFTOK 2
1565 #define YYMAXUTOK 405
1567 #define YYTRANSLATE(YYX) \
1568 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1570 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1571 static const unsigned char yytranslate[] =
1573 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1577 154, 155, 163, 2, 152, 2, 2, 2, 2, 2,
1578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1579 159, 151, 160, 2, 2, 2, 2, 2, 2, 2,
1580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1582 2, 156, 153, 158, 2, 2, 2, 2, 2, 164,
1583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1585 157, 2, 2, 161, 2, 162, 2, 2, 2, 2,
1586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1598 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1599 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1600 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1601 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1602 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1603 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1604 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1605 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1606 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1607 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1608 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1609 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1610 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1611 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1612 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1613 145, 146, 147, 148, 149, 150
1617 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1619 static const unsigned short int yyprhs[] =
1621 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1622 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1623 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1624 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1625 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1626 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1627 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1628 139, 141, 143, 145, 147, 149, 152, 153, 155, 157,
1629 159, 161, 163, 165, 167, 168, 169, 171, 173, 175,
1630 177, 179, 181, 184, 185, 188, 189, 193, 196, 197,
1631 199, 200, 204, 206, 209, 211, 213, 215, 217, 219,
1632 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1633 241, 243, 245, 247, 249, 251, 254, 259, 265, 271,
1634 275, 278, 281, 283, 287, 289, 293, 295, 296, 301,
1635 305, 309, 314, 319, 323, 326, 329, 332, 335, 338,
1636 341, 344, 347, 350, 353, 360, 366, 375, 382, 389,
1637 396, 405, 414, 421, 428, 437, 446, 450, 452, 454,
1638 456, 458, 461, 464, 469, 472, 474, 479, 482, 487,
1639 488, 496, 497, 505, 506, 514, 515, 523, 527, 532,
1640 533, 535, 537, 539, 543, 547, 551, 555, 559, 563,
1641 565, 566, 568, 570, 572, 573, 576, 580, 582, 584,
1642 588, 590, 591, 600, 602, 604, 608, 610, 612, 615,
1643 616, 618, 620, 621, 626, 627, 629, 631, 633, 635,
1644 637, 639, 641, 643, 645, 649, 651, 657, 659, 661,
1645 663, 665, 668, 671, 674, 678, 681, 682, 684, 687,
1646 690, 694, 704, 714, 723, 737, 739, 741, 748, 754,
1647 757, 764, 772, 774, 778, 780, 781, 784, 786, 792,
1648 798, 804, 811, 818, 821, 826, 831, 838, 843, 848,
1649 853, 858, 865, 872, 875, 883, 885, 888, 889, 891,
1650 892, 896, 903, 907, 914, 917, 922, 929
1653 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1654 static const short int yyrhs[] =
1656 199, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1657 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1658 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1659 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1660 -1, 93, -1, 94, -1, 95, -1, 128, -1, 129,
1661 -1, 130, -1, 131, -1, 132, -1, 133, -1, 134,
1662 -1, 135, -1, 136, -1, 137, -1, 138, -1, 139,
1663 -1, 142, -1, 143, -1, 144, -1, 98, -1, 99,
1664 -1, 100, -1, 101, -1, 102, -1, 103, -1, 104,
1665 -1, 105, -1, 106, -1, 107, -1, 108, -1, 109,
1666 -1, 110, -1, 111, -1, 112, -1, 113, -1, 114,
1667 -1, 115, -1, 116, -1, 117, -1, 118, -1, 119,
1668 -1, 120, -1, 121, -1, 16, -1, 14, -1, 12,
1669 -1, 10, -1, 17, -1, 15, -1, 13, -1, 11,
1670 -1, 175, -1, 176, -1, 18, -1, 19, -1, 211,
1671 151, -1, -1, 41, -1, 42, -1, 43, -1, 44,
1672 -1, 45, -1, 46, -1, 47, -1, -1, -1, 65,
1673 -1, 66, -1, 67, -1, 68, -1, 69, -1, 70,
1674 -1, 64, 4, -1, -1, 57, 4, -1, -1, 152,
1675 57, 4, -1, 34, 24, -1, -1, 184, -1, -1,
1676 152, 187, 186, -1, 184, -1, 57, 4, -1, 190,
1677 -1, 8, -1, 192, -1, 8, -1, 192, -1, 9,
1678 -1, 10, -1, 11, -1, 12, -1, 13, -1, 14,
1679 -1, 15, -1, 16, -1, 17, -1, 18, -1, 19,
1680 -1, 20, -1, 21, -1, 48, -1, 191, -1, 226,
1681 -1, 153, 4, -1, 189, 154, 194, 155, -1, 156,
1682 4, 157, 192, 158, -1, 159, 4, 157, 192, 160,
1683 -1, 161, 193, 162, -1, 161, 162, -1, 192, 163,
1684 -1, 192, -1, 193, 152, 192, -1, 193, -1, 193,
1685 152, 37, -1, 37, -1, -1, 190, 156, 197, 158,
1686 -1, 190, 156, 158, -1, 190, 164, 24, -1, 190,
1687 159, 197, 160, -1, 190, 161, 197, 162, -1, 190,
1688 161, 162, -1, 190, 38, -1, 190, 39, -1, 190,
1689 226, -1, 190, 196, -1, 190, 26, -1, 175, 167,
1690 -1, 176, 4, -1, 9, 27, -1, 9, 28, -1,
1691 178, 7, -1, 171, 154, 195, 36, 190, 155, -1,
1692 127, 154, 195, 240, 155, -1, 141, 154, 195, 152,
1693 195, 152, 195, 155, -1, 168, 154, 195, 152, 195,
1694 155, -1, 169, 154, 195, 152, 195, 155, -1, 170,
1695 154, 195, 152, 195, 155, -1, 96, 154, 173, 152,
1696 195, 152, 195, 155, -1, 97, 154, 174, 152, 195,
1697 152, 195, 155, -1, 172, 154, 195, 152, 195, 155,
1698 -1, 146, 154, 195, 152, 195, 155, -1, 147, 154,
1699 195, 152, 195, 152, 195, 155, -1, 148, 154, 195,
1700 152, 195, 152, 195, 155, -1, 197, 152, 195, -1,
1701 195, -1, 32, -1, 33, -1, 200, -1, 200, 220,
1702 -1, 200, 222, -1, 200, 62, 61, 206, -1, 200,
1703 25, -1, 201, -1, 201, 179, 20, 188, -1, 201,
1704 222, -1, 201, 62, 61, 206, -1, -1, 201, 179,
1705 180, 198, 195, 202, 186, -1, -1, 201, 179, 50,
1706 198, 190, 203, 186, -1, -1, 201, 179, 45, 198,
1707 190, 204, 186, -1, -1, 201, 179, 47, 198, 190,
1708 205, 186, -1, 201, 51, 208, -1, 201, 58, 151,
1709 209, -1, -1, 24, -1, 56, -1, 55, -1, 53,
1710 151, 207, -1, 54, 151, 4, -1, 52, 151, 24,
1711 -1, 71, 151, 24, -1, 156, 210, 158, -1, 210,
1712 152, 24, -1, 24, -1, -1, 22, -1, 24, -1,
1713 211, -1, -1, 190, 212, -1, 214, 152, 213, -1,
1714 213, -1, 214, -1, 214, 152, 37, -1, 37, -1,
1715 -1, 181, 188, 211, 154, 215, 155, 185, 182, -1,
1716 29, -1, 161, -1, 180, 216, 217, -1, 30, -1,
1717 162, -1, 229, 219, -1, -1, 45, -1, 47, -1,
1718 -1, 31, 223, 221, 216, -1, -1, 63, -1, 3,
1719 -1, 4, -1, 7, -1, 27, -1, 28, -1, 38,
1720 -1, 39, -1, 26, -1, 159, 197, 160, -1, 196,
1721 -1, 61, 224, 24, 152, 24, -1, 166, -1, 211,
1722 -1, 226, -1, 225, -1, 190, 227, -1, 229, 230,
1723 -1, 218, 230, -1, 231, 179, 232, -1, 231, 234,
1724 -1, -1, 23, -1, 72, 228, -1, 72, 8, -1,
1725 73, 21, 227, -1, 73, 9, 227, 152, 21, 227,
1726 152, 21, 227, -1, 74, 177, 227, 152, 21, 227,
1727 156, 233, 158, -1, 74, 177, 227, 152, 21, 227,
1728 156, 158, -1, 75, 181, 188, 227, 154, 237, 155,
1729 36, 21, 227, 76, 21, 227, -1, 76, -1, 77,
1730 -1, 233, 177, 225, 152, 21, 227, -1, 177, 225,
1731 152, 21, 227, -1, 179, 239, -1, 190, 156, 227,
1732 152, 227, 158, -1, 235, 152, 156, 227, 152, 227,
1733 158, -1, 228, -1, 236, 152, 228, -1, 236, -1,
1734 -1, 60, 59, -1, 59, -1, 168, 190, 227, 152,
1735 227, -1, 169, 190, 227, 152, 227, -1, 170, 190,
1736 227, 152, 227, -1, 96, 173, 190, 227, 152, 227,
1737 -1, 97, 174, 190, 227, 152, 227, -1, 49, 228,
1738 -1, 172, 228, 152, 228, -1, 171, 228, 36, 190,
1739 -1, 141, 228, 152, 228, 152, 228, -1, 145, 228,
1740 152, 190, -1, 149, 228, 152, 190, -1, 150, 228,
1741 152, 190, -1, 146, 228, 152, 228, -1, 147, 228,
1742 152, 228, 152, 228, -1, 148, 228, 152, 228, 152,
1743 228, -1, 140, 235, -1, 238, 181, 188, 227, 154,
1744 237, 155, -1, 242, -1, 152, 236, -1, -1, 35,
1745 -1, -1, 122, 190, 183, -1, 122, 190, 152, 15,
1746 227, 183, -1, 123, 190, 183, -1, 123, 190, 152,
1747 15, 227, 183, -1, 124, 228, -1, 241, 125, 190,
1748 227, -1, 241, 126, 228, 152, 190, 227, -1, 127,
1752 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1753 static const unsigned short int yyrline[] =
1755 0, 1105, 1105, 1106, 1114, 1115, 1125, 1125, 1125, 1125,
1756 1125, 1125, 1125, 1125, 1125, 1126, 1126, 1126, 1127, 1127,
1757 1127, 1127, 1127, 1127, 1128, 1128, 1128, 1128, 1128, 1128,
1758 1129, 1129, 1129, 1129, 1129, 1129, 1130, 1130, 1130, 1131,
1759 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1132,
1760 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1133, 1133, 1133,
1761 1133, 1133, 1133, 1137, 1137, 1137, 1137, 1138, 1138, 1138,
1762 1138, 1139, 1139, 1140, 1140, 1143, 1147, 1152, 1153, 1154,
1763 1155, 1156, 1157, 1158, 1159, 1161, 1162, 1163, 1164, 1165,
1764 1166, 1167, 1168, 1177, 1178, 1184, 1185, 1193, 1201, 1202,
1765 1207, 1208, 1209, 1214, 1228, 1228, 1229, 1229, 1231, 1241,
1766 1241, 1241, 1241, 1241, 1241, 1241, 1242, 1242, 1242, 1242,
1767 1242, 1242, 1243, 1247, 1251, 1259, 1267, 1280, 1285, 1297,
1768 1307, 1311, 1322, 1327, 1333, 1334, 1338, 1342, 1353, 1379,
1769 1393, 1423, 1449, 1470, 1483, 1493, 1498, 1559, 1566, 1574,
1770 1580, 1586, 1590, 1594, 1602, 1614, 1646, 1654, 1678, 1689,
1771 1695, 1700, 1705, 1714, 1720, 1726, 1735, 1739, 1747, 1747,
1772 1757, 1765, 1770, 1774, 1778, 1782, 1797, 1819, 1822, 1825,
1773 1825, 1833, 1833, 1841, 1841, 1849, 1849, 1858, 1861, 1864,
1774 1868, 1881, 1882, 1884, 1888, 1897, 1901, 1906, 1908, 1913,
1775 1918, 1927, 1927, 1928, 1928, 1930, 1937, 1943, 1950, 1954,
1776 1960, 1965, 1970, 2065, 2065, 2067, 2075, 2075, 2077, 2082,
1777 2083, 2084, 2086, 2086, 2096, 2100, 2105, 2109, 2113, 2117,
1778 2121, 2125, 2129, 2133, 2137, 2162, 2166, 2180, 2184, 2190,
1779 2190, 2196, 2201, 2205, 2214, 2225, 2234, 2246, 2259, 2263,
1780 2267, 2272, 2281, 2300, 2309, 2365, 2369, 2376, 2387, 2400,
1781 2409, 2418, 2428, 2432, 2439, 2439, 2441, 2445, 2450, 2469,
1782 2484, 2498, 2509, 2520, 2533, 2542, 2553, 2561, 2567, 2587,
1783 2610, 2616, 2622, 2628, 2643, 2702, 2709, 2712, 2717, 2721,
1784 2728, 2733, 2739, 2744, 2750, 2758, 2770, 2785
1788 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1789 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1790 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1791 static const char *const yytname[] =
1793 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1794 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1795 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1796 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1797 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1798 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1799 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1800 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1801 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1802 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1803 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1804 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1805 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1806 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1807 "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP",
1808 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1809 "UGE", "ORDEQ", "ORDNE", "ORDLT", "ORDGT", "ORDLE", "ORDGE", "ORD",
1810 "UNO", "UNOEQ", "UNONE", "UNOLT", "UNOGT", "UNOLE", "UNOGE", "MALLOC",
1811 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1812 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1813 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR",
1814 "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1815 "VAARG_old", "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['",
1816 "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept",
1817 "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps",
1818 "CastOps", "ShiftOps", "IPredicates", "FPredicates", "SIntType",
1819 "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage",
1820 "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1821 "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV",
1822 "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal",
1823 "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList",
1824 "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle",
1825 "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName",
1826 "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1827 "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto",
1828 "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1829 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1830 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList",
1831 "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile",
1837 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1839 static const unsigned short int yytoknum[] =
1841 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1842 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1843 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1844 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1845 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1846 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1847 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1848 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1849 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1850 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1851 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1852 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1853 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1854 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1855 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1856 405, 61, 44, 92, 40, 41, 91, 120, 93, 60,
1857 62, 123, 125, 42, 99
1861 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1862 static const unsigned char yyr1[] =
1864 0, 165, 166, 166, 167, 167, 168, 168, 168, 168,
1865 168, 168, 168, 168, 168, 169, 169, 169, 170, 170,
1866 170, 170, 170, 170, 171, 171, 171, 171, 171, 171,
1867 171, 171, 171, 171, 171, 171, 172, 172, 172, 173,
1868 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1869 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
1870 174, 174, 174, 175, 175, 175, 175, 176, 176, 176,
1871 176, 177, 177, 178, 178, 179, 179, 180, 180, 180,
1872 180, 180, 180, 180, 180, 181, 181, 181, 181, 181,
1873 181, 181, 181, 182, 182, 183, 183, 184, 185, 185,
1874 186, 186, 187, 187, 188, 188, 189, 189, 190, 191,
1875 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
1876 191, 191, 192, 192, 192, 192, 192, 192, 192, 192,
1877 192, 192, 193, 193, 194, 194, 194, 194, 195, 195,
1878 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1879 195, 195, 195, 195, 196, 196, 196, 196, 196, 196,
1880 196, 196, 196, 196, 196, 196, 197, 197, 198, 198,
1881 199, 200, 200, 200, 200, 200, 201, 201, 201, 202,
1882 201, 203, 201, 204, 201, 205, 201, 201, 201, 201,
1883 206, 207, 207, 208, 208, 208, 208, 209, 210, 210,
1884 210, 211, 211, 212, 212, 213, 214, 214, 215, 215,
1885 215, 215, 216, 217, 217, 218, 219, 219, 220, 221,
1886 221, 221, 223, 222, 224, 224, 225, 225, 225, 225,
1887 225, 225, 225, 225, 225, 225, 225, 226, 226, 227,
1888 227, 228, 229, 229, 230, 231, 231, 231, 232, 232,
1889 232, 232, 232, 232, 232, 232, 232, 233, 233, 234,
1890 235, 235, 236, 236, 237, 237, 238, 238, 239, 239,
1891 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
1892 239, 239, 239, 239, 239, 239, 240, 240, 241, 241,
1893 242, 242, 242, 242, 242, 242, 242, 242
1896 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1897 static const unsigned char yyr2[] =
1899 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1900 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1901 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1902 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1903 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1904 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1905 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1906 1, 1, 1, 1, 1, 2, 0, 1, 1, 1,
1907 1, 1, 1, 1, 0, 0, 1, 1, 1, 1,
1908 1, 1, 2, 0, 2, 0, 3, 2, 0, 1,
1909 0, 3, 1, 2, 1, 1, 1, 1, 1, 1,
1910 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1911 1, 1, 1, 1, 1, 2, 4, 5, 5, 3,
1912 2, 2, 1, 3, 1, 3, 1, 0, 4, 3,
1913 3, 4, 4, 3, 2, 2, 2, 2, 2, 2,
1914 2, 2, 2, 2, 6, 5, 8, 6, 6, 6,
1915 8, 8, 6, 6, 8, 8, 3, 1, 1, 1,
1916 1, 2, 2, 4, 2, 1, 4, 2, 4, 0,
1917 7, 0, 7, 0, 7, 0, 7, 3, 4, 0,
1918 1, 1, 1, 3, 3, 3, 3, 3, 3, 1,
1919 0, 1, 1, 1, 0, 2, 3, 1, 1, 3,
1920 1, 0, 8, 1, 1, 3, 1, 1, 2, 0,
1921 1, 1, 0, 4, 0, 1, 1, 1, 1, 1,
1922 1, 1, 1, 1, 3, 1, 5, 1, 1, 1,
1923 1, 2, 2, 2, 3, 2, 0, 1, 2, 2,
1924 3, 9, 9, 8, 13, 1, 1, 6, 5, 2,
1925 6, 7, 1, 3, 1, 0, 2, 1, 5, 5,
1926 5, 6, 6, 2, 4, 4, 6, 4, 4, 4,
1927 4, 6, 6, 2, 7, 1, 2, 0, 1, 0,
1928 3, 6, 3, 6, 2, 4, 6, 4
1931 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1932 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1933 means the default is an error. */
1934 static const unsigned short int yydefact[] =
1936 189, 0, 84, 175, 1, 174, 222, 77, 78, 79,
1937 80, 81, 82, 83, 0, 85, 246, 171, 172, 246,
1938 201, 202, 0, 0, 0, 84, 0, 177, 219, 0,
1939 0, 86, 87, 88, 89, 90, 91, 0, 0, 247,
1940 243, 76, 216, 217, 218, 242, 0, 0, 0, 0,
1941 187, 0, 0, 0, 0, 0, 0, 0, 75, 220,
1942 221, 85, 190, 173, 92, 2, 3, 105, 109, 110,
1943 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
1944 121, 122, 0, 0, 0, 0, 237, 0, 0, 104,
1945 123, 108, 238, 124, 213, 214, 215, 289, 245, 0,
1946 0, 0, 0, 200, 188, 178, 176, 168, 169, 0,
1947 0, 0, 0, 223, 125, 0, 0, 107, 130, 132,
1948 0, 0, 137, 131, 288, 0, 267, 0, 0, 0,
1949 0, 85, 255, 256, 6, 7, 8, 9, 10, 11,
1950 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1951 22, 23, 0, 0, 0, 0, 0, 0, 24, 25,
1952 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1953 0, 0, 36, 37, 38, 0, 0, 0, 0, 0,
1954 0, 0, 0, 0, 0, 0, 244, 85, 259, 0,
1955 285, 195, 192, 191, 193, 194, 196, 199, 0, 183,
1956 185, 181, 109, 110, 111, 112, 113, 114, 115, 116,
1957 117, 118, 119, 0, 0, 0, 0, 179, 0, 0,
1958 0, 129, 211, 136, 134, 0, 0, 273, 266, 249,
1959 248, 0, 0, 66, 70, 65, 69, 64, 68, 63,
1960 67, 71, 72, 0, 0, 39, 40, 41, 42, 43,
1961 44, 45, 46, 47, 48, 0, 49, 50, 51, 52,
1962 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
1963 0, 95, 95, 294, 0, 0, 283, 0, 0, 0,
1964 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1965 0, 0, 0, 197, 100, 100, 100, 151, 152, 4,
1966 5, 149, 150, 153, 148, 144, 145, 0, 0, 0,
1967 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1968 0, 0, 0, 147, 146, 100, 106, 106, 133, 210,
1969 204, 207, 208, 0, 0, 126, 226, 227, 228, 233,
1970 229, 230, 231, 232, 224, 0, 235, 240, 239, 241,
1971 0, 250, 0, 0, 0, 0, 0, 290, 0, 292,
1972 287, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1973 0, 0, 0, 0, 0, 0, 0, 0, 198, 0,
1974 184, 186, 182, 0, 0, 0, 0, 0, 0, 0,
1975 139, 167, 0, 0, 143, 0, 140, 0, 0, 0,
1976 0, 0, 180, 127, 128, 203, 205, 0, 98, 135,
1977 225, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1978 0, 0, 297, 0, 0, 0, 277, 280, 0, 0,
1979 278, 279, 0, 0, 0, 275, 274, 0, 295, 0,
1980 0, 0, 102, 100, 0, 0, 287, 0, 0, 0,
1981 0, 0, 138, 141, 142, 0, 0, 0, 0, 0,
1982 209, 206, 99, 93, 0, 234, 0, 0, 265, 0,
1983 0, 95, 96, 95, 262, 286, 0, 0, 0, 0,
1984 0, 268, 269, 270, 265, 0, 97, 103, 101, 0,
1985 0, 0, 0, 0, 0, 0, 166, 0, 0, 0,
1986 0, 0, 0, 212, 0, 0, 0, 264, 0, 271,
1987 272, 0, 291, 293, 0, 0, 0, 276, 281, 282,
1988 0, 296, 0, 0, 155, 0, 0, 0, 0, 0,
1989 0, 0, 0, 0, 94, 236, 0, 0, 0, 263,
1990 260, 0, 284, 0, 0, 0, 163, 0, 0, 157,
1991 158, 159, 154, 162, 0, 253, 0, 0, 0, 261,
1992 0, 0, 0, 0, 0, 251, 0, 252, 0, 0,
1993 160, 161, 156, 164, 165, 0, 0, 0, 0, 0,
1994 0, 258, 0, 0, 257, 254
1997 /* YYDEFGOTO[NTERM-NUM]. */
1998 static const short int yydefgoto[] =
2000 -1, 86, 301, 318, 319, 320, 321, 322, 255, 270,
2001 213, 214, 243, 215, 25, 15, 37, 503, 357, 442,
2002 463, 380, 443, 87, 88, 216, 90, 91, 120, 225,
2003 391, 346, 392, 109, 1, 2, 3, 325, 296, 294,
2004 295, 63, 194, 50, 104, 198, 92, 406, 331, 332,
2005 333, 38, 96, 16, 44, 17, 61, 18, 28, 411,
2006 347, 93, 349, 474, 19, 40, 41, 186, 557, 98,
2007 276, 507, 508, 187, 188, 422, 189, 190
2010 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2012 #define YYPACT_NINF -531
2013 static const short int yypact[] =
2015 -531, 114, 234, 65, -531, -531, -531, -531, -531, -531,
2016 -531, -531, -531, -531, 74, 132, 47, -531, -531, -13,
2017 -531, -531, 24, -15, 98, 145, 13, -531, 84, 153,
2018 175, -531, -531, -531, -531, -531, -531, 1181, -24, -531,
2019 -531, 108, -531, -531, -531, -531, 29, 30, 32, 33,
2020 -531, 26, 153, 1181, 10, 10, 10, 10, -531, -531,
2021 -531, 132, -531, -531, -531, -531, -531, 50, -531, -531,
2022 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2023 -531, -531, 202, 204, 205, 593, -531, 108, 56, -531,
2024 -531, -70, -531, -531, -531, -531, -531, 1353, -531, 187,
2025 70, 209, 190, 192, -531, -531, -531, -531, -531, 1201,
2026 1201, 1201, 1242, -531, -531, 62, 63, -531, -531, -70,
2027 -140, 68, 982, -531, -531, 1201, -531, 164, 1262, 0,
2028 273, 132, -531, -531, -531, -531, -531, -531, -531, -531,
2029 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2030 -531, -531, 216, 516, 1201, 1201, 1201, 1201, -531, -531,
2031 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2032 1201, 1201, -531, -531, -531, 1201, 1201, 1201, 1201, 1201,
2033 1201, 1201, 1201, 1201, 1201, 1201, -531, 132, -531, 31,
2034 -531, -531, -531, -531, -531, -531, -531, -531, -72, -531,
2035 -531, -531, 133, 159, 220, 163, 221, 165, 222, 167,
2036 223, 225, 228, 172, 224, 229, 433, -531, 1201, 1201,
2037 1201, -531, 1023, -531, 85, 83, 684, -531, -531, 50,
2038 -531, 684, 684, -531, -531, -531, -531, -531, -531, -531,
2039 -531, -531, -531, 684, 1181, -531, -531, -531, -531, -531,
2040 -531, -531, -531, -531, -531, 1201, -531, -531, -531, -531,
2041 -531, -531, -531, -531, -531, -531, -531, -531, -531, -531,
2042 1201, 88, 89, -531, 684, 86, 91, 92, 93, 95,
2043 99, 103, 104, 106, 684, 684, 684, 226, 109, 1181,
2044 1201, 1201, 236, -531, 116, 116, 116, -531, -531, -531,
2045 -531, -531, -531, -531, -531, -531, -531, 117, 118, 120,
2046 143, 144, 148, 154, 927, 1242, 648, 246, 155, 156,
2047 157, 170, 171, -531, -531, 116, -59, -39, -70, -531,
2048 108, -531, 147, 179, 1084, -531, -531, -531, -531, -531,
2049 -531, -531, -531, -531, 272, 1242, -531, -531, -531, -531,
2050 186, -531, 188, 684, 684, 684, -1, -531, 9, -531,
2051 189, 684, 183, 1201, 1201, 1201, 1201, 1201, 1201, 1201,
2052 193, 194, 195, 1201, 1201, 684, 684, 196, -531, -19,
2053 -531, -531, -531, 216, 516, 1242, 1242, 1242, 1242, 1242,
2054 -531, -531, -30, -60, -531, -83, -531, 1242, 1242, 1242,
2055 1242, 1242, -531, -531, -531, -531, -531, 1140, 308, -531,
2056 -531, 320, -47, 328, 329, 198, 206, 207, 684, 352,
2057 684, 1201, -531, 208, 684, 212, -531, -531, 213, 215,
2058 -531, -531, 684, 684, 684, -531, -531, 214, -531, 1201,
2059 345, 367, -531, 116, 230, 231, 189, 233, 235, 237,
2060 238, 1242, -531, -531, -531, 239, 240, 241, 336, 242,
2061 -531, -531, -531, 316, 254, -531, 684, 684, 1201, 684,
2062 684, 258, -531, 258, -531, 259, 684, 260, 1201, 1201,
2063 1201, -531, -531, -531, 1201, 684, -531, -531, -531, 1242,
2064 1242, 219, 1242, 1242, 1242, 1242, -531, 1242, 1242, 1242,
2065 1201, 1242, 372, -531, 353, 261, 232, 259, 262, -531,
2066 -531, 321, -531, -531, 1201, 256, 684, -531, -531, -531,
2067 263, -531, 264, 267, -531, 268, 266, 274, 275, 270,
2068 277, 278, 279, 280, -531, -531, 360, 20, 350, -531,
2069 -531, 257, -531, 1242, 1242, 1242, -531, 1242, 1242, -531,
2070 -531, -531, -531, -531, 684, -531, 830, 35, 415, -531,
2071 282, 285, 291, 293, 297, -531, 304, -531, 830, 684,
2072 -531, -531, -531, -531, -531, 437, 309, 384, 684, 441,
2073 443, -531, 684, 684, -531, -531
2076 /* YYPGOTO[NTERM-NUM]. */
2077 static const short int yypgoto[] =
2079 -531, -531, -531, 368, 369, 370, 371, 373, 90, 94,
2080 -129, -128, -530, -531, 428, 449, -112, -531, -268, 67,
2081 -531, -231, -531, -50, -531, -37, -531, -65, 354, -531,
2082 -94, 265, -290, 46, -531, -531, -531, -531, -531, -531,
2083 -531, 427, -531, -531, -531, -531, 3, -531, 73, -531,
2084 -531, 421, -531, -531, -531, -531, -531, 480, -531, -531,
2085 -515, -203, 69, -117, -531, 465, -531, -531, -531, -531,
2086 -531, 64, 2, -531, -531, 42, -531, -531
2089 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2090 positive, shift that token. If negative, reduce the rule which
2091 number is the opposite. If zero, do what YYDEFACT says.
2092 If YYTABLE_NINF, syntax error. */
2093 #define YYTABLE_NINF -171
2094 static const short int yytable[] =
2096 89, 241, 242, 106, 359, 94, 26, 556, 227, 231,
2097 39, 230, 220, 324, 418, 440, 89, 42, 217, 244,
2098 119, 232, 221, 348, 420, 393, 395, 568, 348, 348,
2099 233, 234, 235, 236, 237, 238, 239, 240, 441, 273,
2100 348, 566, 107, 108, 26, 233, 234, 235, 236, 237,
2101 238, 239, 240, 576, 277, 412, 419, 119, 278, 279,
2102 280, 281, 282, 283, 381, 382, 419, 287, 288, 451,
2103 39, 348, 199, 200, 201, 289, 46, 47, 48, 454,
2104 292, 348, 348, 348, -106, -76, 293, 20, 226, 21,
2105 121, 226, 451, 123, 402, 49, 6, -76, -76, 403,
2106 453, 110, 111, 112, 123, 451, -76, -76, -76, -76,
2107 -76, -76, -76, 465, 4, -76, 22, 271, 272, 226,
2108 274, 404, 451, 23, 123, 192, 193, 24, 452, 59,
2109 20, 60, 21, 275, 226, 29, 51, 95, 226, 226,
2110 226, 226, 226, 226, 284, 285, 286, 226, 226, 43,
2111 348, 348, 348, 326, 327, 328, 290, 291, 348, 52,
2112 297, 298, -66, -66, 58, 53, -65, -65, -64, -64,
2113 -63, -63, 348, 348, 377, 299, 300, 62, 555, 64,
2114 99, 100, 103, 101, 102, 330, 7, 8, 9, 10,
2115 54, 12, 55, 567, 353, 56, 30, 31, 32, 33,
2116 34, 35, 36, 512, -107, 513, 114, 89, 115, 116,
2117 122, 191, 488, 195, 196, 348, 197, 348, 354, 218,
2118 219, 348, 222, 228, -70, -69, -68, -67, 302, 348,
2119 348, 348, -73, 355, -170, -74, 303, 334, 335, 375,
2120 356, 358, 361, 362, 363, 364, 425, 365, 427, 428,
2121 429, 366, 89, 376, 226, 367, 368, 436, 369, 5,
2122 378, 374, 373, 348, 348, 6, 348, 348, 379, 328,
2123 396, 383, 384, 348, 385, 7, 8, 9, 10, 11,
2124 12, 13, 348, 233, 234, 235, 236, 237, 238, 239,
2125 240, 446, 447, 448, 449, 450, 14, 386, 387, 407,
2126 350, 351, 388, 455, 456, 457, 458, 459, 389, 397,
2127 398, 399, 352, 348, 245, 246, 247, 248, 249, 250,
2128 251, 252, 253, 254, 400, 401, 226, 426, 226, 226,
2129 226, 430, 431, 405, 408, 410, 435, 226, 413, 424,
2130 414, 421, 440, 360, 464, 432, 433, 434, 439, 466,
2131 467, 348, 468, 370, 371, 372, 472, 496, 469, 470,
2132 476, 517, 518, 519, 478, 479, 348, 480, 484, 486,
2133 330, 487, 500, 502, 524, 348, 534, 535, 419, 348,
2134 348, 554, 489, 490, 226, 492, 558, 493, 537, 494,
2135 495, 497, 498, 499, 501, 522, 523, 539, 525, 526,
2136 527, 528, 485, 529, 530, 531, 504, 533, 241, 242,
2137 511, 514, 516, 536, 540, 559, 543, 538, 542, 544,
2138 545, 546, 415, 416, 417, 549, 547, 548, 241, 242,
2139 423, 226, 550, 551, 552, 553, 569, 570, 65, 66,
2140 571, 226, 226, 226, 437, 438, 572, 226, 573, 560,
2141 561, 562, 574, 563, 564, 20, 575, 21, 578, 304,
2142 580, 579, 582, 532, 583, 181, 182, 183, 184, 97,
2143 185, 305, 306, 444, 57, 462, 224, 226, 445, 105,
2144 461, 323, 113, 27, 45, 475, 520, 471, 491, 473,
2145 0, 0, 0, 477, 0, 0, 0, 0, 0, 0,
2146 0, 481, 482, 483, 0, 0, 0, 0, 0, 0,
2147 0, 134, 135, 136, 137, 138, 139, 140, 141, 142,
2148 143, 144, 145, 146, 147, 148, 149, 150, 151, 307,
2149 308, 0, 0, 0, 0, 505, 506, 0, 509, 510,
2150 0, 0, 0, 0, 0, 515, 0, 0, 0, 0,
2151 0, 0, 0, 0, 521, 0, 0, 0, 0, 0,
2152 309, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2153 167, 168, 169, 0, 310, 172, 173, 174, 0, 311,
2154 312, 313, 0, 0, 0, 541, 0, 0, 0, 314,
2155 0, 0, 315, 0, 316, 0, 0, 317, 65, 66,
2156 0, 117, 68, 69, 70, 71, 72, 73, 74, 75,
2157 76, 77, 78, 79, 80, 20, 0, 21, 0, 0,
2158 0, 0, 0, 565, 256, 257, 258, 259, 260, 261,
2159 262, 263, 264, 265, 266, 267, 268, 269, 577, 0,
2160 0, 81, 0, 0, 0, 0, 0, 581, 0, 0,
2161 0, 584, 585, 65, 66, 0, 117, 202, 203, 204,
2162 205, 206, 207, 208, 209, 210, 211, 212, 79, 80,
2163 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
2164 0, 0, 0, 0, 0, 0, 0, 336, 337, 65,
2165 66, 338, 0, 0, 0, 0, 81, 0, 0, 0,
2166 0, 0, 0, 0, 0, 0, 20, 0, 21, 0,
2167 339, 340, 341, 0, 0, 0, 0, 0, 0, 0,
2168 0, 0, 342, 343, 0, 0, 0, 0, 0, 0,
2169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2170 0, 0, 0, 0, 0, 344, 82, 0, 0, 83,
2171 0, 0, 84, 0, 85, 118, 0, 0, 0, 0,
2172 0, 0, 134, 135, 136, 137, 138, 139, 140, 141,
2173 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
2174 307, 308, 0, 0, 0, 0, 0, 0, 0, 0,
2175 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2176 0, 82, 0, 0, 83, 0, 0, 84, 0, 85,
2177 394, 309, 158, 159, 160, 161, 162, 163, 164, 165,
2178 166, 167, 168, 169, 0, 310, 172, 173, 174, 0,
2179 311, 312, 313, 336, 337, 0, 0, 338, 0, 0,
2180 0, 0, 0, 345, 0, 0, 0, 0, 0, 0,
2181 0, 0, 0, 0, 0, 0, 339, 340, 341, 0,
2182 0, 0, 0, 0, 0, 0, 0, 0, 342, 343,
2183 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2185 0, 344, 0, 0, 0, 0, 0, 0, 0, 0,
2186 0, 0, 0, 0, 0, 0, 0, 0, 134, 135,
2187 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2188 146, 147, 148, 149, 150, 151, 307, 308, 0, 0,
2189 0, 0, 65, 66, 0, 117, 202, 203, 204, 205,
2190 206, 207, 208, 209, 210, 211, 212, 79, 80, 20,
2191 0, 21, 0, 0, 0, 0, 0, 309, 158, 159,
2192 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
2193 0, 310, 172, 173, 174, 81, 311, 312, 313, 0,
2194 0, 0, 0, 0, 0, 0, 0, 65, 66, 345,
2195 117, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2196 77, 78, 79, 80, 20, 0, 21, 0, 0, 0,
2197 0, 0, 0, 0, 0, 0, 0, 0, 0, 223,
2198 0, 0, 0, 0, 0, 0, 0, 0, 65, 66,
2199 81, 117, 68, 69, 70, 71, 72, 73, 74, 75,
2200 76, 77, 78, 79, 80, 20, 0, 21, 0, 0,
2201 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2202 329, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2203 0, 81, 0, 0, 0, 0, 0, 0, 0, 0,
2204 82, 0, 0, 83, 0, 390, 84, 0, 85, 65,
2205 66, 0, 117, 68, 69, 70, 71, 72, 73, 74,
2206 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2208 0, 409, 0, 0, 0, 0, 0, 0, 0, 0,
2209 0, 0, 81, 0, 0, 82, 0, 0, 83, 0,
2210 0, 84, 0, 85, 0, 65, 66, 0, 117, 68,
2211 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2212 79, 80, 20, 0, 21, 0, 0, 0, 0, 0,
2213 0, 0, 0, 0, 0, 0, 82, 460, 0, 83,
2214 0, 0, 84, 0, 85, 0, 65, 66, 81, 67,
2215 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2216 78, 79, 80, 20, 0, 21, 65, 66, 0, 117,
2217 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2218 78, 79, 80, 20, 0, 21, 0, 0, 0, 81,
2219 0, 0, 0, 0, 0, 0, 0, 82, 0, 0,
2220 83, 0, 0, 84, 0, 85, 0, 65, 66, 81,
2221 117, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2222 211, 212, 79, 80, 20, 0, 21, 65, 66, 0,
2223 229, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2224 77, 78, 79, 80, 20, 0, 21, 0, 0, 0,
2225 81, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2226 0, 85, 0, 0, 0, 0, 0, 0, 0, 0,
2227 81, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
2230 84, 0, 85, 0, 0, 0, 0, 0, 0, 0,
2231 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
2232 84, 0, 85, 0, 0, 0, 0, 0, 0, 0,
2233 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2234 0, 0, 0, 0, 0, 0, 0, 0, 124, 0,
2235 0, 0, 0, 0, 0, 82, 0, 0, 83, 0,
2236 0, 84, 125, 85, 0, 0, 0, 0, 0, 0,
2237 0, 0, 126, 127, 0, 82, 0, 0, 83, 0,
2238 0, 84, 0, 85, 0, 128, 129, 130, 131, 132,
2239 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
2240 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
2241 153, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2243 0, 0, 0, 0, 0, 154, 155, 156, 0, 0,
2244 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2245 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2249 static const short int yycheck[] =
2251 37, 130, 130, 53, 272, 29, 3, 537, 125, 9,
2252 23, 128, 152, 216, 15, 34, 53, 30, 112, 131,
2253 85, 21, 162, 226, 15, 315, 316, 557, 231, 232,
2254 10, 11, 12, 13, 14, 15, 16, 17, 57, 156,
2255 243, 556, 32, 33, 41, 10, 11, 12, 13, 14,
2256 15, 16, 17, 568, 171, 345, 57, 122, 175, 176,
2257 177, 178, 179, 180, 295, 296, 57, 184, 185, 152,
2258 23, 274, 109, 110, 111, 187, 52, 53, 54, 162,
2259 152, 284, 285, 286, 154, 20, 158, 22, 125, 24,
2260 87, 128, 152, 163, 325, 71, 31, 32, 33, 158,
2261 160, 55, 56, 57, 163, 152, 41, 42, 43, 44,
2262 45, 46, 47, 160, 0, 50, 51, 154, 155, 156,
2263 157, 160, 152, 58, 163, 55, 56, 62, 158, 45,
2264 22, 47, 24, 170, 171, 61, 151, 161, 175, 176,
2265 177, 178, 179, 180, 181, 182, 183, 184, 185, 162,
2266 353, 354, 355, 218, 219, 220, 125, 126, 361, 61,
2267 27, 28, 3, 4, 151, 20, 3, 4, 3, 4,
2268 3, 4, 375, 376, 291, 3, 4, 24, 158, 4,
2269 151, 151, 156, 151, 151, 222, 41, 42, 43, 44,
2270 45, 46, 47, 158, 244, 50, 64, 65, 66, 67,
2271 68, 69, 70, 471, 154, 473, 4, 244, 4, 4,
2272 154, 24, 443, 4, 24, 418, 24, 420, 255, 157,
2273 157, 424, 154, 59, 4, 4, 4, 4, 4, 432,
2274 433, 434, 7, 270, 0, 7, 7, 152, 155, 289,
2275 152, 152, 156, 152, 152, 152, 363, 152, 365, 366,
2276 367, 152, 289, 290, 291, 152, 152, 374, 152, 25,
2277 24, 152, 36, 466, 467, 31, 469, 470, 152, 334,
2278 24, 154, 154, 476, 154, 41, 42, 43, 44, 45,
2279 46, 47, 485, 10, 11, 12, 13, 14, 15, 16,
2280 17, 385, 386, 387, 388, 389, 62, 154, 154, 152,
2281 231, 232, 154, 397, 398, 399, 400, 401, 154, 154,
2282 154, 154, 243, 516, 98, 99, 100, 101, 102, 103,
2283 104, 105, 106, 107, 154, 154, 363, 364, 365, 366,
2284 367, 368, 369, 330, 155, 63, 373, 374, 152, 156,
2285 152, 152, 34, 274, 24, 152, 152, 152, 152, 21,
2286 21, 554, 154, 284, 285, 286, 4, 451, 152, 152,
2287 152, 478, 479, 480, 152, 152, 569, 152, 154, 24,
2288 407, 4, 36, 57, 155, 578, 4, 24, 57, 582,
2289 583, 21, 152, 152, 421, 152, 36, 152, 156, 152,
2290 152, 152, 152, 152, 152, 489, 490, 514, 492, 493,
2291 494, 495, 439, 497, 498, 499, 152, 501, 537, 537,
2292 152, 152, 152, 152, 158, 158, 152, 155, 155, 152,
2293 152, 155, 353, 354, 355, 155, 152, 152, 557, 557,
2294 361, 468, 155, 155, 155, 155, 21, 155, 5, 6,
2295 155, 478, 479, 480, 375, 376, 155, 484, 155, 543,
2296 544, 545, 155, 547, 548, 22, 152, 24, 21, 26,
2297 76, 152, 21, 500, 21, 97, 97, 97, 97, 41,
2298 97, 38, 39, 383, 25, 408, 122, 514, 384, 52,
2299 407, 216, 61, 3, 19, 421, 484, 418, 446, 420,
2300 -1, -1, -1, 424, -1, -1, -1, -1, -1, -1,
2301 -1, 432, 433, 434, -1, -1, -1, -1, -1, -1,
2302 -1, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2303 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2304 97, -1, -1, -1, -1, 466, 467, -1, 469, 470,
2305 -1, -1, -1, -1, -1, 476, -1, -1, -1, -1,
2306 -1, -1, -1, -1, 485, -1, -1, -1, -1, -1,
2307 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2308 137, 138, 139, -1, 141, 142, 143, 144, -1, 146,
2309 147, 148, -1, -1, -1, 516, -1, -1, -1, 156,
2310 -1, -1, 159, -1, 161, -1, -1, 164, 5, 6,
2311 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2312 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2313 -1, -1, -1, 554, 108, 109, 110, 111, 112, 113,
2314 114, 115, 116, 117, 118, 119, 120, 121, 569, -1,
2315 -1, 48, -1, -1, -1, -1, -1, 578, -1, -1,
2316 -1, 582, 583, 5, 6, -1, 8, 9, 10, 11,
2317 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2318 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
2319 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
2320 6, 7, -1, -1, -1, -1, 48, -1, -1, -1,
2321 -1, -1, -1, -1, -1, -1, 22, -1, 24, -1,
2322 26, 27, 28, -1, -1, -1, -1, -1, -1, -1,
2323 -1, -1, 38, 39, -1, -1, -1, -1, -1, -1,
2324 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2325 -1, -1, -1, -1, -1, 61, 153, -1, -1, 156,
2326 -1, -1, 159, -1, 161, 162, -1, -1, -1, -1,
2327 -1, -1, 78, 79, 80, 81, 82, 83, 84, 85,
2328 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2329 96, 97, -1, -1, -1, -1, -1, -1, -1, -1,
2330 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2331 -1, 153, -1, -1, 156, -1, -1, 159, -1, 161,
2332 162, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2333 136, 137, 138, 139, -1, 141, 142, 143, 144, -1,
2334 146, 147, 148, 3, 4, -1, -1, 7, -1, -1,
2335 -1, -1, -1, 159, -1, -1, -1, -1, -1, -1,
2336 -1, -1, -1, -1, -1, -1, 26, 27, 28, -1,
2337 -1, -1, -1, -1, -1, -1, -1, -1, 38, 39,
2338 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2339 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2340 -1, 61, -1, -1, -1, -1, -1, -1, -1, -1,
2341 -1, -1, -1, -1, -1, -1, -1, -1, 78, 79,
2342 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2343 90, 91, 92, 93, 94, 95, 96, 97, -1, -1,
2344 -1, -1, 5, 6, -1, 8, 9, 10, 11, 12,
2345 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2346 -1, 24, -1, -1, -1, -1, -1, 127, 128, 129,
2347 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
2348 -1, 141, 142, 143, 144, 48, 146, 147, 148, -1,
2349 -1, -1, -1, -1, -1, -1, -1, 5, 6, 159,
2350 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2351 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2352 -1, -1, -1, -1, -1, -1, -1, -1, -1, 37,
2353 -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
2354 48, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2355 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2356 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2357 37, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2358 -1, 48, -1, -1, -1, -1, -1, -1, -1, -1,
2359 153, -1, -1, 156, -1, 158, 159, -1, 161, 5,
2360 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2361 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2362 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2363 -1, 37, -1, -1, -1, -1, -1, -1, -1, -1,
2364 -1, -1, 48, -1, -1, 153, -1, -1, 156, -1,
2365 -1, 159, -1, 161, -1, 5, 6, -1, 8, 9,
2366 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2367 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
2368 -1, -1, -1, -1, -1, -1, 153, 37, -1, 156,
2369 -1, -1, 159, -1, 161, -1, 5, 6, 48, 8,
2370 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2371 19, 20, 21, 22, -1, 24, 5, 6, -1, 8,
2372 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2373 19, 20, 21, 22, -1, 24, -1, -1, -1, 48,
2374 -1, -1, -1, -1, -1, -1, -1, 153, -1, -1,
2375 156, -1, -1, 159, -1, 161, -1, 5, 6, 48,
2376 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2377 18, 19, 20, 21, 22, -1, 24, 5, 6, -1,
2378 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2379 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2380 48, -1, -1, 153, -1, -1, 156, -1, -1, 159,
2381 -1, 161, -1, -1, -1, -1, -1, -1, -1, -1,
2382 48, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2383 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2384 -1, -1, -1, -1, 153, -1, -1, 156, -1, -1,
2385 159, -1, 161, -1, -1, -1, -1, -1, -1, -1,
2386 -1, -1, -1, -1, 153, -1, -1, 156, -1, -1,
2387 159, -1, 161, -1, -1, -1, -1, -1, -1, -1,
2388 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2389 -1, -1, -1, -1, -1, -1, -1, -1, 35, -1,
2390 -1, -1, -1, -1, -1, 153, -1, -1, 156, -1,
2391 -1, 159, 49, 161, -1, -1, -1, -1, -1, -1,
2392 -1, -1, 59, 60, -1, 153, -1, -1, 156, -1,
2393 -1, 159, -1, 161, -1, 72, 73, 74, 75, 76,
2394 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2395 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2396 97, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2397 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2398 -1, -1, -1, -1, -1, 122, 123, 124, -1, -1,
2399 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2400 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2404 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2405 symbol of state STATE-NUM. */
2406 static const unsigned char yystos[] =
2408 0, 199, 200, 201, 0, 25, 31, 41, 42, 43,
2409 44, 45, 46, 47, 62, 180, 218, 220, 222, 229,
2410 22, 24, 51, 58, 62, 179, 211, 222, 223, 61,
2411 64, 65, 66, 67, 68, 69, 70, 181, 216, 23,
2412 230, 231, 30, 162, 219, 230, 52, 53, 54, 71,
2413 208, 151, 61, 20, 45, 47, 50, 180, 151, 45,
2414 47, 221, 24, 206, 4, 5, 6, 8, 9, 10,
2415 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2416 21, 48, 153, 156, 159, 161, 166, 188, 189, 190,
2417 191, 192, 211, 226, 29, 161, 217, 179, 234, 151,
2418 151, 151, 151, 156, 209, 206, 188, 32, 33, 198,
2419 198, 198, 198, 216, 4, 4, 4, 8, 162, 192,
2420 193, 211, 154, 163, 35, 49, 59, 60, 72, 73,
2421 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2422 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2423 94, 95, 96, 97, 122, 123, 124, 127, 128, 129,
2424 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
2425 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
2426 150, 168, 169, 170, 171, 172, 232, 238, 239, 241,
2427 242, 24, 55, 56, 207, 4, 24, 24, 210, 190,
2428 190, 190, 9, 10, 11, 12, 13, 14, 15, 16,
2429 17, 18, 19, 175, 176, 178, 190, 195, 157, 157,
2430 152, 162, 154, 37, 193, 194, 190, 228, 59, 8,
2431 228, 9, 21, 10, 11, 12, 13, 14, 15, 16,
2432 17, 175, 176, 177, 181, 98, 99, 100, 101, 102,
2433 103, 104, 105, 106, 107, 173, 108, 109, 110, 111,
2434 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2435 174, 190, 190, 228, 190, 190, 235, 228, 228, 228,
2436 228, 228, 228, 228, 190, 190, 190, 228, 228, 181,
2437 125, 126, 152, 158, 204, 205, 203, 27, 28, 3,
2438 4, 167, 4, 7, 26, 38, 39, 96, 97, 127,
2439 141, 146, 147, 148, 156, 159, 161, 164, 168, 169,
2440 170, 171, 172, 196, 226, 202, 192, 192, 192, 37,
2441 190, 213, 214, 215, 152, 155, 3, 4, 7, 26,
2442 27, 28, 38, 39, 61, 159, 196, 225, 226, 227,
2443 227, 227, 227, 188, 190, 190, 152, 183, 152, 183,
2444 227, 156, 152, 152, 152, 152, 152, 152, 152, 152,
2445 227, 227, 227, 36, 152, 188, 190, 228, 24, 152,
2446 186, 186, 186, 154, 154, 154, 154, 154, 154, 154,
2447 158, 195, 197, 197, 162, 197, 24, 154, 154, 154,
2448 154, 154, 186, 158, 160, 211, 212, 152, 155, 37,
2449 63, 224, 197, 152, 152, 227, 227, 227, 15, 57,
2450 15, 152, 240, 227, 156, 228, 190, 228, 228, 228,
2451 190, 190, 152, 152, 152, 190, 228, 227, 227, 152,
2452 34, 57, 184, 187, 173, 174, 195, 195, 195, 195,
2453 195, 152, 158, 160, 162, 195, 195, 195, 195, 195,
2454 37, 213, 184, 185, 24, 160, 21, 21, 154, 152,
2455 152, 227, 4, 227, 228, 236, 152, 227, 152, 152,
2456 152, 227, 227, 227, 154, 190, 24, 4, 186, 152,
2457 152, 240, 152, 152, 152, 152, 195, 152, 152, 152,
2458 36, 152, 57, 182, 152, 227, 227, 236, 237, 227,
2459 227, 152, 183, 183, 152, 227, 152, 228, 228, 228,
2460 237, 227, 195, 195, 155, 195, 195, 195, 195, 195,
2461 195, 195, 190, 195, 4, 24, 152, 156, 155, 228,
2462 158, 227, 155, 152, 152, 152, 155, 152, 152, 155,
2463 155, 155, 155, 155, 21, 158, 177, 233, 36, 158,
2464 195, 195, 195, 195, 195, 227, 225, 158, 177, 21,
2465 155, 155, 155, 155, 155, 152, 225, 227, 21, 152,
2466 76, 227, 21, 21, 227, 227
2469 #define yyerrok (yyerrstatus = 0)
2470 #define yyclearin (yychar = YYEMPTY)
2471 #define YYEMPTY (-2)
2474 #define YYACCEPT goto yyacceptlab
2475 #define YYABORT goto yyabortlab
2476 #define YYERROR goto yyerrorlab
2479 /* Like YYERROR except do call yyerror. This remains here temporarily
2480 to ease the transition to the new meaning of YYERROR, for GCC.
2481 Once GCC version 2 has supplanted version 1, this can go. */
2483 #define YYFAIL goto yyerrlab
2485 #define YYRECOVERING() (!!yyerrstatus)
2487 #define YYBACKUP(Token, Value) \
2489 if (yychar == YYEMPTY && yylen == 1) \
2493 yytoken = YYTRANSLATE (yychar); \
2499 yyerror (YY_("syntax error: cannot back up")); \
2506 #define YYERRCODE 256
2509 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2510 If N is 0, then set CURRENT to the empty location which ends
2511 the previous symbol: RHS[0] (always defined). */
2513 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2514 #ifndef YYLLOC_DEFAULT
2515 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2519 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2520 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2521 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2522 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2526 (Current).first_line = (Current).last_line = \
2527 YYRHSLOC (Rhs, 0).last_line; \
2528 (Current).first_column = (Current).last_column = \
2529 YYRHSLOC (Rhs, 0).last_column; \
2535 /* YY_LOCATION_PRINT -- Print the location on the stream.
2536 This macro was not mandated originally: define only if we know
2537 we won't break user code: when these are the locations we know. */
2539 #ifndef YY_LOCATION_PRINT
2540 # if YYLTYPE_IS_TRIVIAL
2541 # define YY_LOCATION_PRINT(File, Loc) \
2542 fprintf (File, "%d.%d-%d.%d", \
2543 (Loc).first_line, (Loc).first_column, \
2544 (Loc).last_line, (Loc).last_column)
2546 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2551 /* YYLEX -- calling `yylex' with the right arguments. */
2554 # define YYLEX yylex (YYLEX_PARAM)
2556 # define YYLEX yylex ()
2559 /* Enable debugging if requested. */
2563 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2564 # define YYFPRINTF fprintf
2567 # define YYDPRINTF(Args) \
2573 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2577 YYFPRINTF (stderr, "%s ", Title); \
2578 yysymprint (stderr, \
2580 YYFPRINTF (stderr, "\n"); \
2584 /*------------------------------------------------------------------.
2585 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2587 `------------------------------------------------------------------*/
2589 #if defined (__STDC__) || defined (__cplusplus)
2591 yy_stack_print (short int *bottom, short int *top)
2594 yy_stack_print (bottom, top)
2599 YYFPRINTF (stderr, "Stack now");
2600 for (/* Nothing. */; bottom <= top; ++bottom)
2601 YYFPRINTF (stderr, " %d", *bottom);
2602 YYFPRINTF (stderr, "\n");
2605 # define YY_STACK_PRINT(Bottom, Top) \
2608 yy_stack_print ((Bottom), (Top)); \
2612 /*------------------------------------------------.
2613 | Report that the YYRULE is going to be reduced. |
2614 `------------------------------------------------*/
2616 #if defined (__STDC__) || defined (__cplusplus)
2618 yy_reduce_print (int yyrule)
2621 yy_reduce_print (yyrule)
2626 unsigned long int yylno = yyrline[yyrule];
2627 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2629 /* Print the symbols being reduced, and their result. */
2630 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2631 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2632 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2635 # define YY_REDUCE_PRINT(Rule) \
2638 yy_reduce_print (Rule); \
2641 /* Nonzero means print parse trace. It is left uninitialized so that
2642 multiple parsers can coexist. */
2644 #else /* !YYDEBUG */
2645 # define YYDPRINTF(Args)
2646 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2647 # define YY_STACK_PRINT(Bottom, Top)
2648 # define YY_REDUCE_PRINT(Rule)
2649 #endif /* !YYDEBUG */
2652 /* YYINITDEPTH -- initial size of the parser's stacks. */
2654 # define YYINITDEPTH 200
2657 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2658 if the built-in stack extension method is used).
2660 Do not make this value too large; the results are undefined if
2661 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2662 evaluated with infinite-precision integer arithmetic. */
2665 # define YYMAXDEPTH 10000
2673 # if defined (__GLIBC__) && defined (_STRING_H)
2674 # define yystrlen strlen
2676 /* Return the length of YYSTR. */
2678 # if defined (__STDC__) || defined (__cplusplus)
2679 yystrlen (const char *yystr)
2685 const char *yys = yystr;
2687 while (*yys++ != '\0')
2690 return yys - yystr - 1;
2696 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2697 # define yystpcpy stpcpy
2699 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2702 # if defined (__STDC__) || defined (__cplusplus)
2703 yystpcpy (char *yydest, const char *yysrc)
2705 yystpcpy (yydest, yysrc)
2711 const char *yys = yysrc;
2713 while ((*yyd++ = *yys++) != '\0')
2722 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2723 quotes and backslashes, so that it's suitable for yyerror. The
2724 heuristic is that double-quoting is unnecessary unless the string
2725 contains an apostrophe, a comma, or backslash (other than
2726 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2727 null, do not copy; instead, return the length of what the result
2730 yytnamerr (char *yyres, const char *yystr)
2735 char const *yyp = yystr;
2742 goto do_not_strip_quotes;
2746 goto do_not_strip_quotes;
2759 do_not_strip_quotes: ;
2763 return yystrlen (yystr);
2765 return yystpcpy (yyres, yystr) - yyres;
2769 #endif /* YYERROR_VERBOSE */
2774 /*--------------------------------.
2775 | Print this symbol on YYOUTPUT. |
2776 `--------------------------------*/
2778 #if defined (__STDC__) || defined (__cplusplus)
2780 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2783 yysymprint (yyoutput, yytype, yyvaluep)
2789 /* Pacify ``unused variable'' warnings. */
2792 if (yytype < YYNTOKENS)
2793 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2795 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2799 if (yytype < YYNTOKENS)
2800 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2807 YYFPRINTF (yyoutput, ")");
2810 #endif /* ! YYDEBUG */
2811 /*-----------------------------------------------.
2812 | Release the memory associated to this symbol. |
2813 `-----------------------------------------------*/
2815 #if defined (__STDC__) || defined (__cplusplus)
2817 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2820 yydestruct (yymsg, yytype, yyvaluep)
2826 /* Pacify ``unused variable'' warnings. */
2831 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2842 /* Prevent warnings from -Wmissing-prototypes. */
2844 #ifdef YYPARSE_PARAM
2845 # if defined (__STDC__) || defined (__cplusplus)
2846 int yyparse (void *YYPARSE_PARAM);
2850 #else /* ! YYPARSE_PARAM */
2851 #if defined (__STDC__) || defined (__cplusplus)
2856 #endif /* ! YYPARSE_PARAM */
2860 /* The look-ahead symbol. */
2863 /* The semantic value of the look-ahead symbol. */
2866 /* Number of syntax errors so far. */
2875 #ifdef YYPARSE_PARAM
2876 # if defined (__STDC__) || defined (__cplusplus)
2877 int yyparse (void *YYPARSE_PARAM)
2879 int yyparse (YYPARSE_PARAM)
2880 void *YYPARSE_PARAM;
2882 #else /* ! YYPARSE_PARAM */
2883 #if defined (__STDC__) || defined (__cplusplus)
2897 /* Number of tokens to shift before error messages enabled. */
2899 /* Look-ahead token as an internal (translated) token number. */
2902 /* Three stacks and their tools:
2903 `yyss': related to states,
2904 `yyvs': related to semantic values,
2905 `yyls': related to locations.
2907 Refer to the stacks thru separate pointers, to allow yyoverflow
2908 to reallocate them elsewhere. */
2910 /* The state stack. */
2911 short int yyssa[YYINITDEPTH];
2912 short int *yyss = yyssa;
2915 /* The semantic value stack. */
2916 YYSTYPE yyvsa[YYINITDEPTH];
2917 YYSTYPE *yyvs = yyvsa;
2922 #define YYPOPSTACK (yyvsp--, yyssp--)
2924 YYSIZE_T yystacksize = YYINITDEPTH;
2926 /* The variables used to return semantic value and location from the
2931 /* When reducing, the number of symbols on the RHS of the reduced
2935 YYDPRINTF ((stderr, "Starting parse\n"));
2940 yychar = YYEMPTY; /* Cause a token to be read. */
2942 /* Initialize stack pointers.
2943 Waste one element of value and location stack
2944 so that they stay on the same level as the state stack.
2945 The wasted elements are never initialized. */
2952 /*------------------------------------------------------------.
2953 | yynewstate -- Push a new state, which is found in yystate. |
2954 `------------------------------------------------------------*/
2956 /* In all cases, when you get here, the value and location stacks
2957 have just been pushed. so pushing a state here evens the stacks.
2964 if (yyss + yystacksize - 1 <= yyssp)
2966 /* Get the current used size of the three stacks, in elements. */
2967 YYSIZE_T yysize = yyssp - yyss + 1;
2971 /* Give user a chance to reallocate the stack. Use copies of
2972 these so that the &'s don't force the real ones into
2974 YYSTYPE *yyvs1 = yyvs;
2975 short int *yyss1 = yyss;
2978 /* Each stack pointer address is followed by the size of the
2979 data in use in that stack, in bytes. This used to be a
2980 conditional around just the two extra args, but that might
2981 be undefined if yyoverflow is a macro. */
2982 yyoverflow (YY_("memory exhausted"),
2983 &yyss1, yysize * sizeof (*yyssp),
2984 &yyvs1, yysize * sizeof (*yyvsp),
2991 #else /* no yyoverflow */
2992 # ifndef YYSTACK_RELOCATE
2993 goto yyexhaustedlab;
2995 /* Extend the stack our own way. */
2996 if (YYMAXDEPTH <= yystacksize)
2997 goto yyexhaustedlab;
2999 if (YYMAXDEPTH < yystacksize)
3000 yystacksize = YYMAXDEPTH;
3003 short int *yyss1 = yyss;
3004 union yyalloc *yyptr =
3005 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3007 goto yyexhaustedlab;
3008 YYSTACK_RELOCATE (yyss);
3009 YYSTACK_RELOCATE (yyvs);
3011 # undef YYSTACK_RELOCATE
3013 YYSTACK_FREE (yyss1);
3016 #endif /* no yyoverflow */
3018 yyssp = yyss + yysize - 1;
3019 yyvsp = yyvs + yysize - 1;
3022 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3023 (unsigned long int) yystacksize));
3025 if (yyss + yystacksize - 1 <= yyssp)
3029 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3038 /* Do appropriate processing given the current state. */
3039 /* Read a look-ahead token if we need one and don't already have one. */
3042 /* First try to decide what to do without reference to look-ahead token. */
3044 yyn = yypact[yystate];
3045 if (yyn == YYPACT_NINF)
3048 /* Not known => get a look-ahead token if don't already have one. */
3050 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3051 if (yychar == YYEMPTY)
3053 YYDPRINTF ((stderr, "Reading a token: "));
3057 if (yychar <= YYEOF)
3059 yychar = yytoken = YYEOF;
3060 YYDPRINTF ((stderr, "Now at end of input.\n"));
3064 yytoken = YYTRANSLATE (yychar);
3065 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3068 /* If the proper action on seeing token YYTOKEN is to reduce or to
3069 detect an error, take that action. */
3071 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3076 if (yyn == 0 || yyn == YYTABLE_NINF)
3085 /* Shift the look-ahead token. */
3086 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3088 /* Discard the token being shifted unless it is eof. */
3089 if (yychar != YYEOF)
3095 /* Count tokens shifted since error; after three, turn off error
3104 /*-----------------------------------------------------------.
3105 | yydefault -- do the default action for the current state. |
3106 `-----------------------------------------------------------*/
3108 yyn = yydefact[yystate];
3114 /*-----------------------------.
3115 | yyreduce -- Do a reduction. |
3116 `-----------------------------*/
3118 /* yyn is the number of a rule to reduce with. */
3121 /* If YYLEN is nonzero, implement the default value of the action:
3124 Otherwise, the following line sets YYVAL to garbage.
3125 This behavior is undocumented and Bison
3126 users should not rely upon it. Assigning to YYVAL
3127 unconditionally makes the parser a bit smaller, and it avoids a
3128 GCC warning that YYVAL may be used uninitialized. */
3129 yyval = yyvsp[1-yylen];
3132 YY_REDUCE_PRINT (yyn);
3136 #line 1106 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3138 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3139 GEN_ERROR("Value too large for type!");
3140 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3146 #line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3148 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
3149 GEN_ERROR("Value too large for type!");
3150 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
3156 #line 1143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3158 (yyval.StrVal) = (yyvsp[-1].StrVal);
3164 #line 1147 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3172 #line 1152 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3173 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3177 #line 1153 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3178 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3182 #line 1154 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3183 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3187 #line 1155 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3188 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3192 #line 1156 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3193 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3197 #line 1157 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3198 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3202 #line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3203 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3207 #line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3208 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3212 #line 1161 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3213 { (yyval.UIntVal) = CallingConv::C; ;}
3217 #line 1162 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3218 { (yyval.UIntVal) = CallingConv::C; ;}
3222 #line 1163 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3223 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3227 #line 1164 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3228 { (yyval.UIntVal) = CallingConv::Fast; ;}
3232 #line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3233 { (yyval.UIntVal) = CallingConv::Cold; ;}
3237 #line 1166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3238 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3242 #line 1167 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3243 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3247 #line 1168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3249 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3250 GEN_ERROR("Calling conv too large!");
3251 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3257 #line 1177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3258 { (yyval.UIntVal) = 0; ;}
3262 #line 1178 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3264 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3265 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3266 GEN_ERROR("Alignment must be a power of two!");
3272 #line 1184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3273 { (yyval.UIntVal) = 0; ;}
3277 #line 1185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3279 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3280 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3281 GEN_ERROR("Alignment must be a power of two!");
3287 #line 1193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3289 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3290 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3291 GEN_ERROR("Invalid character in section name!");
3292 (yyval.StrVal) = (yyvsp[0].StrVal);
3298 #line 1201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3299 { (yyval.StrVal) = 0; ;}
3303 #line 1202 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3304 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3308 #line 1207 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3313 #line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3318 #line 1209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3320 CurGV->setSection((yyvsp[0].StrVal));
3321 free((yyvsp[0].StrVal));
3327 #line 1214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3329 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3330 GEN_ERROR("Alignment must be a power of two!");
3331 CurGV->setAlignment((yyvsp[0].UInt64Val));
3337 #line 1228 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3338 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3342 #line 1229 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3343 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3347 #line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3349 if (!UpRefs.empty())
3350 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3351 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3357 #line 1243 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3359 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3365 #line 1247 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3367 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3373 #line 1251 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3374 { // Named types are also simple types...
3375 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3377 (yyval.TypeVal) = new PATypeHolder(tmp);
3382 #line 1259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3383 { // Type UpReference
3384 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3385 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3386 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3387 (yyval.TypeVal) = new PATypeHolder(OT);
3388 UR_OUT("New Upreference!\n");
3394 #line 1267 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3395 { // Function derived type?
3396 std::vector<const Type*> Params;
3397 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3398 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3399 Params.push_back(*I);
3400 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3401 if (isVarArg) Params.pop_back();
3403 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3404 delete (yyvsp[-1].TypeList); // Delete the argument list
3405 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3411 #line 1280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3412 { // Sized array type?
3413 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3414 delete (yyvsp[-1].TypeVal);
3420 #line 1285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3421 { // Packed array type?
3422 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3423 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3424 GEN_ERROR("Unsigned result not equal to signed result");
3425 if (!ElemTy->isPrimitiveType())
3426 GEN_ERROR("Elemental type of a PackedType must be primitive");
3427 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3428 GEN_ERROR("Vector length should be a power of 2!");
3429 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3430 delete (yyvsp[-1].TypeVal);
3436 #line 1297 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3437 { // Structure type?
3438 std::vector<const Type*> Elements;
3439 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3440 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3441 Elements.push_back(*I);
3443 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3444 delete (yyvsp[-1].TypeList);
3450 #line 1307 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3451 { // Empty structure type?
3452 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3458 #line 1311 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3460 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3461 GEN_ERROR("Cannot form a pointer to a basic block");
3462 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3463 delete (yyvsp[-1].TypeVal);
3469 #line 1322 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3471 (yyval.TypeList) = new std::list<PATypeHolder>();
3472 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3478 #line 1327 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3480 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3486 #line 1334 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3488 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3494 #line 1338 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3496 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3502 #line 1342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3504 (yyval.TypeList) = new std::list<PATypeHolder>();
3510 #line 1353 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3511 { // Nonempty unsized arr
3512 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3514 GEN_ERROR("Cannot make array constant with type: '" +
3515 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3516 const Type *ETy = ATy->getElementType();
3517 int NumElements = ATy->getNumElements();
3519 // Verify that we have the correct size...
3520 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3521 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3522 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3523 itostr(NumElements) + "!");
3525 // Verify all elements are correct type!
3526 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3527 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3528 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3529 ETy->getDescription() +"' as required!\nIt is of type '"+
3530 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3533 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3534 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3540 #line 1379 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3542 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3544 GEN_ERROR("Cannot make array constant with type: '" +
3545 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3547 int NumElements = ATy->getNumElements();
3548 if (NumElements != -1 && NumElements != 0)
3549 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3550 " arguments, but has size of " + itostr(NumElements) +"!");
3551 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3552 delete (yyvsp[-2].TypeVal);
3558 #line 1393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3560 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3562 GEN_ERROR("Cannot make array constant with type: '" +
3563 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3565 int NumElements = ATy->getNumElements();
3566 const Type *ETy = ATy->getElementType();
3567 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3568 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3569 GEN_ERROR("Can't build string constant of size " +
3570 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3571 " when array has size " + itostr(NumElements) + "!");
3572 std::vector<Constant*> Vals;
3573 if (ETy == Type::SByteTy) {
3574 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3575 Vals.push_back(ConstantInt::get(ETy, *C));
3576 } else if (ETy == Type::UByteTy) {
3577 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3578 C != (unsigned char*)EndStr; ++C)
3579 Vals.push_back(ConstantInt::get(ETy, *C));
3581 free((yyvsp[0].StrVal));
3582 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3584 free((yyvsp[0].StrVal));
3585 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3586 delete (yyvsp[-2].TypeVal);
3592 #line 1423 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3593 { // Nonempty unsized arr
3594 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3596 GEN_ERROR("Cannot make packed constant with type: '" +
3597 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3598 const Type *ETy = PTy->getElementType();
3599 int NumElements = PTy->getNumElements();
3601 // Verify that we have the correct size...
3602 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3603 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3604 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3605 itostr(NumElements) + "!");
3607 // Verify all elements are correct type!
3608 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3609 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3610 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3611 ETy->getDescription() +"' as required!\nIt is of type '"+
3612 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3615 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3616 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3622 #line 1449 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3624 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3626 GEN_ERROR("Cannot make struct constant with type: '" +
3627 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3629 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3630 GEN_ERROR("Illegal number of initializers for structure type!");
3632 // Check to ensure that constants are compatible with the type initializer!
3633 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3634 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3635 GEN_ERROR("Expected type '" +
3636 STy->getElementType(i)->getDescription() +
3637 "' for element #" + utostr(i) +
3638 " of structure initializer!");
3640 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3641 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3647 #line 1470 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3649 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3651 GEN_ERROR("Cannot make struct constant with type: '" +
3652 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3654 if (STy->getNumContainedTypes() != 0)
3655 GEN_ERROR("Illegal number of initializers for structure type!");
3657 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3658 delete (yyvsp[-2].TypeVal);
3664 #line 1483 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3666 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3668 GEN_ERROR("Cannot make null pointer constant with type: '" +
3669 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3671 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3672 delete (yyvsp[-1].TypeVal);
3678 #line 1493 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3680 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3681 delete (yyvsp[-1].TypeVal);
3687 #line 1498 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3689 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3691 GEN_ERROR("Global const reference must be a pointer type!");
3693 // ConstExprs can exist in the body of a function, thus creating
3694 // GlobalValues whenever they refer to a variable. Because we are in
3695 // the context of a function, getValNonImprovising will search the functions
3696 // symbol table instead of the module symbol table for the global symbol,
3697 // which throws things all off. To get around this, we just tell
3698 // getValNonImprovising that we are at global scope here.
3700 Function *SavedCurFn = CurFun.CurrentFunction;
3701 CurFun.CurrentFunction = 0;
3703 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3706 CurFun.CurrentFunction = SavedCurFn;
3708 // If this is an initializer for a constant pointer, which is referencing a
3709 // (currently) undefined variable, create a stub now that shall be replaced
3710 // in the future with the right type of variable.
3713 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3714 const PointerType *PT = cast<PointerType>(Ty);
3716 // First check to see if the forward references value is already created!
3717 PerModuleInfo::GlobalRefsType::iterator I =
3718 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3720 if (I != CurModule.GlobalRefs.end()) {
3721 V = I->second; // Placeholder already exists, use it...
3722 (yyvsp[0].ValIDVal).destroy();
3725 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3727 // Create the forward referenced global.
3729 if (const FunctionType *FTy =
3730 dyn_cast<FunctionType>(PT->getElementType())) {
3731 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3732 CurModule.CurrentModule);
3734 GV = new GlobalVariable(PT->getElementType(), false,
3735 GlobalValue::ExternalLinkage, 0,
3736 Name, CurModule.CurrentModule);
3739 // Keep track of the fact that we have a forward ref to recycle it
3740 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3745 (yyval.ConstVal) = cast<GlobalValue>(V);
3746 delete (yyvsp[-1].TypeVal); // Free the type handle
3752 #line 1559 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3754 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3755 GEN_ERROR("Mismatched types for constant expression!");
3756 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3757 delete (yyvsp[-1].TypeVal);
3763 #line 1566 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3765 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3766 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3767 GEN_ERROR("Cannot create a null initialized value of this type!");
3768 (yyval.ConstVal) = Constant::getNullValue(Ty);
3769 delete (yyvsp[-1].TypeVal);
3775 #line 1574 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3776 { // integral constants
3777 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3778 GEN_ERROR("Constant value doesn't fit in type!");
3779 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3785 #line 1580 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3786 { // integral constants
3787 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3788 GEN_ERROR("Constant value doesn't fit in type!");
3789 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3795 #line 1586 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3796 { // Boolean constants
3797 (yyval.ConstVal) = ConstantBool::getTrue();
3803 #line 1590 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3804 { // Boolean constants
3805 (yyval.ConstVal) = ConstantBool::getFalse();
3811 #line 1594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3812 { // Float & Double constants
3813 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3814 GEN_ERROR("Floating point constant invalid for type!!");
3815 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3821 #line 1602 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3823 Constant *Val = (yyvsp[-3].ConstVal);
3824 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3825 if (!Val->getType()->isFirstClassType())
3826 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3827 Val->getType()->getDescription() + "'!");
3828 if (!Ty->isFirstClassType())
3829 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3830 Ty->getDescription() + "'!");
3831 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3832 delete (yyvsp[-1].TypeVal);
3837 #line 1614 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3839 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3840 GEN_ERROR("GetElementPtr requires a pointer operand!");
3842 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3843 // indices to uint struct indices for compatibility.
3844 generic_gep_type_iterator<std::vector<Value*>::iterator>
3845 GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
3846 GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
3847 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
3848 if (isa<StructType>(*GTI)) // Only change struct indices
3849 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[-1].ValueList))[i]))
3850 if (CUI->getType() == Type::UByteTy)
3851 (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3854 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3856 GEN_ERROR("Index list invalid for constant getelementptr!");
3858 std::vector<Constant*> IdxVec;
3859 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3860 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3861 IdxVec.push_back(C);
3863 GEN_ERROR("Indices to constant getelementptr must be constants!");
3865 delete (yyvsp[-1].ValueList);
3867 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3873 #line 1646 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3875 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3876 GEN_ERROR("Select condition must be of boolean type!");
3877 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3878 GEN_ERROR("Select operand types must match!");
3879 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3885 #line 1654 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3887 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3888 GEN_ERROR("Binary operator types must match!");
3891 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
3892 // To retain backward compatibility with these early compilers, we emit a
3893 // cast to the appropriate integer type automatically if we are in the
3894 // broken case. See PR424 for more information.
3895 if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
3896 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3898 const Type *IntPtrTy = 0;
3899 switch (CurModule.CurrentModule->getPointerSize()) {
3900 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
3901 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
3902 default: GEN_ERROR("invalid pointer binary constant expr!");
3904 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
3905 ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
3906 (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
3913 #line 1678 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3915 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3916 GEN_ERROR("Logical operator types must match!");
3917 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
3918 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
3919 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
3920 GEN_ERROR("Logical operator requires integral operands!");
3922 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3928 #line 1689 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3930 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3931 GEN_ERROR("setcc operand types must match!");
3932 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3938 #line 1695 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3940 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3941 GEN_ERROR("icmp operand types must match!");
3942 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3947 #line 1700 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3949 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3950 GEN_ERROR("fcmp operand types must match!");
3951 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3956 #line 1705 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3958 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
3959 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3960 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
3961 GEN_ERROR("Shift constant expression requires integer operand!");
3963 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3969 #line 1714 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3971 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3972 GEN_ERROR("Invalid extractelement operands!");
3973 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3979 #line 1720 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3981 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3982 GEN_ERROR("Invalid insertelement operands!");
3983 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3989 #line 1726 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3991 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3992 GEN_ERROR("Invalid shufflevector operands!");
3993 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3999 #line 1735 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4001 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4007 #line 1739 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4009 (yyval.ConstVector) = new std::vector<Constant*>();
4010 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4016 #line 1747 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4017 { (yyval.BoolVal) = false; ;}
4021 #line 1747 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4022 { (yyval.BoolVal) = true; ;}
4026 #line 1757 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4028 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
4029 CurModule.ModuleDone();
4035 #line 1765 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4037 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4038 CurFun.FunctionDone();
4044 #line 1770 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4046 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4052 #line 1774 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4054 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
4060 #line 1778 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4062 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4068 #line 1782 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4070 (yyval.ModuleVal) = CurModule.CurrentModule;
4071 // Emit an error if there are any unresolved types left.
4072 if (!CurModule.LateResolveTypes.empty()) {
4073 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4074 if (DID.Type == ValID::NameVal) {
4075 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4077 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4085 #line 1797 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4087 // Eagerly resolve types. This is not an optimization, this is a
4088 // requirement that is due to the fact that we could have this:
4090 // %list = type { %list * }
4091 // %list = type { %list * } ; repeated type decl
4093 // If types are not resolved eagerly, then the two types will not be
4094 // determined to be the same type!
4096 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4098 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4100 // If this is a named type that is not a redefinition, add it to the slot
4102 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4105 delete (yyvsp[0].TypeVal);
4111 #line 1819 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4112 { // Function prototypes can be in const pool
4118 #line 1822 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4119 { // Asm blocks can be in the const pool
4125 #line 1825 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4127 if ((yyvsp[0].ConstVal) == 0)
4128 GEN_ERROR("Global value initializer is not a constant!");
4129 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4135 #line 1830 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4142 #line 1833 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4144 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4146 delete (yyvsp[0].TypeVal);
4151 #line 1837 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4159 #line 1841 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4161 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4163 delete (yyvsp[0].TypeVal);
4168 #line 1845 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4176 #line 1849 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4179 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4181 delete (yyvsp[0].TypeVal);
4186 #line 1854 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4194 #line 1858 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4201 #line 1861 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4208 #line 1864 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4214 #line 1868 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4216 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4217 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4218 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4219 free((yyvsp[0].StrVal));
4221 if (AsmSoFar.empty())
4222 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4224 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4230 #line 1881 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4231 { (yyval.Endianness) = Module::BigEndian; ;}
4235 #line 1882 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4236 { (yyval.Endianness) = Module::LittleEndian; ;}
4240 #line 1884 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4242 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4248 #line 1888 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4250 if ((yyvsp[0].UInt64Val) == 32)
4251 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4252 else if ((yyvsp[0].UInt64Val) == 64)
4253 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4255 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4261 #line 1897 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4263 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4264 free((yyvsp[0].StrVal));
4269 #line 1901 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4271 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4272 free((yyvsp[0].StrVal));
4277 #line 1908 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4279 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4280 free((yyvsp[0].StrVal));
4286 #line 1913 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4288 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4289 free((yyvsp[0].StrVal));
4295 #line 1918 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4302 #line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4303 { (yyval.StrVal) = 0; ;}
4307 #line 1930 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4309 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4310 GEN_ERROR("void typed arguments are invalid!");
4311 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4317 #line 1937 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4319 (yyval.ArgList) = (yyvsp[-2].ArgList);
4320 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4321 delete (yyvsp[0].ArgVal);
4327 #line 1943 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4329 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4330 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4331 delete (yyvsp[0].ArgVal);
4337 #line 1950 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4339 (yyval.ArgList) = (yyvsp[0].ArgList);
4345 #line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4347 (yyval.ArgList) = (yyvsp[-2].ArgList);
4348 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4349 char*>(new PATypeHolder(Type::VoidTy), 0));
4355 #line 1960 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4357 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4358 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4364 #line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4366 (yyval.ArgList) = 0;
4372 #line 1971 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4374 UnEscapeLexed((yyvsp[-5].StrVal));
4375 std::string FunctionName((yyvsp[-5].StrVal));
4376 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4378 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4379 GEN_ERROR("LLVM functions cannot return aggregate types!");
4381 std::vector<const Type*> ParamTypeList;
4382 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4383 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4384 I != (yyvsp[-3].ArgList)->end(); ++I)
4385 ParamTypeList.push_back(I->first->get());
4388 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4389 if (isVarArg) ParamTypeList.pop_back();
4391 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4392 const PointerType *PFT = PointerType::get(FT);
4393 delete (yyvsp[-6].TypeVal);
4396 if (!FunctionName.empty()) {
4397 ID = ValID::create((char*)FunctionName.c_str());
4399 ID = ValID::create((int)CurModule.Values[PFT].size());
4403 // See if this function was forward referenced. If so, recycle the object.
4404 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4405 // Move the function to the end of the list, from whereever it was
4406 // previously inserted.
4407 Fn = cast<Function>(FWRef);
4408 CurModule.CurrentModule->getFunctionList().remove(Fn);
4409 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4410 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4411 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4412 // If this is the case, either we need to be a forward decl, or it needs
4414 if (!CurFun.isDeclare && !Fn->isExternal())
4415 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4417 // Make sure to strip off any argument names so we can't get conflicts.
4418 if (Fn->isExternal())
4419 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4422 } else { // Not already defined?
4423 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4424 CurModule.CurrentModule);
4426 InsertValue(Fn, CurModule.Values);
4429 CurFun.FunctionStart(Fn);
4431 if (CurFun.isDeclare) {
4432 // If we have declaration, always overwrite linkage. This will allow us to
4433 // correctly handle cases, when pointer to function is passed as argument to
4434 // another function.
4435 Fn->setLinkage(CurFun.Linkage);
4437 Fn->setCallingConv((yyvsp[-7].UIntVal));
4438 Fn->setAlignment((yyvsp[0].UIntVal));
4439 if ((yyvsp[-1].StrVal)) {
4440 Fn->setSection((yyvsp[-1].StrVal));
4441 free((yyvsp[-1].StrVal));
4444 // Add all of the arguments we parsed to the function...
4445 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4446 if (isVarArg) { // Nuke the last entry
4447 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4448 "Not a varargs marker!");
4449 delete (yyvsp[-3].ArgList)->back().first;
4450 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4452 Function::arg_iterator ArgIt = Fn->arg_begin();
4453 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4454 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4455 delete I->first; // Delete the typeholder...
4457 setValueName(ArgIt, I->second); // Insert arg into symtab...
4462 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4469 #line 2067 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4471 (yyval.FunctionVal) = CurFun.CurrentFunction;
4473 // Make sure that we keep track of the linkage type even if there was a
4474 // previous "declare".
4475 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4480 #line 2077 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4482 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4488 #line 2083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4489 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4493 #line 2084 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4494 { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
4498 #line 2086 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4499 { CurFun.isDeclare = true; ;}
4503 #line 2086 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4505 (yyval.FunctionVal) = CurFun.CurrentFunction;
4506 CurFun.FunctionDone();
4512 #line 2096 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4514 (yyval.BoolVal) = false;
4520 #line 2100 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4522 (yyval.BoolVal) = true;
4528 #line 2105 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4529 { // A reference to a direct constant
4530 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4536 #line 2109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4538 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4544 #line 2113 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4545 { // Perhaps it's an FP constant?
4546 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4552 #line 2117 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4554 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4560 #line 2121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4562 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4568 #line 2125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4570 (yyval.ValIDVal) = ValID::createNull();
4576 #line 2129 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4578 (yyval.ValIDVal) = ValID::createUndef();
4584 #line 2133 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4585 { // A vector zero constant.
4586 (yyval.ValIDVal) = ValID::createZeroInit();
4592 #line 2137 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4593 { // Nonempty unsized packed vector
4594 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4595 int NumElements = (yyvsp[-1].ConstVector)->size();
4597 PackedType* pt = PackedType::get(ETy, NumElements);
4598 PATypeHolder* PTy = new PATypeHolder(
4606 // Verify all elements are correct type!
4607 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4608 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4609 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4610 ETy->getDescription() +"' as required!\nIt is of type '" +
4611 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4614 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4615 delete PTy; delete (yyvsp[-1].ConstVector);
4621 #line 2162 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4623 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4629 #line 2166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4631 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4632 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4633 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4634 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4635 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4636 free((yyvsp[-2].StrVal));
4637 free((yyvsp[0].StrVal));
4643 #line 2180 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4644 { // Is it an integer reference...?
4645 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4651 #line 2184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4652 { // Is it a named reference...?
4653 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4659 #line 2196 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4661 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4667 #line 2201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4669 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4675 #line 2205 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4676 { // Do not allow functions with 0 basic blocks
4677 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4683 #line 2214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4685 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4687 InsertValue((yyvsp[0].TermInstVal));
4689 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4690 InsertValue((yyvsp[-2].BasicBlockVal));
4691 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4697 #line 2225 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4699 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4700 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4701 if (CI2->getParent() == 0)
4702 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4703 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4704 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4710 #line 2234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4712 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4715 // Make sure to move the basic block to the correct location in the
4716 // function, instead of leaving it inserted wherever it was first
4718 Function::BasicBlockListType &BBL =
4719 CurFun.CurrentFunction->getBasicBlockList();
4720 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4726 #line 2246 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4728 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4731 // Make sure to move the basic block to the correct location in the
4732 // function, instead of leaving it inserted wherever it was first
4734 Function::BasicBlockListType &BBL =
4735 CurFun.CurrentFunction->getBasicBlockList();
4736 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4742 #line 2259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4743 { // Return with a result...
4744 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4750 #line 2263 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4751 { // Return with no result...
4752 (yyval.TermInstVal) = new ReturnInst();
4758 #line 2267 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4759 { // Unconditional Branch...
4760 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4762 (yyval.TermInstVal) = new BranchInst(tmpBB);
4767 #line 2272 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4769 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4771 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4773 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4775 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4780 #line 2281 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4782 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4784 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4786 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4787 (yyval.TermInstVal) = S;
4789 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4790 E = (yyvsp[-1].JumpTable)->end();
4791 for (; I != E; ++I) {
4792 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4793 S->addCase(CI, I->second);
4795 GEN_ERROR("Switch case is constant, but not a simple integer!");
4797 delete (yyvsp[-1].JumpTable);
4803 #line 2300 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4805 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4807 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4809 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4810 (yyval.TermInstVal) = S;
4816 #line 2310 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4818 const PointerType *PFTy;
4819 const FunctionType *Ty;
4821 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4822 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4823 // Pull out the types of all of the arguments...
4824 std::vector<const Type*> ParamTypes;
4825 if ((yyvsp[-7].ValueList)) {
4826 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4828 ParamTypes.push_back((*I)->getType());
4831 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4832 if (isVarArg) ParamTypes.pop_back();
4834 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4835 PFTy = PointerType::get(Ty);
4838 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4840 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4842 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4845 // Create the call node...
4846 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4847 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4848 } else { // Has arguments?
4849 // Loop through FunctionType's arguments and ensure they are specified
4852 FunctionType::param_iterator I = Ty->param_begin();
4853 FunctionType::param_iterator E = Ty->param_end();
4854 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4856 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4857 if ((*ArgI)->getType() != *I)
4858 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4859 (*I)->getDescription() + "'!");
4861 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4862 GEN_ERROR("Invalid number of parameters detected!");
4864 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4866 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4868 delete (yyvsp[-10].TypeVal);
4869 delete (yyvsp[-7].ValueList);
4875 #line 2365 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4877 (yyval.TermInstVal) = new UnwindInst();
4883 #line 2369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4885 (yyval.TermInstVal) = new UnreachableInst();
4891 #line 2376 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4893 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4894 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4897 GEN_ERROR("May only switch on a constant pool value!");
4899 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4901 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4906 #line 2387 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4908 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4909 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4913 GEN_ERROR("May only switch on a constant pool value!");
4915 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4917 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4922 #line 2400 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4924 // Is this definition named?? if so, assign the name...
4925 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
4927 InsertValue((yyvsp[0].InstVal));
4928 (yyval.InstVal) = (yyvsp[0].InstVal);
4934 #line 2409 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4935 { // Used for PHI nodes
4936 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
4937 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
4939 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4941 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4942 delete (yyvsp[-5].TypeVal);
4947 #line 2418 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4949 (yyval.PHIList) = (yyvsp[-6].PHIList);
4950 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
4952 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4954 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4959 #line 2428 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4960 { // Used for call statements, and memory insts...
4961 (yyval.ValueList) = new std::vector<Value*>();
4962 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
4967 #line 2432 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4969 (yyval.ValueList) = (yyvsp[-2].ValueList);
4970 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
4976 #line 2439 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4977 { (yyval.ValueList) = 0; ;}
4981 #line 2441 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4983 (yyval.BoolVal) = true;
4989 #line 2445 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4991 (yyval.BoolVal) = false;
4997 #line 2450 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4999 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5000 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5002 "Arithmetic operator requires integer, FP, or packed operands!");
5003 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5004 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5005 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5006 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5007 GEN_ERROR("U/S/FRem not supported on packed types!");
5008 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5010 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5012 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5013 if ((yyval.InstVal) == 0)
5014 GEN_ERROR("binary operator returned null!");
5015 delete (yyvsp[-3].TypeVal);
5020 #line 2469 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5022 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5023 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5024 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5025 GEN_ERROR("Logical operator requires integral operands!");
5027 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5029 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5031 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5032 if ((yyval.InstVal) == 0)
5033 GEN_ERROR("binary operator returned null!");
5034 delete (yyvsp[-3].TypeVal);
5039 #line 2484 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5041 if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
5043 "PackedTypes currently not supported in setcc instructions!");
5045 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5047 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5049 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5050 if ((yyval.InstVal) == 0)
5051 GEN_ERROR("binary operator returned null!");
5052 delete (yyvsp[-3].TypeVal);
5057 #line 2498 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5059 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5060 GEN_ERROR("Packed types not supported by icmp instruction");
5061 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5063 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5065 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5066 if ((yyval.InstVal) == 0)
5067 GEN_ERROR("icmp operator returned null!");
5072 #line 2509 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5074 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5075 GEN_ERROR("Packed types not supported by fcmp instruction");
5076 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5078 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5080 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5081 if ((yyval.InstVal) == 0)
5082 GEN_ERROR("fcmp operator returned null!");
5087 #line 2520 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5089 llvm_cerr << "WARNING: Use of eliminated 'not' instruction:"
5090 << " Replacing with 'xor'.\n";
5092 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5094 GEN_ERROR("Expected integral type for not instruction!");
5096 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5097 if ((yyval.InstVal) == 0)
5098 GEN_ERROR("Could not create a xor instruction!");
5104 #line 2533 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5106 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
5107 GEN_ERROR("Shift amount must be ubyte!");
5108 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5109 GEN_ERROR("Shift constant expression requires integer operand!");
5111 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5117 #line 2542 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5119 Value* Val = (yyvsp[-2].ValueVal);
5120 const Type* Ty = (yyvsp[0].TypeVal)->get();
5121 if (!Val->getType()->isFirstClassType())
5122 GEN_ERROR("cast from a non-primitive type: '" +
5123 Val->getType()->getDescription() + "'!");
5124 if (!Ty->isFirstClassType())
5125 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5126 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get());
5127 delete (yyvsp[0].TypeVal);
5132 #line 2553 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5134 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5135 GEN_ERROR("select condition must be boolean!");
5136 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5137 GEN_ERROR("select value types should match!");
5138 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5144 #line 2561 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5147 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5148 delete (yyvsp[0].TypeVal);
5154 #line 2567 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5156 ObsoleteVarArgs = true;
5157 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5158 Function* NF = CurModule.CurrentModule->
5159 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5162 //foo = alloca 1 of t
5166 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
5167 CurBB->getInstList().push_back(foo);
5168 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5169 CurBB->getInstList().push_back(bar);
5170 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5171 (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5172 delete (yyvsp[0].TypeVal);
5178 #line 2587 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5180 ObsoleteVarArgs = true;
5181 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5182 Function* NF = CurModule.CurrentModule->
5183 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5185 //b = vanext a, t ->
5186 //foo = alloca 1 of t
5189 //tmp = vaarg foo, t
5191 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
5192 CurBB->getInstList().push_back(foo);
5193 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5194 CurBB->getInstList().push_back(bar);
5195 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5196 Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5197 CurBB->getInstList().push_back(tmp);
5198 (yyval.InstVal) = new LoadInst(foo);
5199 delete (yyvsp[0].TypeVal);
5205 #line 2610 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5207 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5208 GEN_ERROR("Invalid extractelement operands!");
5209 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5215 #line 2616 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5217 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5218 GEN_ERROR("Invalid insertelement operands!");
5219 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5225 #line 2622 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5227 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5228 GEN_ERROR("Invalid shufflevector operands!");
5229 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5235 #line 2628 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5237 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5238 if (!Ty->isFirstClassType())
5239 GEN_ERROR("PHI node operands must be of first class type!");
5240 (yyval.InstVal) = new PHINode(Ty);
5241 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5242 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5243 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5244 GEN_ERROR("All elements of a PHI node must be of the same type!");
5245 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5246 (yyvsp[0].PHIList)->pop_front();
5248 delete (yyvsp[0].PHIList); // Free the list...
5254 #line 2643 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5256 const PointerType *PFTy = 0;
5257 const FunctionType *Ty = 0;
5259 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5260 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5261 // Pull out the types of all of the arguments...
5262 std::vector<const Type*> ParamTypes;
5263 if ((yyvsp[-1].ValueList)) {
5264 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5266 ParamTypes.push_back((*I)->getType());
5269 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5270 if (isVarArg) ParamTypes.pop_back();
5272 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5273 GEN_ERROR("LLVM functions cannot return aggregate types!");
5275 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5276 PFTy = PointerType::get(Ty);
5279 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5282 // Create the call node...
5283 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5284 // Make sure no arguments is a good thing!
5285 if (Ty->getNumParams() != 0)
5286 GEN_ERROR("No arguments passed to a function that "
5287 "expects arguments!");
5289 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5290 } else { // Has arguments?
5291 // Loop through FunctionType's arguments and ensure they are specified
5294 FunctionType::param_iterator I = Ty->param_begin();
5295 FunctionType::param_iterator E = Ty->param_end();
5296 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5298 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5299 if ((*ArgI)->getType() != *I)
5300 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5301 (*I)->getDescription() + "'!");
5303 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5304 GEN_ERROR("Invalid number of parameters detected!");
5306 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5308 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5309 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5310 delete (yyvsp[-4].TypeVal);
5311 delete (yyvsp[-1].ValueList);
5317 #line 2702 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5319 (yyval.InstVal) = (yyvsp[0].InstVal);
5325 #line 2709 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5327 (yyval.ValueList) = (yyvsp[0].ValueList);
5333 #line 2712 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5335 (yyval.ValueList) = new std::vector<Value*>();
5341 #line 2717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5343 (yyval.BoolVal) = true;
5349 #line 2721 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5351 (yyval.BoolVal) = false;
5357 #line 2728 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5359 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5360 delete (yyvsp[-1].TypeVal);
5366 #line 2733 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5368 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5370 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5371 delete (yyvsp[-4].TypeVal);
5376 #line 2739 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5378 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5379 delete (yyvsp[-1].TypeVal);
5385 #line 2744 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5387 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5389 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5390 delete (yyvsp[-4].TypeVal);
5395 #line 2750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5397 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5398 GEN_ERROR("Trying to free nonpointer type " +
5399 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5400 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5406 #line 2758 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5408 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5409 GEN_ERROR("Can't load from nonpointer type: " +
5410 (*(yyvsp[-1].TypeVal))->getDescription());
5411 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5412 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5413 (*(yyvsp[-1].TypeVal))->getDescription());
5414 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5416 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5417 delete (yyvsp[-1].TypeVal);
5422 #line 2770 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5424 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5426 GEN_ERROR("Can't store to a nonpointer type: " +
5427 (*(yyvsp[-1].TypeVal))->getDescription());
5428 const Type *ElTy = PT->getElementType();
5429 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5430 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5431 "' into space of type '" + ElTy->getDescription() + "'!");
5433 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5435 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5436 delete (yyvsp[-1].TypeVal);
5441 #line 2785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5443 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5444 GEN_ERROR("getelementptr insn requires pointer operand!");
5446 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
5447 // indices to uint struct indices for compatibility.
5448 generic_gep_type_iterator<std::vector<Value*>::iterator>
5449 GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
5450 GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
5451 for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
5452 if (isa<StructType>(*GTI)) // Only change struct indices
5453 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[0].ValueList))[i]))
5454 if (CUI->getType() == Type::UByteTy)
5455 (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
5457 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5458 GEN_ERROR("Invalid getelementptr indices for type '" +
5459 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5460 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5462 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5463 delete (yyvsp[-2].TypeVal);
5464 delete (yyvsp[0].ValueList);
5472 /* Line 1126 of yacc.c. */
5473 #line 5474 "llvmAsmParser.tab.c"
5479 YY_STACK_PRINT (yyss, yyssp);
5484 /* Now `shift' the result of the reduction. Determine what state
5485 that goes to, based on the state we popped back to and the rule
5486 number reduced by. */
5490 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5491 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5492 yystate = yytable[yystate];
5494 yystate = yydefgoto[yyn - YYNTOKENS];
5499 /*------------------------------------.
5500 | yyerrlab -- here on detecting error |
5501 `------------------------------------*/
5503 /* If not already recovering from an error, report this error. */
5508 yyn = yypact[yystate];
5510 if (YYPACT_NINF < yyn && yyn < YYLAST)
5512 int yytype = YYTRANSLATE (yychar);
5513 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5514 YYSIZE_T yysize = yysize0;
5516 int yysize_overflow = 0;
5518 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5519 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5523 /* This is so xgettext sees the translatable formats that are
5524 constructed on the fly. */
5525 YY_("syntax error, unexpected %s");
5526 YY_("syntax error, unexpected %s, expecting %s");
5527 YY_("syntax error, unexpected %s, expecting %s or %s");
5528 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5529 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5533 static char const yyunexpected[] = "syntax error, unexpected %s";
5534 static char const yyexpecting[] = ", expecting %s";
5535 static char const yyor[] = " or %s";
5536 char yyformat[sizeof yyunexpected
5537 + sizeof yyexpecting - 1
5538 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5539 * (sizeof yyor - 1))];
5540 char const *yyprefix = yyexpecting;
5542 /* Start YYX at -YYN if negative to avoid negative indexes in
5544 int yyxbegin = yyn < 0 ? -yyn : 0;
5546 /* Stay within bounds of both yycheck and yytname. */
5547 int yychecklim = YYLAST - yyn;
5548 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5551 yyarg[0] = yytname[yytype];
5552 yyfmt = yystpcpy (yyformat, yyunexpected);
5554 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5555 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5557 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5561 yyformat[sizeof yyunexpected - 1] = '\0';
5564 yyarg[yycount++] = yytname[yyx];
5565 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5566 yysize_overflow |= yysize1 < yysize;
5568 yyfmt = yystpcpy (yyfmt, yyprefix);
5572 yyf = YY_(yyformat);
5573 yysize1 = yysize + yystrlen (yyf);
5574 yysize_overflow |= yysize1 < yysize;
5577 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5578 yymsg = (char *) YYSTACK_ALLOC (yysize);
5581 /* Avoid sprintf, as that infringes on the user's name space.
5582 Don't have undefined behavior even if the translation
5583 produced a string with the wrong number of "%s"s. */
5586 while ((*yyp = *yyf))
5588 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5590 yyp += yytnamerr (yyp, yyarg[yyi++]);
5600 YYSTACK_FREE (yymsg);
5604 yyerror (YY_("syntax error"));
5605 goto yyexhaustedlab;
5609 #endif /* YYERROR_VERBOSE */
5610 yyerror (YY_("syntax error"));
5615 if (yyerrstatus == 3)
5617 /* If just tried and failed to reuse look-ahead token after an
5618 error, discard it. */
5620 if (yychar <= YYEOF)
5622 /* Return failure if at end of input. */
5623 if (yychar == YYEOF)
5628 yydestruct ("Error: discarding", yytoken, &yylval);
5633 /* Else will try to reuse look-ahead token after shifting the error
5638 /*---------------------------------------------------.
5639 | yyerrorlab -- error raised explicitly by YYERROR. |
5640 `---------------------------------------------------*/
5643 /* Pacify compilers like GCC when the user code never invokes
5644 YYERROR and the label yyerrorlab therefore never appears in user
5655 /*-------------------------------------------------------------.
5656 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5657 `-------------------------------------------------------------*/
5659 yyerrstatus = 3; /* Each real token shifted decrements this. */
5663 yyn = yypact[yystate];
5664 if (yyn != YYPACT_NINF)
5667 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5675 /* Pop the current state because it cannot handle the error token. */
5680 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5683 YY_STACK_PRINT (yyss, yyssp);
5692 /* Shift the error token. */
5693 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5699 /*-------------------------------------.
5700 | yyacceptlab -- YYACCEPT comes here. |
5701 `-------------------------------------*/
5706 /*-----------------------------------.
5707 | yyabortlab -- YYABORT comes here. |
5708 `-----------------------------------*/
5714 /*-------------------------------------------------.
5715 | yyexhaustedlab -- memory exhaustion comes here. |
5716 `-------------------------------------------------*/
5718 yyerror (YY_("memory exhausted"));
5724 if (yychar != YYEOF && yychar != YYEMPTY)
5725 yydestruct ("Cleanup: discarding lookahead",
5727 while (yyssp != yyss)
5729 yydestruct ("Cleanup: popping",
5730 yystos[*yyssp], yyvsp);
5735 YYSTACK_FREE (yyss);
5741 #line 2811 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5744 void llvm::GenerateError(const std::string &message, int LineNo) {
5745 if (LineNo == -1) LineNo = llvmAsmlineno;
5746 // TODO: column number in exception
5748 TheParseError->setError(CurFilename, message, LineNo);
5752 int yyerror(const char *ErrorMsg) {
5754 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5755 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5756 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5757 if (yychar == YYEMPTY || yychar == 0)
5758 errMsg += "end-of-file.";
5760 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5761 GenerateError(errMsg);