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,
206 EXTRACTELEMENT = 397,
214 #define ESINT64VAL 258
215 #define EUINT64VAL 259
235 #define STRINGCONSTANT 279
236 #define IMPLEMENTATION 280
237 #define ZEROINITIALIZER 281
248 #define DOTDOTDOT 292
255 #define APPENDING 299
256 #define DLLIMPORT 300
257 #define DLLEXPORT 301
258 #define EXTERN_WEAK 302
265 #define POINTERSIZE 309
274 #define SIDEEFFECT 318
277 #define CSRETCC_TOK 321
278 #define FASTCC_TOK 322
279 #define COLDCC_TOK 323
280 #define X86_STDCALLCC_TOK 324
281 #define X86_FASTCALLCC_TOK 325
282 #define DATALAYOUT 326
288 #define UNREACHABLE 332
334 #define GETELEMENTPTR 378
353 #define EXTRACTELEMENT 397
354 #define INSERTELEMENT 398
355 #define SHUFFLEVECTOR 399
356 #define VAARG_old 400
357 #define VANEXT_old 401
362 /* Copy the first part of user declarations. */
363 #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
365 #include "ParserInternals.h"
366 #include "llvm/CallingConv.h"
367 #include "llvm/InlineAsm.h"
368 #include "llvm/Instructions.h"
369 #include "llvm/Module.h"
370 #include "llvm/SymbolTable.h"
371 #include "llvm/Assembly/AutoUpgrade.h"
372 #include "llvm/Support/GetElementPtrTypeIterator.h"
373 #include "llvm/ADT/STLExtras.h"
374 #include "llvm/Support/MathExtras.h"
375 #include "llvm/Support/Streams.h"
380 // The following is a gross hack. In order to rid the libAsmParser library of
381 // exceptions, we have to have a way of getting the yyparse function to go into
382 // an error situation. So, whenever we want an error to occur, the GenerateError
383 // function (see bottom of file) sets TriggerError. Then, at the end of each
384 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
385 // (a goto) to put YACC in error state. Furthermore, several calls to
386 // GenerateError are made from inside productions and they must simulate the
387 // previous exception behavior by exiting the production immediately. We have
388 // replaced these with the GEN_ERROR macro which calls GeneratError and then
389 // immediately invokes YYERROR. This would be so much cleaner if it was a
390 // recursive descent parser.
391 static bool TriggerError = false;
392 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
393 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
395 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
396 int yylex(); // declaration" of xxx warnings.
400 std::string CurFilename;
402 using namespace llvm;
404 static Module *ParserResult;
406 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
407 // relating to upreferences in the input stream.
409 //#define DEBUG_UPREFS 1
411 #define UR_OUT(X) llvm_cerr << X
416 #define YYERROR_VERBOSE 1
418 static bool ObsoleteVarArgs;
419 static bool NewVarArgs;
420 static BasicBlock *CurBB;
421 static GlobalVariable *CurGV;
424 // This contains info used when building the body of a function. It is
425 // destroyed when the function is completed.
427 typedef std::vector<Value *> ValueList; // Numbered defs
429 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
430 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
432 static struct PerModuleInfo {
433 Module *CurrentModule;
434 std::map<const Type *, ValueList> Values; // Module level numbered definitions
435 std::map<const Type *,ValueList> LateResolveValues;
436 std::vector<PATypeHolder> Types;
437 std::map<ValID, PATypeHolder> LateResolveTypes;
439 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
440 /// how they were referenced and on which line of the input they came from so
441 /// that we can resolve them later and print error messages as appropriate.
442 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
444 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
445 // references to global values. Global values may be referenced before they
446 // are defined, and if so, the temporary object that they represent is held
447 // here. This is used for forward references of GlobalValues.
449 typedef std::map<std::pair<const PointerType *,
450 ValID>, GlobalValue*> GlobalRefsType;
451 GlobalRefsType GlobalRefs;
454 // If we could not resolve some functions at function compilation time
455 // (calls to functions before they are defined), resolve them now... Types
456 // are resolved when the constant pool has been completely parsed.
458 ResolveDefinitions(LateResolveValues);
462 // Check to make sure that all global value forward references have been
465 if (!GlobalRefs.empty()) {
466 std::string UndefinedReferences = "Unresolved global references exist:\n";
468 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
470 UndefinedReferences += " " + I->first.first->getDescription() + " " +
471 I->first.second.getName() + "\n";
473 GenerateError(UndefinedReferences);
477 Values.clear(); // Clear out function local definitions
482 // GetForwardRefForGlobal - Check to see if there is a forward reference
483 // for this global. If so, remove it from the GlobalRefs map and return it.
484 // If not, just return null.
485 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
486 // Check to see if there is a forward reference to this global variable...
487 // if there is, eliminate it and patch the reference to use the new def'n.
488 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
489 GlobalValue *Ret = 0;
490 if (I != GlobalRefs.end()) {
498 static struct PerFunctionInfo {
499 Function *CurrentFunction; // Pointer to current function being created
501 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
502 std::map<const Type*, ValueList> LateResolveValues;
503 bool isDeclare; // Is this function a forward declararation?
504 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
506 /// BBForwardRefs - When we see forward references to basic blocks, keep
507 /// track of them here.
508 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
509 std::vector<BasicBlock*> NumberedBlocks;
512 inline PerFunctionInfo() {
515 Linkage = GlobalValue::ExternalLinkage;
518 inline void FunctionStart(Function *M) {
523 void FunctionDone() {
524 NumberedBlocks.clear();
526 // Any forward referenced blocks left?
527 if (!BBForwardRefs.empty()) {
528 GenerateError("Undefined reference to label " +
529 BBForwardRefs.begin()->first->getName());
533 // Resolve all forward references now.
534 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
536 Values.clear(); // Clear out function local definitions
539 Linkage = GlobalValue::ExternalLinkage;
541 } CurFun; // Info for the current function...
543 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
546 //===----------------------------------------------------------------------===//
547 // Code to handle definitions of all the types
548 //===----------------------------------------------------------------------===//
550 static int InsertValue(Value *V,
551 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
552 if (V->hasName()) return -1; // Is this a numbered definition?
554 // Yes, insert the value into the value table...
555 ValueList &List = ValueTab[V->getType()];
557 return List.size()-1;
560 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
562 case ValID::NumberVal: // Is it a numbered definition?
563 // Module constants occupy the lowest numbered slots...
564 if ((unsigned)D.Num < CurModule.Types.size())
565 return CurModule.Types[(unsigned)D.Num];
567 case ValID::NameVal: // Is it a named definition?
568 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
569 D.destroy(); // Free old strdup'd memory...
574 GenerateError("Internal parser error: Invalid symbol type reference!");
578 // If we reached here, we referenced either a symbol that we don't know about
579 // or an id number that hasn't been read yet. We may be referencing something
580 // forward, so just create an entry to be resolved later and get to it...
582 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
585 if (inFunctionScope()) {
586 if (D.Type == ValID::NameVal) {
587 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
590 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
595 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
596 if (I != CurModule.LateResolveTypes.end())
599 Type *Typ = OpaqueType::get();
600 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
604 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
605 SymbolTable &SymTab =
606 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
607 CurModule.CurrentModule->getSymbolTable();
608 return SymTab.lookup(Ty, Name);
611 // getValNonImprovising - Look up the value specified by the provided type and
612 // the provided ValID. If the value exists and has already been defined, return
613 // it. Otherwise return null.
615 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
616 if (isa<FunctionType>(Ty)) {
617 GenerateError("Functions are not values and "
618 "must be referenced as pointers");
623 case ValID::NumberVal: { // Is it a numbered definition?
624 unsigned Num = (unsigned)D.Num;
626 // Module constants occupy the lowest numbered slots...
627 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
628 if (VI != CurModule.Values.end()) {
629 if (Num < VI->second.size())
630 return VI->second[Num];
631 Num -= VI->second.size();
634 // Make sure that our type is within bounds
635 VI = CurFun.Values.find(Ty);
636 if (VI == CurFun.Values.end()) return 0;
638 // Check that the number is within bounds...
639 if (VI->second.size() <= Num) return 0;
641 return VI->second[Num];
644 case ValID::NameVal: { // Is it a named definition?
645 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
646 if (N == 0) return 0;
648 D.destroy(); // Free old strdup'd memory...
652 // Check to make sure that "Ty" is an integral type, and that our
653 // value will fit into the specified type...
654 case ValID::ConstSIntVal: // Is it a constant pool reference??
655 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
656 GenerateError("Signed integral constant '" +
657 itostr(D.ConstPool64) + "' is invalid for type '" +
658 Ty->getDescription() + "'!");
661 return ConstantInt::get(Ty, D.ConstPool64);
663 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
664 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
665 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
666 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
667 "' is invalid or out of range!");
669 } else { // This is really a signed reference. Transmogrify.
670 return ConstantInt::get(Ty, D.ConstPool64);
673 return ConstantInt::get(Ty, D.UConstPool64);
676 case ValID::ConstFPVal: // Is it a floating point const pool reference?
677 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
678 GenerateError("FP constant invalid for type!!");
681 return ConstantFP::get(Ty, D.ConstPoolFP);
683 case ValID::ConstNullVal: // Is it a null value?
684 if (!isa<PointerType>(Ty)) {
685 GenerateError("Cannot create a a non pointer null!");
688 return ConstantPointerNull::get(cast<PointerType>(Ty));
690 case ValID::ConstUndefVal: // Is it an undef value?
691 return UndefValue::get(Ty);
693 case ValID::ConstZeroVal: // Is it a zero value?
694 return Constant::getNullValue(Ty);
696 case ValID::ConstantVal: // Fully resolved constant?
697 if (D.ConstantValue->getType() != Ty) {
698 GenerateError("Constant expression type different from required type!");
701 return D.ConstantValue;
703 case ValID::InlineAsmVal: { // Inline asm expression
704 const PointerType *PTy = dyn_cast<PointerType>(Ty);
705 const FunctionType *FTy =
706 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
707 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
708 GenerateError("Invalid type for asm constraint string!");
711 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
712 D.IAD->HasSideEffects);
713 D.destroy(); // Free InlineAsmDescriptor.
717 assert(0 && "Unhandled case!");
721 assert(0 && "Unhandled case!");
725 // getVal - This function is identical to getValNonImprovising, except that if a
726 // value is not already defined, it "improvises" by creating a placeholder var
727 // that looks and acts just like the requested variable. When the value is
728 // defined later, all uses of the placeholder variable are replaced with the
731 static Value *getVal(const Type *Ty, const ValID &ID) {
732 if (Ty == Type::LabelTy) {
733 GenerateError("Cannot use a basic block here");
737 // See if the value has already been defined.
738 Value *V = getValNonImprovising(Ty, ID);
740 if (TriggerError) return 0;
742 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
743 GenerateError("Invalid use of a composite type!");
747 // If we reached here, we referenced either a symbol that we don't know about
748 // or an id number that hasn't been read yet. We may be referencing something
749 // forward, so just create an entry to be resolved later and get to it...
751 V = new Argument(Ty);
753 // Remember where this forward reference came from. FIXME, shouldn't we try
754 // to recycle these things??
755 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
758 if (inFunctionScope())
759 InsertValue(V, CurFun.LateResolveValues);
761 InsertValue(V, CurModule.LateResolveValues);
765 /// getBBVal - This is used for two purposes:
766 /// * If isDefinition is true, a new basic block with the specified ID is being
768 /// * If isDefinition is true, this is a reference to a basic block, which may
769 /// or may not be a forward reference.
771 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
772 assert(inFunctionScope() && "Can't get basic block at global scope!");
778 GenerateError("Illegal label reference " + ID.getName());
780 case ValID::NumberVal: // Is it a numbered definition?
781 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
782 CurFun.NumberedBlocks.resize(ID.Num+1);
783 BB = CurFun.NumberedBlocks[ID.Num];
785 case ValID::NameVal: // Is it a named definition?
787 if (Value *N = CurFun.CurrentFunction->
788 getSymbolTable().lookup(Type::LabelTy, Name))
789 BB = cast<BasicBlock>(N);
793 // See if the block has already been defined.
795 // If this is the definition of the block, make sure the existing value was
796 // just a forward reference. If it was a forward reference, there will be
797 // an entry for it in the PlaceHolderInfo map.
798 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
799 // The existing value was a definition, not a forward reference.
800 GenerateError("Redefinition of label " + ID.getName());
804 ID.destroy(); // Free strdup'd memory.
808 // Otherwise this block has not been seen before.
809 BB = new BasicBlock("", CurFun.CurrentFunction);
810 if (ID.Type == ValID::NameVal) {
811 BB->setName(ID.Name);
813 CurFun.NumberedBlocks[ID.Num] = BB;
816 // If this is not a definition, keep track of it so we can use it as a forward
819 // Remember where this forward reference came from.
820 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
822 // The forward declaration could have been inserted anywhere in the
823 // function: insert it into the correct place now.
824 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
825 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
832 //===----------------------------------------------------------------------===//
833 // Code to handle forward references in instructions
834 //===----------------------------------------------------------------------===//
836 // This code handles the late binding needed with statements that reference
837 // values not defined yet... for example, a forward branch, or the PHI node for
840 // This keeps a table (CurFun.LateResolveValues) of all such forward references
841 // and back patchs after we are done.
844 // ResolveDefinitions - If we could not resolve some defs at parsing
845 // time (forward branches, phi functions for loops, etc...) resolve the
849 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
850 std::map<const Type*,ValueList> *FutureLateResolvers) {
851 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
852 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
853 E = LateResolvers.end(); LRI != E; ++LRI) {
854 ValueList &List = LRI->second;
855 while (!List.empty()) {
856 Value *V = List.back();
859 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
860 CurModule.PlaceHolderInfo.find(V);
861 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
863 ValID &DID = PHI->second.first;
865 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
869 V->replaceAllUsesWith(TheRealValue);
871 CurModule.PlaceHolderInfo.erase(PHI);
872 } else if (FutureLateResolvers) {
873 // Functions have their unresolved items forwarded to the module late
875 InsertValue(V, *FutureLateResolvers);
877 if (DID.Type == ValID::NameVal) {
878 GenerateError("Reference to an invalid definition: '" +DID.getName()+
879 "' of type '" + V->getType()->getDescription() + "'",
883 GenerateError("Reference to an invalid definition: #" +
884 itostr(DID.Num) + " of type '" +
885 V->getType()->getDescription() + "'",
893 LateResolvers.clear();
896 // ResolveTypeTo - A brand new type was just declared. This means that (if
897 // name is not null) things referencing Name can be resolved. Otherwise, things
898 // refering to the number can be resolved. Do this now.
900 static void ResolveTypeTo(char *Name, const Type *ToTy) {
902 if (Name) D = ValID::create(Name);
903 else D = ValID::create((int)CurModule.Types.size());
905 std::map<ValID, PATypeHolder>::iterator I =
906 CurModule.LateResolveTypes.find(D);
907 if (I != CurModule.LateResolveTypes.end()) {
908 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
909 CurModule.LateResolveTypes.erase(I);
913 // setValueName - Set the specified value to the name given. The name may be
914 // null potentially, in which case this is a noop. The string passed in is
915 // assumed to be a malloc'd string buffer, and is free'd by this function.
917 static void setValueName(Value *V, char *NameStr) {
919 std::string Name(NameStr); // Copy string
920 free(NameStr); // Free old string
922 if (V->getType() == Type::VoidTy) {
923 GenerateError("Can't assign name '" + Name+"' to value with void type!");
927 assert(inFunctionScope() && "Must be in function scope!");
928 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
929 if (ST.lookup(V->getType(), Name)) {
930 GenerateError("Redefinition of value named '" + Name + "' in the '" +
931 V->getType()->getDescription() + "' type plane!");
940 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
941 /// this is a declaration, otherwise it is a definition.
942 static GlobalVariable *
943 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
944 bool isConstantGlobal, const Type *Ty,
945 Constant *Initializer) {
946 if (isa<FunctionType>(Ty)) {
947 GenerateError("Cannot declare global vars of function type!");
951 const PointerType *PTy = PointerType::get(Ty);
955 Name = NameStr; // Copy string
956 free(NameStr); // Free old string
959 // See if this global value was forward referenced. If so, recycle the
963 ID = ValID::create((char*)Name.c_str());
965 ID = ValID::create((int)CurModule.Values[PTy].size());
968 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
969 // Move the global to the end of the list, from whereever it was
970 // previously inserted.
971 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
972 CurModule.CurrentModule->getGlobalList().remove(GV);
973 CurModule.CurrentModule->getGlobalList().push_back(GV);
974 GV->setInitializer(Initializer);
975 GV->setLinkage(Linkage);
976 GV->setConstant(isConstantGlobal);
977 InsertValue(GV, CurModule.Values);
981 // If this global has a name, check to see if there is already a definition
982 // of this global in the module. If so, merge as appropriate. Note that
983 // this is really just a hack around problems in the CFE. :(
985 // We are a simple redefinition of a value, check to see if it is defined
986 // the same as the old one.
987 if (GlobalVariable *EGV =
988 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
989 // We are allowed to redefine a global variable in two circumstances:
990 // 1. If at least one of the globals is uninitialized or
991 // 2. If both initializers have the same value.
993 if (!EGV->hasInitializer() || !Initializer ||
994 EGV->getInitializer() == Initializer) {
996 // Make sure the existing global version gets the initializer! Make
997 // sure that it also gets marked const if the new version is.
998 if (Initializer && !EGV->hasInitializer())
999 EGV->setInitializer(Initializer);
1000 if (isConstantGlobal)
1001 EGV->setConstant(true);
1002 EGV->setLinkage(Linkage);
1006 GenerateError("Redefinition of global variable named '" + Name +
1007 "' in the '" + Ty->getDescription() + "' type plane!");
1012 // Otherwise there is no existing GV to use, create one now.
1013 GlobalVariable *GV =
1014 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1015 CurModule.CurrentModule);
1016 InsertValue(GV, CurModule.Values);
1020 // setTypeName - Set the specified type to the name given. The name may be
1021 // null potentially, in which case this is a noop. The string passed in is
1022 // assumed to be a malloc'd string buffer, and is freed by this function.
1024 // This function returns true if the type has already been defined, but is
1025 // allowed to be redefined in the specified context. If the name is a new name
1026 // for the type plane, it is inserted and false is returned.
1027 static bool setTypeName(const Type *T, char *NameStr) {
1028 assert(!inFunctionScope() && "Can't give types function-local names!");
1029 if (NameStr == 0) return false;
1031 std::string Name(NameStr); // Copy string
1032 free(NameStr); // Free old string
1034 // We don't allow assigning names to void type
1035 if (T == Type::VoidTy) {
1036 GenerateError("Can't assign name '" + Name + "' to the void type!");
1040 // Set the type name, checking for conflicts as we do so.
1041 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1043 if (AlreadyExists) { // Inserting a name that is already defined???
1044 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1045 assert(Existing && "Conflict but no matching type?");
1047 // There is only one case where this is allowed: when we are refining an
1048 // opaque type. In this case, Existing will be an opaque type.
1049 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1050 // We ARE replacing an opaque type!
1051 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1055 // Otherwise, this is an attempt to redefine a type. That's okay if
1056 // the redefinition is identical to the original. This will be so if
1057 // Existing and T point to the same Type object. In this one case we
1058 // allow the equivalent redefinition.
1059 if (Existing == T) return true; // Yes, it's equal.
1061 // Any other kind of (non-equivalent) redefinition is an error.
1062 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1063 T->getDescription() + "' type plane!");
1069 //===----------------------------------------------------------------------===//
1070 // Code for handling upreferences in type names...
1073 // TypeContains - Returns true if Ty directly contains E in it.
1075 static bool TypeContains(const Type *Ty, const Type *E) {
1076 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1077 E) != Ty->subtype_end();
1081 struct UpRefRecord {
1082 // NestingLevel - The number of nesting levels that need to be popped before
1083 // this type is resolved.
1084 unsigned NestingLevel;
1086 // LastContainedTy - This is the type at the current binding level for the
1087 // type. Every time we reduce the nesting level, this gets updated.
1088 const Type *LastContainedTy;
1090 // UpRefTy - This is the actual opaque type that the upreference is
1091 // represented with.
1092 OpaqueType *UpRefTy;
1094 UpRefRecord(unsigned NL, OpaqueType *URTy)
1095 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1099 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1100 static std::vector<UpRefRecord> UpRefs;
1102 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1103 /// called. It loops through the UpRefs vector, which is a list of the
1104 /// currently active types. For each type, if the up reference is contained in
1105 /// the newly completed type, we decrement the level count. When the level
1106 /// count reaches zero, the upreferenced type is the type that is passed in:
1107 /// thus we can complete the cycle.
1109 static PATypeHolder HandleUpRefs(const Type *ty) {
1110 // If Ty isn't abstract, or if there are no up-references in it, then there is
1111 // nothing to resolve here.
1112 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1114 PATypeHolder Ty(ty);
1115 UR_OUT("Type '" << Ty->getDescription() <<
1116 "' newly formed. Resolving upreferences.\n" <<
1117 UpRefs.size() << " upreferences active!\n");
1119 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1120 // to zero), we resolve them all together before we resolve them to Ty. At
1121 // the end of the loop, if there is anything to resolve to Ty, it will be in
1123 OpaqueType *TypeToResolve = 0;
1125 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1126 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1127 << UpRefs[i].second->getDescription() << ") = "
1128 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1129 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1130 // Decrement level of upreference
1131 unsigned Level = --UpRefs[i].NestingLevel;
1132 UpRefs[i].LastContainedTy = Ty;
1133 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1134 if (Level == 0) { // Upreference should be resolved!
1135 if (!TypeToResolve) {
1136 TypeToResolve = UpRefs[i].UpRefTy;
1138 UR_OUT(" * Resolving upreference for "
1139 << UpRefs[i].second->getDescription() << "\n";
1140 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1141 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1142 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1143 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1145 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1146 --i; // Do not skip the next element...
1151 if (TypeToResolve) {
1152 UR_OUT(" * Resolving upreference for "
1153 << UpRefs[i].second->getDescription() << "\n";
1154 std::string OldName = TypeToResolve->getDescription());
1155 TypeToResolve->refineAbstractTypeTo(Ty);
1161 // common code from the two 'RunVMAsmParser' functions
1162 static Module* RunParser(Module * M) {
1164 llvmAsmlineno = 1; // Reset the current line number...
1165 ObsoleteVarArgs = false;
1167 CurModule.CurrentModule = M;
1169 // Check to make sure the parser succeeded
1172 delete ParserResult;
1176 // Check to make sure that parsing produced a result
1180 // Reset ParserResult variable while saving its value for the result.
1181 Module *Result = ParserResult;
1184 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1187 if ((F = Result->getNamedFunction("llvm.va_start"))
1188 && F->getFunctionType()->getNumParams() == 0)
1189 ObsoleteVarArgs = true;
1190 if((F = Result->getNamedFunction("llvm.va_copy"))
1191 && F->getFunctionType()->getNumParams() == 1)
1192 ObsoleteVarArgs = true;
1195 if (ObsoleteVarArgs && NewVarArgs) {
1197 "This file is corrupt: it uses both new and old style varargs");
1201 if(ObsoleteVarArgs) {
1202 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1203 if (F->arg_size() != 0) {
1204 GenerateError("Obsolete va_start takes 0 argument!");
1210 //bar = alloca typeof(foo)
1214 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1215 const Type* ArgTy = F->getFunctionType()->getReturnType();
1216 const Type* ArgTyPtr = PointerType::get(ArgTy);
1217 Function* NF = Result->getOrInsertFunction("llvm.va_start",
1218 RetTy, ArgTyPtr, (Type *)0);
1220 while (!F->use_empty()) {
1221 CallInst* CI = cast<CallInst>(F->use_back());
1222 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1223 new CallInst(NF, bar, "", CI);
1224 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1225 CI->replaceAllUsesWith(foo);
1226 CI->getParent()->getInstList().erase(CI);
1228 Result->getFunctionList().erase(F);
1231 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1232 if(F->arg_size() != 1) {
1233 GenerateError("Obsolete va_end takes 1 argument!");
1239 //bar = alloca 1 of typeof(foo)
1241 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1242 const Type* ArgTy = F->getFunctionType()->getParamType(0);
1243 const Type* ArgTyPtr = PointerType::get(ArgTy);
1244 Function* NF = Result->getOrInsertFunction("llvm.va_end",
1245 RetTy, ArgTyPtr, (Type *)0);
1247 while (!F->use_empty()) {
1248 CallInst* CI = cast<CallInst>(F->use_back());
1249 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1250 new StoreInst(CI->getOperand(1), bar, CI);
1251 new CallInst(NF, bar, "", CI);
1252 CI->getParent()->getInstList().erase(CI);
1254 Result->getFunctionList().erase(F);
1257 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1258 if(F->arg_size() != 1) {
1259 GenerateError("Obsolete va_copy takes 1 argument!");
1264 //a = alloca 1 of typeof(foo)
1265 //b = alloca 1 of typeof(foo)
1270 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1271 const Type* ArgTy = F->getFunctionType()->getReturnType();
1272 const Type* ArgTyPtr = PointerType::get(ArgTy);
1273 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
1274 RetTy, ArgTyPtr, ArgTyPtr,
1277 while (!F->use_empty()) {
1278 CallInst* CI = cast<CallInst>(F->use_back());
1279 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1280 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1281 new StoreInst(CI->getOperand(1), b, CI);
1282 new CallInst(NF, a, b, "", CI);
1283 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1284 CI->replaceAllUsesWith(foo);
1285 CI->getParent()->getInstList().erase(CI);
1287 Result->getFunctionList().erase(F);
1294 //===----------------------------------------------------------------------===//
1295 // RunVMAsmParser - Define an interface to this parser
1296 //===----------------------------------------------------------------------===//
1298 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1301 CurFilename = Filename;
1302 return RunParser(new Module(CurFilename));
1305 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1306 set_scan_string(AsmString);
1308 CurFilename = "from_memory";
1310 return RunParser(new Module (CurFilename));
1312 return RunParser(M);
1318 /* Enabling traces. */
1323 /* Enabling verbose error messages. */
1324 #ifdef YYERROR_VERBOSE
1325 # undef YYERROR_VERBOSE
1326 # define YYERROR_VERBOSE 1
1328 # define YYERROR_VERBOSE 0
1331 /* Enabling the token table. */
1332 #ifndef YYTOKEN_TABLE
1333 # define YYTOKEN_TABLE 0
1336 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1337 #line 968 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
1338 typedef union YYSTYPE {
1339 llvm::Module *ModuleVal;
1340 llvm::Function *FunctionVal;
1341 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1342 llvm::BasicBlock *BasicBlockVal;
1343 llvm::TerminatorInst *TermInstVal;
1344 llvm::Instruction *InstVal;
1345 llvm::Constant *ConstVal;
1347 const llvm::Type *PrimType;
1348 llvm::PATypeHolder *TypeVal;
1349 llvm::Value *ValueVal;
1351 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1352 std::vector<llvm::Value*> *ValueList;
1353 std::list<llvm::PATypeHolder> *TypeList;
1354 // Represent the RHS of PHI node
1355 std::list<std::pair<llvm::Value*,
1356 llvm::BasicBlock*> > *PHIList;
1357 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1358 std::vector<llvm::Constant*> *ConstVector;
1360 llvm::GlobalValue::LinkageTypes Linkage;
1368 char *StrVal; // This memory is strdup'd!
1369 llvm::ValID ValIDVal; // strdup'd memory maybe!
1371 llvm::Instruction::BinaryOps BinaryOpVal;
1372 llvm::Instruction::TermOps TermOpVal;
1373 llvm::Instruction::MemoryOps MemOpVal;
1374 llvm::Instruction::CastOps CastOpVal;
1375 llvm::Instruction::OtherOps OtherOpVal;
1376 llvm::Module::Endianness Endianness;
1377 llvm::ICmpInst::Predicate IPredicate;
1378 llvm::FCmpInst::Predicate FPredicate;
1380 /* Line 196 of yacc.c. */
1381 #line 1382 "llvmAsmParser.tab.c"
1382 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1383 # define YYSTYPE_IS_DECLARED 1
1384 # define YYSTYPE_IS_TRIVIAL 1
1389 /* Copy the second part of user declarations. */
1392 /* Line 219 of yacc.c. */
1393 #line 1394 "llvmAsmParser.tab.c"
1395 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1396 # define YYSIZE_T __SIZE_TYPE__
1398 #if ! defined (YYSIZE_T) && defined (size_t)
1399 # define YYSIZE_T size_t
1401 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1402 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1403 # define YYSIZE_T size_t
1405 #if ! defined (YYSIZE_T)
1406 # define YYSIZE_T unsigned int
1412 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1413 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1417 # define YY_(msgid) msgid
1421 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1423 /* The parser invokes alloca or malloc; define the necessary symbols. */
1425 # ifdef YYSTACK_USE_ALLOCA
1426 # if YYSTACK_USE_ALLOCA
1428 # define YYSTACK_ALLOC __builtin_alloca
1430 # define YYSTACK_ALLOC alloca
1431 # if defined (__STDC__) || defined (__cplusplus)
1432 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1433 # define YYINCLUDED_STDLIB_H
1439 # ifdef YYSTACK_ALLOC
1440 /* Pacify GCC's `empty if-body' warning. */
1441 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1442 # ifndef YYSTACK_ALLOC_MAXIMUM
1443 /* The OS might guarantee only one guard page at the bottom of the stack,
1444 and a page size can be as small as 4096 bytes. So we cannot safely
1445 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1446 to allow for a few compiler-allocated temporary stack slots. */
1447 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1450 # define YYSTACK_ALLOC YYMALLOC
1451 # define YYSTACK_FREE YYFREE
1452 # ifndef YYSTACK_ALLOC_MAXIMUM
1453 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1459 # define YYMALLOC malloc
1460 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1461 && (defined (__STDC__) || defined (__cplusplus)))
1462 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1466 # define YYFREE free
1467 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1468 && (defined (__STDC__) || defined (__cplusplus)))
1469 void free (void *); /* INFRINGES ON USER NAME SPACE */
1476 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1479 #if (! defined (yyoverflow) \
1480 && (! defined (__cplusplus) \
1481 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1483 /* A type that is properly aligned for any stack member. */
1490 /* The size of the maximum gap between one aligned stack and the next. */
1491 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1493 /* The size of an array large to enough to hold all stacks, each with
1495 # define YYSTACK_BYTES(N) \
1496 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1497 + YYSTACK_GAP_MAXIMUM)
1499 /* Copy COUNT objects from FROM to TO. The source and destination do
1502 # if defined (__GNUC__) && 1 < __GNUC__
1503 # define YYCOPY(To, From, Count) \
1504 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1506 # define YYCOPY(To, From, Count) \
1510 for (yyi = 0; yyi < (Count); yyi++) \
1511 (To)[yyi] = (From)[yyi]; \
1517 /* Relocate STACK from its old location to the new one. The
1518 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1519 elements in the stack, and YYPTR gives the new location of the
1520 stack. Advance YYPTR to a properly aligned location for the next
1522 # define YYSTACK_RELOCATE(Stack) \
1525 YYSIZE_T yynewbytes; \
1526 YYCOPY (&yyptr->Stack, Stack, yysize); \
1527 Stack = &yyptr->Stack; \
1528 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1529 yyptr += yynewbytes / sizeof (*yyptr); \
1535 #if defined (__STDC__) || defined (__cplusplus)
1536 typedef signed char yysigned_char;
1538 typedef short int yysigned_char;
1541 /* YYFINAL -- State number of the termination state. */
1543 /* YYLAST -- Last index in YYTABLE. */
1546 /* YYNTOKENS -- Number of terminals. */
1547 #define YYNTOKENS 161
1548 /* YYNNTS -- Number of nonterminals. */
1550 /* YYNRULES -- Number of rules. */
1551 #define YYNRULES 299
1552 /* YYNRULES -- Number of states. */
1553 #define YYNSTATES 588
1555 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1556 #define YYUNDEFTOK 2
1557 #define YYMAXUTOK 401
1559 #define YYTRANSLATE(YYX) \
1560 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1562 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1563 static const unsigned char yytranslate[] =
1565 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1569 150, 151, 159, 2, 148, 2, 2, 2, 2, 2,
1570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1571 155, 147, 156, 2, 2, 2, 2, 2, 2, 2,
1572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1574 2, 152, 149, 154, 2, 2, 2, 2, 2, 160,
1575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1577 153, 2, 2, 157, 2, 158, 2, 2, 2, 2,
1578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1579 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1585 2, 2, 2, 2, 2, 2, 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, 1, 2, 3, 4,
1591 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1592 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1593 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1594 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1595 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1596 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1597 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1598 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1599 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1600 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1601 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1602 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1603 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1604 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1609 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1611 static const unsigned short int yyprhs[] =
1613 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1614 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1615 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1616 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1617 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1618 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1619 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1620 139, 141, 143, 145, 147, 149, 151, 153, 156, 157,
1621 159, 161, 163, 165, 167, 169, 171, 172, 173, 175,
1622 177, 179, 181, 183, 185, 188, 189, 192, 193, 197,
1623 200, 201, 203, 204, 208, 210, 213, 215, 217, 219,
1624 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1625 241, 243, 245, 247, 249, 251, 253, 255, 258, 263,
1626 269, 275, 279, 282, 285, 287, 291, 293, 297, 299,
1627 300, 305, 309, 313, 318, 323, 327, 330, 333, 336,
1628 339, 342, 345, 348, 351, 354, 357, 364, 370, 379,
1629 386, 393, 400, 409, 418, 425, 432, 441, 450, 454,
1630 456, 458, 460, 462, 465, 468, 473, 476, 478, 483,
1631 486, 491, 492, 500, 501, 509, 510, 518, 519, 527,
1632 531, 536, 537, 539, 541, 543, 547, 551, 555, 559,
1633 563, 567, 569, 570, 572, 574, 576, 577, 580, 584,
1634 586, 588, 592, 594, 595, 604, 606, 608, 612, 614,
1635 616, 619, 620, 622, 624, 625, 630, 631, 633, 635,
1636 637, 639, 641, 643, 645, 647, 649, 653, 655, 661,
1637 663, 665, 667, 669, 672, 675, 678, 682, 685, 686,
1638 688, 691, 694, 698, 708, 718, 727, 741, 743, 745,
1639 752, 758, 761, 768, 776, 778, 782, 784, 785, 788,
1640 790, 796, 802, 808, 815, 822, 825, 830, 835, 842,
1641 847, 852, 857, 862, 869, 876, 879, 887, 889, 892,
1642 893, 895, 896, 900, 907, 911, 918, 921, 926, 933
1645 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1646 static const short int yyrhs[] =
1648 195, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1649 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1650 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1651 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1652 -1, 93, -1, 94, -1, 95, -1, 124, -1, 125,
1653 -1, 126, -1, 127, -1, 128, -1, 129, -1, 130,
1654 -1, 131, -1, 132, -1, 133, -1, 134, -1, 135,
1655 -1, 138, -1, 139, -1, 140, -1, 98, -1, 99,
1656 -1, 100, -1, 101, -1, 102, -1, 103, -1, 104,
1657 -1, 105, -1, 106, -1, 107, -1, 108, -1, 109,
1658 -1, 110, -1, 111, -1, 112, -1, 113, -1, 114,
1659 -1, 115, -1, 116, -1, 117, -1, 104, -1, 105,
1660 -1, 106, -1, 107, -1, 27, -1, 28, -1, 16,
1661 -1, 14, -1, 12, -1, 10, -1, 17, -1, 15,
1662 -1, 13, -1, 11, -1, 171, -1, 172, -1, 18,
1663 -1, 19, -1, 207, 147, -1, -1, 41, -1, 42,
1664 -1, 43, -1, 44, -1, 45, -1, 46, -1, 47,
1665 -1, -1, -1, 65, -1, 66, -1, 67, -1, 68,
1666 -1, 69, -1, 70, -1, 64, 4, -1, -1, 57,
1667 4, -1, -1, 148, 57, 4, -1, 34, 24, -1,
1668 -1, 180, -1, -1, 148, 183, 182, -1, 180, -1,
1669 57, 4, -1, 186, -1, 8, -1, 188, -1, 8,
1670 -1, 188, -1, 9, -1, 10, -1, 11, -1, 12,
1671 -1, 13, -1, 14, -1, 15, -1, 16, -1, 17,
1672 -1, 18, -1, 19, -1, 20, -1, 21, -1, 48,
1673 -1, 187, -1, 222, -1, 149, 4, -1, 185, 150,
1674 190, 151, -1, 152, 4, 153, 188, 154, -1, 155,
1675 4, 153, 188, 156, -1, 157, 189, 158, -1, 157,
1676 158, -1, 188, 159, -1, 188, -1, 189, 148, 188,
1677 -1, 189, -1, 189, 148, 37, -1, 37, -1, -1,
1678 186, 152, 193, 154, -1, 186, 152, 154, -1, 186,
1679 160, 24, -1, 186, 155, 193, 156, -1, 186, 157,
1680 193, 158, -1, 186, 157, 158, -1, 186, 38, -1,
1681 186, 39, -1, 186, 222, -1, 186, 192, -1, 186,
1682 26, -1, 171, 163, -1, 172, 4, -1, 9, 27,
1683 -1, 9, 28, -1, 174, 7, -1, 167, 150, 191,
1684 36, 186, 151, -1, 123, 150, 191, 236, 151, -1,
1685 137, 150, 191, 148, 191, 148, 191, 151, -1, 164,
1686 150, 191, 148, 191, 151, -1, 165, 150, 191, 148,
1687 191, 151, -1, 166, 150, 191, 148, 191, 151, -1,
1688 96, 150, 169, 148, 191, 148, 191, 151, -1, 97,
1689 150, 170, 148, 191, 148, 191, 151, -1, 168, 150,
1690 191, 148, 191, 151, -1, 142, 150, 191, 148, 191,
1691 151, -1, 143, 150, 191, 148, 191, 148, 191, 151,
1692 -1, 144, 150, 191, 148, 191, 148, 191, 151, -1,
1693 193, 148, 191, -1, 191, -1, 32, -1, 33, -1,
1694 196, -1, 196, 216, -1, 196, 218, -1, 196, 62,
1695 61, 202, -1, 196, 25, -1, 197, -1, 197, 175,
1696 20, 184, -1, 197, 218, -1, 197, 62, 61, 202,
1697 -1, -1, 197, 175, 176, 194, 191, 198, 182, -1,
1698 -1, 197, 175, 50, 194, 186, 199, 182, -1, -1,
1699 197, 175, 45, 194, 186, 200, 182, -1, -1, 197,
1700 175, 47, 194, 186, 201, 182, -1, 197, 51, 204,
1701 -1, 197, 58, 147, 205, -1, -1, 24, -1, 56,
1702 -1, 55, -1, 53, 147, 203, -1, 54, 147, 4,
1703 -1, 52, 147, 24, -1, 71, 147, 24, -1, 152,
1704 206, 154, -1, 206, 148, 24, -1, 24, -1, -1,
1705 22, -1, 24, -1, 207, -1, -1, 186, 208, -1,
1706 210, 148, 209, -1, 209, -1, 210, -1, 210, 148,
1707 37, -1, 37, -1, -1, 177, 184, 207, 150, 211,
1708 151, 181, 178, -1, 29, -1, 157, -1, 176, 212,
1709 213, -1, 30, -1, 158, -1, 225, 215, -1, -1,
1710 45, -1, 47, -1, -1, 31, 219, 217, 212, -1,
1711 -1, 63, -1, 3, -1, 4, -1, 7, -1, 27,
1712 -1, 28, -1, 38, -1, 39, -1, 26, -1, 155,
1713 193, 156, -1, 192, -1, 61, 220, 24, 148, 24,
1714 -1, 162, -1, 207, -1, 222, -1, 221, -1, 186,
1715 223, -1, 225, 226, -1, 214, 226, -1, 227, 175,
1716 228, -1, 227, 230, -1, -1, 23, -1, 72, 224,
1717 -1, 72, 8, -1, 73, 21, 223, -1, 73, 9,
1718 223, 148, 21, 223, 148, 21, 223, -1, 74, 173,
1719 223, 148, 21, 223, 152, 229, 154, -1, 74, 173,
1720 223, 148, 21, 223, 152, 154, -1, 75, 177, 184,
1721 223, 150, 233, 151, 36, 21, 223, 76, 21, 223,
1722 -1, 76, -1, 77, -1, 229, 173, 221, 148, 21,
1723 223, -1, 173, 221, 148, 21, 223, -1, 175, 235,
1724 -1, 186, 152, 223, 148, 223, 154, -1, 231, 148,
1725 152, 223, 148, 223, 154, -1, 224, -1, 232, 148,
1726 224, -1, 232, -1, -1, 60, 59, -1, 59, -1,
1727 164, 186, 223, 148, 223, -1, 165, 186, 223, 148,
1728 223, -1, 166, 186, 223, 148, 223, -1, 96, 169,
1729 186, 223, 148, 223, -1, 97, 170, 186, 223, 148,
1730 223, -1, 49, 224, -1, 168, 224, 148, 224, -1,
1731 167, 224, 36, 186, -1, 137, 224, 148, 224, 148,
1732 224, -1, 141, 224, 148, 186, -1, 145, 224, 148,
1733 186, -1, 146, 224, 148, 186, -1, 142, 224, 148,
1734 224, -1, 143, 224, 148, 224, 148, 224, -1, 144,
1735 224, 148, 224, 148, 224, -1, 136, 231, -1, 234,
1736 177, 184, 223, 150, 233, 151, -1, 238, -1, 148,
1737 232, -1, -1, 35, -1, -1, 118, 186, 179, -1,
1738 118, 186, 148, 15, 223, 179, -1, 119, 186, 179,
1739 -1, 119, 186, 148, 15, 223, 179, -1, 120, 224,
1740 -1, 237, 121, 186, 223, -1, 237, 122, 224, 148,
1741 186, 223, -1, 123, 186, 223, 236, -1
1744 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1745 static const unsigned short int yyrline[] =
1747 0, 1104, 1104, 1105, 1113, 1114, 1124, 1124, 1124, 1124,
1748 1124, 1124, 1124, 1124, 1124, 1125, 1125, 1125, 1126, 1126,
1749 1126, 1126, 1126, 1126, 1127, 1127, 1127, 1127, 1127, 1127,
1750 1128, 1128, 1128, 1128, 1128, 1128, 1129, 1129, 1129, 1131,
1751 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1135, 1135, 1139,
1752 1139, 1140, 1140, 1141, 1141, 1142, 1142, 1143, 1143, 1144,
1753 1144, 1145, 1145, 1146, 1147, 1152, 1152, 1152, 1152, 1153,
1754 1153, 1153, 1153, 1154, 1154, 1155, 1155, 1158, 1162, 1167,
1755 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1176, 1177, 1178,
1756 1179, 1180, 1181, 1182, 1183, 1192, 1193, 1199, 1200, 1208,
1757 1216, 1217, 1222, 1223, 1224, 1229, 1243, 1243, 1244, 1244,
1758 1246, 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1257, 1257,
1759 1257, 1257, 1257, 1257, 1258, 1262, 1266, 1274, 1282, 1295,
1760 1300, 1312, 1322, 1326, 1337, 1342, 1348, 1349, 1353, 1357,
1761 1368, 1394, 1408, 1438, 1464, 1485, 1498, 1508, 1513, 1574,
1762 1581, 1589, 1595, 1601, 1605, 1609, 1617, 1629, 1661, 1669,
1763 1693, 1704, 1710, 1715, 1720, 1729, 1735, 1741, 1750, 1754,
1764 1762, 1762, 1772, 1780, 1785, 1789, 1793, 1797, 1812, 1834,
1765 1837, 1840, 1840, 1848, 1848, 1856, 1856, 1864, 1864, 1873,
1766 1876, 1879, 1883, 1896, 1897, 1899, 1903, 1912, 1916, 1921,
1767 1923, 1928, 1933, 1942, 1942, 1943, 1943, 1945, 1952, 1958,
1768 1965, 1969, 1975, 1980, 1985, 2080, 2080, 2082, 2090, 2090,
1769 2092, 2097, 2098, 2099, 2101, 2101, 2111, 2115, 2120, 2124,
1770 2128, 2132, 2136, 2140, 2144, 2148, 2152, 2177, 2181, 2195,
1771 2199, 2205, 2205, 2211, 2216, 2220, 2229, 2240, 2249, 2261,
1772 2274, 2278, 2282, 2287, 2296, 2315, 2324, 2380, 2384, 2391,
1773 2402, 2415, 2424, 2433, 2443, 2447, 2454, 2454, 2456, 2460,
1774 2465, 2484, 2499, 2513, 2524, 2535, 2548, 2557, 2568, 2576,
1775 2582, 2602, 2625, 2631, 2637, 2643, 2658, 2717, 2724, 2727,
1776 2732, 2736, 2743, 2748, 2754, 2759, 2765, 2773, 2785, 2800
1780 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1781 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1782 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1783 static const char *const yytname[] =
1785 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1786 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1787 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1788 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1789 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1790 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1791 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1792 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1793 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1794 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1795 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1796 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1797 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1798 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1799 "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP",
1800 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1801 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1802 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1803 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1804 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1805 "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1806 "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='",
1807 "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
1808 "'}'", "'*'", "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps",
1809 "LogicalOps", "SetCondOps", "CastOps", "ShiftOps", "IPredicates",
1810 "FPredicates", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1811 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString",
1812 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV",
1813 "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
1814 "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1815 "Module", "FunctionList", "ConstPool", "@1", "@2", "@3", "@4",
1816 "AsmBlock", "BigOrLittle", "TargetDefinition", "LibrariesDefinition",
1817 "LibList", "Name", "OptName", "ArgVal", "ArgListH", "ArgList",
1818 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1819 "FnDeclareLinkage", "FunctionProto", "@5", "OptSideEffect",
1820 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1821 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1822 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE",
1823 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0
1828 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1830 static const unsigned short int yytoknum[] =
1832 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1833 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1834 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1835 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1836 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1837 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1838 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1839 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1840 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1841 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1842 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1843 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1844 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1845 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1846 395, 396, 397, 398, 399, 400, 401, 61, 44, 92,
1847 40, 41, 91, 120, 93, 60, 62, 123, 125, 42,
1852 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1853 static const unsigned char yyr1[] =
1855 0, 161, 162, 162, 163, 163, 164, 164, 164, 164,
1856 164, 164, 164, 164, 164, 165, 165, 165, 166, 166,
1857 166, 166, 166, 166, 167, 167, 167, 167, 167, 167,
1858 167, 167, 167, 167, 167, 167, 168, 168, 168, 169,
1859 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1860 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1861 170, 170, 170, 170, 170, 171, 171, 171, 171, 172,
1862 172, 172, 172, 173, 173, 174, 174, 175, 175, 176,
1863 176, 176, 176, 176, 176, 176, 176, 177, 177, 177,
1864 177, 177, 177, 177, 177, 178, 178, 179, 179, 180,
1865 181, 181, 182, 182, 183, 183, 184, 184, 185, 185,
1866 186, 187, 187, 187, 187, 187, 187, 187, 187, 187,
1867 187, 187, 187, 187, 188, 188, 188, 188, 188, 188,
1868 188, 188, 188, 188, 189, 189, 190, 190, 190, 190,
1869 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
1870 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1871 192, 192, 192, 192, 192, 192, 192, 192, 193, 193,
1872 194, 194, 195, 196, 196, 196, 196, 196, 197, 197,
1873 197, 198, 197, 199, 197, 200, 197, 201, 197, 197,
1874 197, 197, 202, 203, 203, 204, 204, 204, 204, 205,
1875 206, 206, 206, 207, 207, 208, 208, 209, 210, 210,
1876 211, 211, 211, 211, 212, 213, 213, 214, 215, 215,
1877 216, 217, 217, 217, 219, 218, 220, 220, 221, 221,
1878 221, 221, 221, 221, 221, 221, 221, 221, 221, 222,
1879 222, 223, 223, 224, 225, 225, 226, 227, 227, 227,
1880 228, 228, 228, 228, 228, 228, 228, 228, 228, 229,
1881 229, 230, 231, 231, 232, 232, 233, 233, 234, 234,
1882 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
1883 235, 235, 235, 235, 235, 235, 235, 235, 236, 236,
1884 237, 237, 238, 238, 238, 238, 238, 238, 238, 238
1887 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1888 static const unsigned char yyr2[] =
1890 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1891 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1892 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1893 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1894 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1895 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1896 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1897 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
1898 1, 1, 1, 1, 1, 1, 0, 0, 1, 1,
1899 1, 1, 1, 1, 2, 0, 2, 0, 3, 2,
1900 0, 1, 0, 3, 1, 2, 1, 1, 1, 1,
1901 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1902 1, 1, 1, 1, 1, 1, 1, 2, 4, 5,
1903 5, 3, 2, 2, 1, 3, 1, 3, 1, 0,
1904 4, 3, 3, 4, 4, 3, 2, 2, 2, 2,
1905 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1906 6, 6, 8, 8, 6, 6, 8, 8, 3, 1,
1907 1, 1, 1, 2, 2, 4, 2, 1, 4, 2,
1908 4, 0, 7, 0, 7, 0, 7, 0, 7, 3,
1909 4, 0, 1, 1, 1, 3, 3, 3, 3, 3,
1910 3, 1, 0, 1, 1, 1, 0, 2, 3, 1,
1911 1, 3, 1, 0, 8, 1, 1, 3, 1, 1,
1912 2, 0, 1, 1, 0, 4, 0, 1, 1, 1,
1913 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
1914 1, 1, 1, 2, 2, 2, 3, 2, 0, 1,
1915 2, 2, 3, 9, 9, 8, 13, 1, 1, 6,
1916 5, 2, 6, 7, 1, 3, 1, 0, 2, 1,
1917 5, 5, 5, 6, 6, 2, 4, 4, 6, 4,
1918 4, 4, 4, 6, 6, 2, 7, 1, 2, 0,
1919 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
1922 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1923 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1924 means the default is an error. */
1925 static const unsigned short int yydefact[] =
1927 191, 0, 86, 177, 1, 176, 224, 79, 80, 81,
1928 82, 83, 84, 85, 0, 87, 248, 173, 174, 248,
1929 203, 204, 0, 0, 0, 86, 0, 179, 221, 0,
1930 0, 88, 89, 90, 91, 92, 93, 0, 0, 249,
1931 245, 78, 218, 219, 220, 244, 0, 0, 0, 0,
1932 189, 0, 0, 0, 0, 0, 0, 0, 77, 222,
1933 223, 87, 192, 175, 94, 2, 3, 107, 111, 112,
1934 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
1935 123, 124, 0, 0, 0, 0, 239, 0, 0, 106,
1936 125, 110, 240, 126, 215, 216, 217, 291, 247, 0,
1937 0, 0, 0, 202, 190, 180, 178, 170, 171, 0,
1938 0, 0, 0, 225, 127, 0, 0, 109, 132, 134,
1939 0, 0, 139, 133, 290, 0, 269, 0, 0, 0,
1940 0, 87, 257, 258, 6, 7, 8, 9, 10, 11,
1941 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1942 22, 23, 0, 0, 0, 0, 0, 0, 24, 25,
1943 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1944 0, 0, 36, 37, 38, 0, 0, 0, 0, 0,
1945 0, 0, 0, 0, 0, 0, 246, 87, 261, 0,
1946 287, 197, 194, 193, 195, 196, 198, 201, 0, 185,
1947 187, 183, 111, 112, 113, 114, 115, 116, 117, 118,
1948 119, 120, 121, 0, 0, 0, 0, 181, 0, 0,
1949 0, 131, 213, 138, 136, 0, 0, 275, 268, 251,
1950 250, 0, 0, 68, 72, 67, 71, 66, 70, 65,
1951 69, 73, 74, 0, 0, 39, 40, 41, 42, 43,
1952 44, 45, 46, 47, 48, 0, 63, 64, 59, 60,
1953 61, 62, 49, 50, 51, 52, 53, 54, 55, 56,
1954 57, 58, 0, 97, 97, 296, 0, 0, 285, 0,
1955 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1956 0, 0, 0, 0, 0, 199, 102, 102, 102, 153,
1957 154, 4, 5, 151, 152, 155, 150, 146, 147, 0,
1958 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1959 0, 0, 0, 0, 0, 149, 148, 102, 108, 108,
1960 135, 212, 206, 209, 210, 0, 0, 128, 228, 229,
1961 230, 235, 231, 232, 233, 234, 226, 0, 237, 242,
1962 241, 243, 0, 252, 0, 0, 0, 0, 0, 292,
1963 0, 294, 289, 0, 0, 0, 0, 0, 0, 0,
1964 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1965 200, 0, 186, 188, 184, 0, 0, 0, 0, 0,
1966 0, 0, 141, 169, 0, 0, 145, 0, 142, 0,
1967 0, 0, 0, 0, 182, 129, 130, 205, 207, 0,
1968 100, 137, 227, 0, 0, 0, 0, 0, 0, 0,
1969 0, 0, 0, 0, 299, 0, 0, 0, 279, 282,
1970 0, 0, 280, 281, 0, 0, 0, 277, 276, 0,
1971 297, 0, 0, 0, 104, 102, 0, 0, 289, 0,
1972 0, 0, 0, 0, 140, 143, 144, 0, 0, 0,
1973 0, 0, 211, 208, 101, 95, 0, 236, 0, 0,
1974 267, 0, 0, 97, 98, 97, 264, 288, 0, 0,
1975 0, 0, 0, 270, 271, 272, 267, 0, 99, 105,
1976 103, 0, 0, 0, 0, 0, 0, 0, 168, 0,
1977 0, 0, 0, 0, 0, 214, 0, 0, 0, 266,
1978 0, 273, 274, 0, 293, 295, 0, 0, 0, 278,
1979 283, 284, 0, 298, 0, 0, 157, 0, 0, 0,
1980 0, 0, 0, 0, 0, 0, 96, 238, 0, 0,
1981 0, 265, 262, 0, 286, 0, 0, 0, 165, 0,
1982 0, 159, 160, 161, 156, 164, 0, 255, 0, 0,
1983 0, 263, 0, 0, 0, 0, 0, 253, 0, 254,
1984 0, 0, 162, 163, 158, 166, 167, 0, 0, 0,
1985 0, 0, 0, 260, 0, 0, 259, 256
1988 /* YYDEFGOTO[NTERM-NUM]. */
1989 static const short int yydefgoto[] =
1991 -1, 86, 303, 320, 321, 322, 323, 324, 255, 272,
1992 213, 214, 243, 215, 25, 15, 37, 505, 359, 444,
1993 465, 382, 445, 87, 88, 216, 90, 91, 120, 225,
1994 393, 348, 394, 109, 1, 2, 3, 327, 298, 296,
1995 297, 63, 194, 50, 104, 198, 92, 408, 333, 334,
1996 335, 38, 96, 16, 44, 17, 61, 18, 28, 413,
1997 349, 93, 351, 476, 19, 40, 41, 186, 559, 98,
1998 278, 509, 510, 187, 188, 424, 189, 190
2001 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2003 #define YYPACT_NINF -542
2004 static const short int yypact[] =
2006 -542, 24, 136, 567, -542, -542, -542, -542, -542, -542,
2007 -542, -542, -542, -542, -5, 144, 56, -542, -542, -9,
2008 -542, -542, 61, -53, 51, 426, -16, -542, 42, 139,
2009 167, -542, -542, -542, -542, -542, -542, 1195, -20, -542,
2010 -542, 162, -542, -542, -542, -542, 19, 28, 50, 57,
2011 -542, 54, 139, 1195, 124, 124, 124, 124, -542, -542,
2012 -542, 144, -542, -542, -542, -542, -542, 66, -542, -542,
2013 -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,
2014 -542, -542, 220, 221, 222, 87, -542, 162, 77, -542,
2015 -542, -81, -542, -542, -542, -542, -542, 425, -542, 204,
2016 132, 228, 209, 223, -542, -542, -542, -542, -542, 1215,
2017 1215, 1215, 1256, -542, -542, 81, 90, -542, -542, -81,
2018 -133, 96, 1000, -542, -542, 1215, -542, 181, 1276, -2,
2019 377, 144, -542, -542, -542, -542, -542, -542, -542, -542,
2020 -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,
2021 -542, -542, 23, 210, 1215, 1215, 1215, 1215, -542, -542,
2022 -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,
2023 1215, 1215, -542, -542, -542, 1215, 1215, 1215, 1215, 1215,
2024 1215, 1215, 1215, 1215, 1215, 1215, -542, 144, -542, 69,
2025 -542, -542, -542, -542, -542, -542, -542, -542, -68, -542,
2026 -542, -542, 165, 192, 245, 196, 249, 198, 253, 216,
2027 254, 255, 258, 219, 256, 261, 568, -542, 1215, 1215,
2028 1215, -542, 1041, -542, 121, 110, 710, -542, -542, 66,
2029 -542, 710, 710, -542, -542, -542, -542, -542, -542, -542,
2030 -542, -542, -542, 710, 1195, -542, -542, -542, -542, -542,
2031 -542, -542, -542, -542, -542, 1215, -542, -542, -542, -542,
2032 -542, -542, -542, -542, -542, -542, -542, -542, -542, -542,
2033 -542, -542, 1215, 122, 126, -542, 710, 120, 127, 129,
2034 130, 131, 133, 135, 137, 140, 710, 710, 710, 244,
2035 141, 1195, 1215, 1215, 260, -542, 142, 142, 142, -542,
2036 -542, -542, -542, -542, -542, -542, -542, -542, -542, 148,
2037 149, 150, 151, 152, 154, 160, 945, 1256, 661, 263,
2038 161, 187, 190, 191, 193, -542, -542, 142, 5, 6,
2039 -81, -542, 162, -542, 164, 194, 1098, -542, -542, -542,
2040 -542, -542, -542, -542, -542, -542, 279, 1256, -542, -542,
2041 -542, -542, 201, -542, 202, 710, 710, 710, 7, -542,
2042 8, -542, 205, 710, 200, 1215, 1215, 1215, 1215, 1215,
2043 1215, 1215, 206, 207, 208, 1215, 1215, 710, 710, 212,
2044 -542, -29, -542, -542, -542, 23, 210, 1256, 1256, 1256,
2045 1256, 1256, -542, -542, -38, -72, -542, -105, -542, 1256,
2046 1256, 1256, 1256, 1256, -542, -542, -542, -542, -542, 1154,
2047 310, -542, -542, 333, -71, 337, 340, 217, 214, 225,
2048 710, 364, 710, 1215, -542, 226, 710, 229, -542, -542,
2049 230, 233, -542, -542, 710, 710, 710, -542, -542, 232,
2050 -542, 1215, 345, 366, -542, 142, 235, 236, 205, 237,
2051 247, 248, 264, 1256, -542, -542, -542, 265, 266, 270,
2052 335, 271, -542, -542, -542, 319, 272, -542, 710, 710,
2053 1215, 710, 710, 273, -542, 273, -542, 274, 710, 276,
2054 1215, 1215, 1215, -542, -542, -542, 1215, 710, -542, -542,
2055 -542, 1256, 1256, 257, 1256, 1256, 1256, 1256, -542, 1256,
2056 1256, 1256, 1215, 1256, 421, -542, 402, 280, 275, 274,
2057 278, -542, -542, 375, -542, -542, 1215, 281, 710, -542,
2058 -542, -542, 283, -542, 288, 291, -542, 292, 290, 294,
2059 299, 297, 303, 306, 307, 308, -542, -542, 429, 20,
2060 427, -542, -542, 312, -542, 1256, 1256, 1256, -542, 1256,
2061 1256, -542, -542, -542, -542, -542, 710, -542, 852, 35,
2062 440, -542, 311, 313, 324, 326, 327, -542, 339, -542,
2063 852, 710, -542, -542, -542, -542, -542, 460, 341, 407,
2064 710, 467, 469, -542, 710, 710, -542, -542
2067 /* YYPGOTO[NTERM-NUM]. */
2068 static const short int yypgoto[] =
2070 -542, -542, -542, 394, 395, 396, 428, 430, 138, 147,
2071 -129, -128, -484, -542, 483, 501, -121, -542, -270, 125,
2072 -542, -285, -542, -50, -542, -37, -542, -65, 408, -542,
2073 -94, 318, -277, 113, -542, -542, -542, -542, -542, -542,
2074 -542, 484, -542, -542, -542, -542, 3, -542, 128, -542,
2075 -542, 478, -542, -542, -542, -542, -542, 537, -542, -542,
2076 -541, 60, -205, -117, -542, 522, -542, -542, -542, -542,
2077 -542, 119, 86, -542, -542, 98, -542, -542
2080 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2081 positive, shift that token. If negative, reduce the rule which
2082 number is the opposite. If zero, do what YYDEFACT says.
2083 If YYTABLE_NINF, syntax error. */
2084 #define YYTABLE_NINF -173
2085 static const short int yytable[] =
2087 89, 241, 242, 106, 361, 442, 26, 231, 227, 94,
2088 244, 230, 383, 384, 39, 220, 89, 568, 217, 232,
2089 119, 42, 420, 422, 4, 221, 352, 353, 443, 578,
2090 233, 234, 235, 236, 237, 238, 239, 240, 354, 275,
2091 395, 397, 404, 453, 26, 233, 234, 235, 236, 237,
2092 238, 239, 240, 456, 279, 558, 29, 119, 280, 281,
2093 282, 283, 284, 285, 421, 421, 291, 289, 290, -108,
2094 414, 362, 199, 200, 201, 570, 453, 453, 123, 39,
2095 294, 372, 373, 374, 455, 467, 295, 59, 226, 60,
2096 121, 226, 65, 66, 51, 117, 68, 69, 70, 71,
2097 72, 73, 74, 75, 76, 77, 78, 79, 80, 20,
2098 453, 21, 52, 46, 47, 48, 454, 273, 274, 226,
2099 276, 245, 246, 247, 248, 249, 250, 251, 252, 253,
2100 254, 58, 49, 277, 226, 81, -172, 95, 226, 226,
2101 226, 226, 226, 226, 286, 287, 288, 226, 226, 43,
2102 417, 418, 419, 328, 329, 330, 107, 108, 425, 405,
2103 490, 5, 406, 62, 123, 123, 99, 6, 110, 111,
2104 112, 64, 439, 440, 557, 100, 379, 7, 8, 9,
2105 10, 11, 12, 13, 20, 332, 21, 192, 193, 569,
2106 292, 293, 299, 300, 355, -68, -68, 101, 14, -67,
2107 -67, -66, -66, 514, 102, 515, 103, 89, 30, 31,
2108 32, 33, 34, 35, 36, 473, -109, 475, 356, -65,
2109 -65, 479, 301, 302, 114, 115, 116, 122, 191, 483,
2110 484, 485, 195, 196, 218, 357, 82, 256, 257, 83,
2111 228, 377, 84, 219, 85, 118, 222, 197, 427, -72,
2112 429, 430, 431, -71, 89, 378, 226, -70, -69, 438,
2113 304, 337, -75, 507, 508, -76, 511, 512, 305, 336,
2114 358, 330, 363, 517, 360, 364, 326, 365, 366, 367,
2115 375, 368, 523, 369, 380, 370, 350, 398, 371, 376,
2116 381, 350, 350, 448, 449, 450, 451, 452, 385, 386,
2117 387, 388, 389, 350, 390, 457, 458, 459, 460, 461,
2118 391, 399, 409, 543, 258, 259, 260, 261, 262, 263,
2119 264, 265, 266, 267, 268, 269, 270, 271, 226, 428,
2120 226, 226, 226, 432, 433, 407, 350, 400, 437, 226,
2121 401, 402, 412, 403, 442, 410, 350, 350, 350, 415,
2122 416, 567, 426, 423, 434, 435, 436, 466, 468, 498,
2123 441, 469, 471, 519, 520, 521, 579, 470, 474, 488,
2124 489, 502, 332, 472, 478, 583, 504, 480, 481, 586,
2125 587, 482, 486, 491, 492, 494, 226, 233, 234, 235,
2126 236, 237, 238, 239, 240, 495, 496, 524, 525, 541,
2127 527, 528, 529, 530, 487, 531, 532, 533, 526, 535,
2128 241, 242, 497, 499, 500, 350, 350, 350, 501, 503,
2129 506, 513, 516, 350, 518, 536, 537, 539, 538, 540,
2130 241, 242, 421, 226, 544, 542, 545, 350, 350, 546,
2131 547, 548, 549, 226, 226, 226, 53, 550, 551, 226,
2132 556, 562, 563, 564, 552, 565, 566, 553, 554, 555,
2133 124, 571, 572, 560, 573, 534, 561, 7, 8, 9,
2134 10, 54, 12, 55, 125, 574, 56, 575, 576, 226,
2135 350, 580, 350, 582, 126, 127, 350, 577, 584, 581,
2136 585, 181, 182, 183, 350, 350, 350, 128, 129, 130,
2137 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
2138 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2139 151, 152, 153, 446, 97, 184, 57, 185, 350, 350,
2140 224, 350, 350, 447, 325, 464, 105, 463, 350, 113,
2141 27, 45, 477, 154, 155, 156, 493, 350, 157, 158,
2142 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
2143 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2144 179, 180, 522, 65, 66, 0, 0, 0, 350, 0,
2145 0, 0, 0, 0, 0, 0, 0, -78, 0, 20,
2146 20, 21, 21, 0, 306, 0, 0, 0, 6, -78,
2147 -78, 0, 0, 0, 0, 0, 307, 308, -78, -78,
2148 -78, -78, -78, -78, -78, 0, 350, -78, 22, 0,
2149 0, 0, 0, 0, 0, 23, 0, 0, 0, 24,
2150 0, 350, 0, 0, 0, 0, 0, 0, 0, 0,
2151 350, 0, 0, 0, 350, 350, 134, 135, 136, 137,
2152 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
2153 148, 149, 150, 151, 309, 310, 65, 66, 0, 117,
2154 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2155 212, 79, 80, 20, 0, 21, 0, 0, 0, 0,
2156 0, 311, 158, 159, 160, 161, 162, 163, 164, 165,
2157 166, 167, 168, 169, 0, 312, 172, 173, 174, 81,
2158 313, 314, 315, 338, 339, 65, 66, 340, 0, 0,
2159 316, 0, 0, 317, 0, 318, 0, 0, 319, 0,
2160 0, 0, 20, 0, 21, 0, 341, 342, 343, 0,
2161 0, 0, 0, 0, 0, 0, 0, 0, 344, 345,
2162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2164 0, 346, 0, 0, 0, 0, 0, 0, 0, 0,
2165 0, 0, 0, 0, 0, 0, 0, 0, 134, 135,
2166 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2167 146, 147, 148, 149, 150, 151, 309, 310, 0, 0,
2168 82, 0, 0, 83, 0, 0, 84, 0, 85, 396,
2169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2170 0, 0, 0, 311, 158, 159, 160, 161, 162, 163,
2171 164, 165, 166, 167, 168, 169, 0, 312, 172, 173,
2172 174, 0, 313, 314, 315, 338, 339, 0, 0, 340,
2173 0, 0, 0, 0, 0, 347, 0, 0, 0, 0,
2174 0, 0, 0, 0, 0, 0, 0, 0, 341, 342,
2175 343, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2176 344, 345, 0, 0, 0, 0, 0, 0, 0, 0,
2177 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2178 0, 0, 0, 346, 0, 0, 0, 0, 0, 0,
2179 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2180 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
2181 144, 145, 146, 147, 148, 149, 150, 151, 309, 310,
2182 65, 66, 0, 117, 202, 203, 204, 205, 206, 207,
2183 208, 209, 210, 211, 212, 79, 80, 20, 0, 21,
2184 0, 0, 0, 0, 0, 311, 158, 159, 160, 161,
2185 162, 163, 164, 165, 166, 167, 168, 169, 0, 312,
2186 172, 173, 174, 81, 313, 314, 315, 0, 0, 0,
2187 0, 0, 0, 0, 0, 65, 66, 347, 117, 68,
2188 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2189 79, 80, 20, 0, 21, 0, 0, 0, 0, 0,
2190 0, 0, 0, 0, 0, 0, 0, 223, 0, 0,
2191 0, 0, 0, 0, 0, 0, 65, 66, 81, 117,
2192 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2193 78, 79, 80, 20, 0, 21, 0, 0, 0, 0,
2194 0, 0, 0, 0, 0, 0, 0, 0, 331, 0,
2195 0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
2196 0, 0, 0, 0, 82, 0, 0, 83, 0, 392,
2197 84, 0, 85, 65, 66, 0, 117, 68, 69, 70,
2198 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2199 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
2200 0, 0, 0, 0, 0, 411, 0, 0, 0, 0,
2201 0, 0, 0, 0, 0, 0, 81, 0, 0, 82,
2202 0, 0, 83, 0, 0, 84, 0, 85, 0, 65,
2203 66, 0, 117, 68, 69, 70, 71, 72, 73, 74,
2204 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2205 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2206 82, 462, 0, 83, 0, 0, 84, 0, 85, 0,
2207 65, 66, 81, 67, 68, 69, 70, 71, 72, 73,
2208 74, 75, 76, 77, 78, 79, 80, 20, 0, 21,
2209 65, 66, 0, 117, 68, 69, 70, 71, 72, 73,
2210 74, 75, 76, 77, 78, 79, 80, 20, 0, 21,
2211 0, 0, 0, 81, 0, 0, 0, 82, 0, 0,
2212 83, 0, 0, 84, 0, 85, 0, 0, 0, 0,
2213 0, 65, 66, 81, 117, 202, 203, 204, 205, 206,
2214 207, 208, 209, 210, 211, 212, 79, 80, 20, 0,
2215 21, 65, 66, 0, 229, 68, 69, 70, 71, 72,
2216 73, 74, 75, 76, 77, 78, 79, 80, 20, 0,
2217 21, 0, 0, 82, 81, 0, 83, 0, 0, 84,
2218 0, 85, 0, 0, 0, 0, 0, 0, 0, 0,
2219 0, 0, 0, 0, 81, 0, 0, 0, 0, 0,
2220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2221 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
2222 84, 0, 85, 0, 0, 0, 0, 0, 0, 0,
2223 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
2224 84, 0, 85, 0, 0, 0, 0, 0, 0, 0,
2225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2227 0, 0, 0, 0, 0, 82, 0, 0, 83, 0,
2228 0, 84, 0, 85, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0, 0, 82, 0, 0, 83, 0,
2233 static const short int yycheck[] =
2235 37, 130, 130, 53, 274, 34, 3, 9, 125, 29,
2236 131, 128, 297, 298, 23, 148, 53, 558, 112, 21,
2237 85, 30, 15, 15, 0, 158, 231, 232, 57, 570,
2238 10, 11, 12, 13, 14, 15, 16, 17, 243, 156,
2239 317, 318, 327, 148, 41, 10, 11, 12, 13, 14,
2240 15, 16, 17, 158, 171, 539, 61, 122, 175, 176,
2241 177, 178, 179, 180, 57, 57, 187, 184, 185, 150,
2242 347, 276, 109, 110, 111, 559, 148, 148, 159, 23,
2243 148, 286, 287, 288, 156, 156, 154, 45, 125, 47,
2244 87, 128, 5, 6, 147, 8, 9, 10, 11, 12,
2245 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2246 148, 24, 61, 52, 53, 54, 154, 154, 155, 156,
2247 157, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2248 107, 147, 71, 170, 171, 48, 0, 157, 175, 176,
2249 177, 178, 179, 180, 181, 182, 183, 184, 185, 158,
2250 355, 356, 357, 218, 219, 220, 32, 33, 363, 154,
2251 445, 25, 156, 24, 159, 159, 147, 31, 55, 56,
2252 57, 4, 377, 378, 154, 147, 293, 41, 42, 43,
2253 44, 45, 46, 47, 22, 222, 24, 55, 56, 154,
2254 121, 122, 27, 28, 244, 3, 4, 147, 62, 3,
2255 4, 3, 4, 473, 147, 475, 152, 244, 64, 65,
2256 66, 67, 68, 69, 70, 420, 150, 422, 255, 3,
2257 4, 426, 3, 4, 4, 4, 4, 150, 24, 434,
2258 435, 436, 4, 24, 153, 272, 149, 27, 28, 152,
2259 59, 291, 155, 153, 157, 158, 150, 24, 365, 4,
2260 367, 368, 369, 4, 291, 292, 293, 4, 4, 376,
2261 4, 151, 7, 468, 469, 7, 471, 472, 7, 148,
2262 148, 336, 152, 478, 148, 148, 216, 148, 148, 148,
2263 36, 148, 487, 148, 24, 148, 226, 24, 148, 148,
2264 148, 231, 232, 387, 388, 389, 390, 391, 150, 150,
2265 150, 150, 150, 243, 150, 399, 400, 401, 402, 403,
2266 150, 150, 148, 518, 104, 105, 106, 107, 108, 109,
2267 110, 111, 112, 113, 114, 115, 116, 117, 365, 366,
2268 367, 368, 369, 370, 371, 332, 276, 150, 375, 376,
2269 150, 150, 63, 150, 34, 151, 286, 287, 288, 148,
2270 148, 556, 152, 148, 148, 148, 148, 24, 21, 453,
2271 148, 21, 148, 480, 481, 482, 571, 150, 4, 24,
2272 4, 36, 409, 148, 148, 580, 57, 148, 148, 584,
2273 585, 148, 150, 148, 148, 148, 423, 10, 11, 12,
2274 13, 14, 15, 16, 17, 148, 148, 491, 492, 516,
2275 494, 495, 496, 497, 441, 499, 500, 501, 151, 503,
2276 539, 539, 148, 148, 148, 355, 356, 357, 148, 148,
2277 148, 148, 148, 363, 148, 4, 24, 152, 148, 151,
2278 559, 559, 57, 470, 151, 154, 148, 377, 378, 148,
2279 148, 151, 148, 480, 481, 482, 20, 148, 151, 486,
2280 21, 545, 546, 547, 151, 549, 550, 151, 151, 151,
2281 35, 21, 151, 36, 151, 502, 154, 41, 42, 43,
2282 44, 45, 46, 47, 49, 151, 50, 151, 151, 516,
2283 420, 21, 422, 76, 59, 60, 426, 148, 21, 148,
2284 21, 97, 97, 97, 434, 435, 436, 72, 73, 74,
2285 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2286 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2287 95, 96, 97, 385, 41, 97, 25, 97, 468, 469,
2288 122, 471, 472, 386, 216, 410, 52, 409, 478, 61,
2289 3, 19, 423, 118, 119, 120, 448, 487, 123, 124,
2290 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
2291 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
2292 145, 146, 486, 5, 6, -1, -1, -1, 518, -1,
2293 -1, -1, -1, -1, -1, -1, -1, 20, -1, 22,
2294 22, 24, 24, -1, 26, -1, -1, -1, 31, 32,
2295 33, -1, -1, -1, -1, -1, 38, 39, 41, 42,
2296 43, 44, 45, 46, 47, -1, 556, 50, 51, -1,
2297 -1, -1, -1, -1, -1, 58, -1, -1, -1, 62,
2298 -1, 571, -1, -1, -1, -1, -1, -1, -1, -1,
2299 580, -1, -1, -1, 584, 585, 78, 79, 80, 81,
2300 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2301 92, 93, 94, 95, 96, 97, 5, 6, -1, 8,
2302 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2303 19, 20, 21, 22, -1, 24, -1, -1, -1, -1,
2304 -1, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2305 132, 133, 134, 135, -1, 137, 138, 139, 140, 48,
2306 142, 143, 144, 3, 4, 5, 6, 7, -1, -1,
2307 152, -1, -1, 155, -1, 157, -1, -1, 160, -1,
2308 -1, -1, 22, -1, 24, -1, 26, 27, 28, -1,
2309 -1, -1, -1, -1, -1, -1, -1, -1, 38, 39,
2310 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2311 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2312 -1, 61, -1, -1, -1, -1, -1, -1, -1, -1,
2313 -1, -1, -1, -1, -1, -1, -1, -1, 78, 79,
2314 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2315 90, 91, 92, 93, 94, 95, 96, 97, -1, -1,
2316 149, -1, -1, 152, -1, -1, 155, -1, 157, 158,
2317 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2318 -1, -1, -1, 123, 124, 125, 126, 127, 128, 129,
2319 130, 131, 132, 133, 134, 135, -1, 137, 138, 139,
2320 140, -1, 142, 143, 144, 3, 4, -1, -1, 7,
2321 -1, -1, -1, -1, -1, 155, -1, -1, -1, -1,
2322 -1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
2323 28, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2324 38, 39, -1, -1, -1, -1, -1, -1, -1, -1,
2325 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2326 -1, -1, -1, 61, -1, -1, -1, -1, -1, -1,
2327 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2328 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2329 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
2330 5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
2331 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2332 -1, -1, -1, -1, -1, 123, 124, 125, 126, 127,
2333 128, 129, 130, 131, 132, 133, 134, 135, -1, 137,
2334 138, 139, 140, 48, 142, 143, 144, -1, -1, -1,
2335 -1, -1, -1, -1, -1, 5, 6, 155, 8, 9,
2336 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2337 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
2338 -1, -1, -1, -1, -1, -1, -1, 37, -1, -1,
2339 -1, -1, -1, -1, -1, -1, 5, 6, 48, 8,
2340 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2341 19, 20, 21, 22, -1, 24, -1, -1, -1, -1,
2342 -1, -1, -1, -1, -1, -1, -1, -1, 37, -1,
2343 -1, -1, -1, -1, -1, -1, -1, -1, -1, 48,
2344 -1, -1, -1, -1, 149, -1, -1, 152, -1, 154,
2345 155, -1, 157, 5, 6, -1, 8, 9, 10, 11,
2346 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2347 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
2348 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
2349 -1, -1, -1, -1, -1, -1, 48, -1, -1, 149,
2350 -1, -1, 152, -1, -1, 155, -1, 157, -1, 5,
2351 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2352 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2353 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2354 149, 37, -1, 152, -1, -1, 155, -1, 157, -1,
2355 5, 6, 48, 8, 9, 10, 11, 12, 13, 14,
2356 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2357 5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
2358 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2359 -1, -1, -1, 48, -1, -1, -1, 149, -1, -1,
2360 152, -1, -1, 155, -1, 157, -1, -1, -1, -1,
2361 -1, 5, 6, 48, 8, 9, 10, 11, 12, 13,
2362 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2363 24, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2364 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2365 24, -1, -1, 149, 48, -1, 152, -1, -1, 155,
2366 -1, 157, -1, -1, -1, -1, -1, -1, -1, -1,
2367 -1, -1, -1, -1, 48, -1, -1, -1, -1, -1,
2368 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2369 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
2370 155, -1, 157, -1, -1, -1, -1, -1, -1, -1,
2371 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
2372 155, -1, 157, -1, -1, -1, -1, -1, -1, -1,
2373 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2374 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2375 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
2376 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
2377 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
2381 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2382 symbol of state STATE-NUM. */
2383 static const unsigned char yystos[] =
2385 0, 195, 196, 197, 0, 25, 31, 41, 42, 43,
2386 44, 45, 46, 47, 62, 176, 214, 216, 218, 225,
2387 22, 24, 51, 58, 62, 175, 207, 218, 219, 61,
2388 64, 65, 66, 67, 68, 69, 70, 177, 212, 23,
2389 226, 227, 30, 158, 215, 226, 52, 53, 54, 71,
2390 204, 147, 61, 20, 45, 47, 50, 176, 147, 45,
2391 47, 217, 24, 202, 4, 5, 6, 8, 9, 10,
2392 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2393 21, 48, 149, 152, 155, 157, 162, 184, 185, 186,
2394 187, 188, 207, 222, 29, 157, 213, 175, 230, 147,
2395 147, 147, 147, 152, 205, 202, 184, 32, 33, 194,
2396 194, 194, 194, 212, 4, 4, 4, 8, 158, 188,
2397 189, 207, 150, 159, 35, 49, 59, 60, 72, 73,
2398 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2399 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2400 94, 95, 96, 97, 118, 119, 120, 123, 124, 125,
2401 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2402 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2403 146, 164, 165, 166, 167, 168, 228, 234, 235, 237,
2404 238, 24, 55, 56, 203, 4, 24, 24, 206, 186,
2405 186, 186, 9, 10, 11, 12, 13, 14, 15, 16,
2406 17, 18, 19, 171, 172, 174, 186, 191, 153, 153,
2407 148, 158, 150, 37, 189, 190, 186, 224, 59, 8,
2408 224, 9, 21, 10, 11, 12, 13, 14, 15, 16,
2409 17, 171, 172, 173, 177, 98, 99, 100, 101, 102,
2410 103, 104, 105, 106, 107, 169, 27, 28, 104, 105,
2411 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2412 116, 117, 170, 186, 186, 224, 186, 186, 231, 224,
2413 224, 224, 224, 224, 224, 224, 186, 186, 186, 224,
2414 224, 177, 121, 122, 148, 154, 200, 201, 199, 27,
2415 28, 3, 4, 163, 4, 7, 26, 38, 39, 96,
2416 97, 123, 137, 142, 143, 144, 152, 155, 157, 160,
2417 164, 165, 166, 167, 168, 192, 222, 198, 188, 188,
2418 188, 37, 186, 209, 210, 211, 148, 151, 3, 4,
2419 7, 26, 27, 28, 38, 39, 61, 155, 192, 221,
2420 222, 223, 223, 223, 223, 184, 186, 186, 148, 179,
2421 148, 179, 223, 152, 148, 148, 148, 148, 148, 148,
2422 148, 148, 223, 223, 223, 36, 148, 184, 186, 224,
2423 24, 148, 182, 182, 182, 150, 150, 150, 150, 150,
2424 150, 150, 154, 191, 193, 193, 158, 193, 24, 150,
2425 150, 150, 150, 150, 182, 154, 156, 207, 208, 148,
2426 151, 37, 63, 220, 193, 148, 148, 223, 223, 223,
2427 15, 57, 15, 148, 236, 223, 152, 224, 186, 224,
2428 224, 224, 186, 186, 148, 148, 148, 186, 224, 223,
2429 223, 148, 34, 57, 180, 183, 169, 170, 191, 191,
2430 191, 191, 191, 148, 154, 156, 158, 191, 191, 191,
2431 191, 191, 37, 209, 180, 181, 24, 156, 21, 21,
2432 150, 148, 148, 223, 4, 223, 224, 232, 148, 223,
2433 148, 148, 148, 223, 223, 223, 150, 186, 24, 4,
2434 182, 148, 148, 236, 148, 148, 148, 148, 191, 148,
2435 148, 148, 36, 148, 57, 178, 148, 223, 223, 232,
2436 233, 223, 223, 148, 179, 179, 148, 223, 148, 224,
2437 224, 224, 233, 223, 191, 191, 151, 191, 191, 191,
2438 191, 191, 191, 191, 186, 191, 4, 24, 148, 152,
2439 151, 224, 154, 223, 151, 148, 148, 148, 151, 148,
2440 148, 151, 151, 151, 151, 151, 21, 154, 173, 229,
2441 36, 154, 191, 191, 191, 191, 191, 223, 221, 154,
2442 173, 21, 151, 151, 151, 151, 151, 148, 221, 223,
2443 21, 148, 76, 223, 21, 21, 223, 223
2446 #define yyerrok (yyerrstatus = 0)
2447 #define yyclearin (yychar = YYEMPTY)
2448 #define YYEMPTY (-2)
2451 #define YYACCEPT goto yyacceptlab
2452 #define YYABORT goto yyabortlab
2453 #define YYERROR goto yyerrorlab
2456 /* Like YYERROR except do call yyerror. This remains here temporarily
2457 to ease the transition to the new meaning of YYERROR, for GCC.
2458 Once GCC version 2 has supplanted version 1, this can go. */
2460 #define YYFAIL goto yyerrlab
2462 #define YYRECOVERING() (!!yyerrstatus)
2464 #define YYBACKUP(Token, Value) \
2466 if (yychar == YYEMPTY && yylen == 1) \
2470 yytoken = YYTRANSLATE (yychar); \
2476 yyerror (YY_("syntax error: cannot back up")); \
2483 #define YYERRCODE 256
2486 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2487 If N is 0, then set CURRENT to the empty location which ends
2488 the previous symbol: RHS[0] (always defined). */
2490 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2491 #ifndef YYLLOC_DEFAULT
2492 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2496 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2497 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2498 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2499 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2503 (Current).first_line = (Current).last_line = \
2504 YYRHSLOC (Rhs, 0).last_line; \
2505 (Current).first_column = (Current).last_column = \
2506 YYRHSLOC (Rhs, 0).last_column; \
2512 /* YY_LOCATION_PRINT -- Print the location on the stream.
2513 This macro was not mandated originally: define only if we know
2514 we won't break user code: when these are the locations we know. */
2516 #ifndef YY_LOCATION_PRINT
2517 # if YYLTYPE_IS_TRIVIAL
2518 # define YY_LOCATION_PRINT(File, Loc) \
2519 fprintf (File, "%d.%d-%d.%d", \
2520 (Loc).first_line, (Loc).first_column, \
2521 (Loc).last_line, (Loc).last_column)
2523 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2528 /* YYLEX -- calling `yylex' with the right arguments. */
2531 # define YYLEX yylex (YYLEX_PARAM)
2533 # define YYLEX yylex ()
2536 /* Enable debugging if requested. */
2540 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2541 # define YYFPRINTF fprintf
2544 # define YYDPRINTF(Args) \
2550 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2554 YYFPRINTF (stderr, "%s ", Title); \
2555 yysymprint (stderr, \
2557 YYFPRINTF (stderr, "\n"); \
2561 /*------------------------------------------------------------------.
2562 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2564 `------------------------------------------------------------------*/
2566 #if defined (__STDC__) || defined (__cplusplus)
2568 yy_stack_print (short int *bottom, short int *top)
2571 yy_stack_print (bottom, top)
2576 YYFPRINTF (stderr, "Stack now");
2577 for (/* Nothing. */; bottom <= top; ++bottom)
2578 YYFPRINTF (stderr, " %d", *bottom);
2579 YYFPRINTF (stderr, "\n");
2582 # define YY_STACK_PRINT(Bottom, Top) \
2585 yy_stack_print ((Bottom), (Top)); \
2589 /*------------------------------------------------.
2590 | Report that the YYRULE is going to be reduced. |
2591 `------------------------------------------------*/
2593 #if defined (__STDC__) || defined (__cplusplus)
2595 yy_reduce_print (int yyrule)
2598 yy_reduce_print (yyrule)
2603 unsigned long int yylno = yyrline[yyrule];
2604 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2606 /* Print the symbols being reduced, and their result. */
2607 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2608 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2609 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2612 # define YY_REDUCE_PRINT(Rule) \
2615 yy_reduce_print (Rule); \
2618 /* Nonzero means print parse trace. It is left uninitialized so that
2619 multiple parsers can coexist. */
2621 #else /* !YYDEBUG */
2622 # define YYDPRINTF(Args)
2623 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2624 # define YY_STACK_PRINT(Bottom, Top)
2625 # define YY_REDUCE_PRINT(Rule)
2626 #endif /* !YYDEBUG */
2629 /* YYINITDEPTH -- initial size of the parser's stacks. */
2631 # define YYINITDEPTH 200
2634 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2635 if the built-in stack extension method is used).
2637 Do not make this value too large; the results are undefined if
2638 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2639 evaluated with infinite-precision integer arithmetic. */
2642 # define YYMAXDEPTH 10000
2650 # if defined (__GLIBC__) && defined (_STRING_H)
2651 # define yystrlen strlen
2653 /* Return the length of YYSTR. */
2655 # if defined (__STDC__) || defined (__cplusplus)
2656 yystrlen (const char *yystr)
2662 const char *yys = yystr;
2664 while (*yys++ != '\0')
2667 return yys - yystr - 1;
2673 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2674 # define yystpcpy stpcpy
2676 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2679 # if defined (__STDC__) || defined (__cplusplus)
2680 yystpcpy (char *yydest, const char *yysrc)
2682 yystpcpy (yydest, yysrc)
2688 const char *yys = yysrc;
2690 while ((*yyd++ = *yys++) != '\0')
2699 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2700 quotes and backslashes, so that it's suitable for yyerror. The
2701 heuristic is that double-quoting is unnecessary unless the string
2702 contains an apostrophe, a comma, or backslash (other than
2703 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2704 null, do not copy; instead, return the length of what the result
2707 yytnamerr (char *yyres, const char *yystr)
2712 char const *yyp = yystr;
2719 goto do_not_strip_quotes;
2723 goto do_not_strip_quotes;
2736 do_not_strip_quotes: ;
2740 return yystrlen (yystr);
2742 return yystpcpy (yyres, yystr) - yyres;
2746 #endif /* YYERROR_VERBOSE */
2751 /*--------------------------------.
2752 | Print this symbol on YYOUTPUT. |
2753 `--------------------------------*/
2755 #if defined (__STDC__) || defined (__cplusplus)
2757 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2760 yysymprint (yyoutput, yytype, yyvaluep)
2766 /* Pacify ``unused variable'' warnings. */
2769 if (yytype < YYNTOKENS)
2770 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2772 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2776 if (yytype < YYNTOKENS)
2777 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2784 YYFPRINTF (yyoutput, ")");
2787 #endif /* ! YYDEBUG */
2788 /*-----------------------------------------------.
2789 | Release the memory associated to this symbol. |
2790 `-----------------------------------------------*/
2792 #if defined (__STDC__) || defined (__cplusplus)
2794 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2797 yydestruct (yymsg, yytype, yyvaluep)
2803 /* Pacify ``unused variable'' warnings. */
2808 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2819 /* Prevent warnings from -Wmissing-prototypes. */
2821 #ifdef YYPARSE_PARAM
2822 # if defined (__STDC__) || defined (__cplusplus)
2823 int yyparse (void *YYPARSE_PARAM);
2827 #else /* ! YYPARSE_PARAM */
2828 #if defined (__STDC__) || defined (__cplusplus)
2833 #endif /* ! YYPARSE_PARAM */
2837 /* The look-ahead symbol. */
2840 /* The semantic value of the look-ahead symbol. */
2843 /* Number of syntax errors so far. */
2852 #ifdef YYPARSE_PARAM
2853 # if defined (__STDC__) || defined (__cplusplus)
2854 int yyparse (void *YYPARSE_PARAM)
2856 int yyparse (YYPARSE_PARAM)
2857 void *YYPARSE_PARAM;
2859 #else /* ! YYPARSE_PARAM */
2860 #if defined (__STDC__) || defined (__cplusplus)
2874 /* Number of tokens to shift before error messages enabled. */
2876 /* Look-ahead token as an internal (translated) token number. */
2879 /* Three stacks and their tools:
2880 `yyss': related to states,
2881 `yyvs': related to semantic values,
2882 `yyls': related to locations.
2884 Refer to the stacks thru separate pointers, to allow yyoverflow
2885 to reallocate them elsewhere. */
2887 /* The state stack. */
2888 short int yyssa[YYINITDEPTH];
2889 short int *yyss = yyssa;
2892 /* The semantic value stack. */
2893 YYSTYPE yyvsa[YYINITDEPTH];
2894 YYSTYPE *yyvs = yyvsa;
2899 #define YYPOPSTACK (yyvsp--, yyssp--)
2901 YYSIZE_T yystacksize = YYINITDEPTH;
2903 /* The variables used to return semantic value and location from the
2908 /* When reducing, the number of symbols on the RHS of the reduced
2912 YYDPRINTF ((stderr, "Starting parse\n"));
2917 yychar = YYEMPTY; /* Cause a token to be read. */
2919 /* Initialize stack pointers.
2920 Waste one element of value and location stack
2921 so that they stay on the same level as the state stack.
2922 The wasted elements are never initialized. */
2929 /*------------------------------------------------------------.
2930 | yynewstate -- Push a new state, which is found in yystate. |
2931 `------------------------------------------------------------*/
2933 /* In all cases, when you get here, the value and location stacks
2934 have just been pushed. so pushing a state here evens the stacks.
2941 if (yyss + yystacksize - 1 <= yyssp)
2943 /* Get the current used size of the three stacks, in elements. */
2944 YYSIZE_T yysize = yyssp - yyss + 1;
2948 /* Give user a chance to reallocate the stack. Use copies of
2949 these so that the &'s don't force the real ones into
2951 YYSTYPE *yyvs1 = yyvs;
2952 short int *yyss1 = yyss;
2955 /* Each stack pointer address is followed by the size of the
2956 data in use in that stack, in bytes. This used to be a
2957 conditional around just the two extra args, but that might
2958 be undefined if yyoverflow is a macro. */
2959 yyoverflow (YY_("memory exhausted"),
2960 &yyss1, yysize * sizeof (*yyssp),
2961 &yyvs1, yysize * sizeof (*yyvsp),
2968 #else /* no yyoverflow */
2969 # ifndef YYSTACK_RELOCATE
2970 goto yyexhaustedlab;
2972 /* Extend the stack our own way. */
2973 if (YYMAXDEPTH <= yystacksize)
2974 goto yyexhaustedlab;
2976 if (YYMAXDEPTH < yystacksize)
2977 yystacksize = YYMAXDEPTH;
2980 short int *yyss1 = yyss;
2981 union yyalloc *yyptr =
2982 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2984 goto yyexhaustedlab;
2985 YYSTACK_RELOCATE (yyss);
2986 YYSTACK_RELOCATE (yyvs);
2988 # undef YYSTACK_RELOCATE
2990 YYSTACK_FREE (yyss1);
2993 #endif /* no yyoverflow */
2995 yyssp = yyss + yysize - 1;
2996 yyvsp = yyvs + yysize - 1;
2999 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3000 (unsigned long int) yystacksize));
3002 if (yyss + yystacksize - 1 <= yyssp)
3006 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3015 /* Do appropriate processing given the current state. */
3016 /* Read a look-ahead token if we need one and don't already have one. */
3019 /* First try to decide what to do without reference to look-ahead token. */
3021 yyn = yypact[yystate];
3022 if (yyn == YYPACT_NINF)
3025 /* Not known => get a look-ahead token if don't already have one. */
3027 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3028 if (yychar == YYEMPTY)
3030 YYDPRINTF ((stderr, "Reading a token: "));
3034 if (yychar <= YYEOF)
3036 yychar = yytoken = YYEOF;
3037 YYDPRINTF ((stderr, "Now at end of input.\n"));
3041 yytoken = YYTRANSLATE (yychar);
3042 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3045 /* If the proper action on seeing token YYTOKEN is to reduce or to
3046 detect an error, take that action. */
3048 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3053 if (yyn == 0 || yyn == YYTABLE_NINF)
3062 /* Shift the look-ahead token. */
3063 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3065 /* Discard the token being shifted unless it is eof. */
3066 if (yychar != YYEOF)
3072 /* Count tokens shifted since error; after three, turn off error
3081 /*-----------------------------------------------------------.
3082 | yydefault -- do the default action for the current state. |
3083 `-----------------------------------------------------------*/
3085 yyn = yydefact[yystate];
3091 /*-----------------------------.
3092 | yyreduce -- Do a reduction. |
3093 `-----------------------------*/
3095 /* yyn is the number of a rule to reduce with. */
3098 /* If YYLEN is nonzero, implement the default value of the action:
3101 Otherwise, the following line sets YYVAL to garbage.
3102 This behavior is undocumented and Bison
3103 users should not rely upon it. Assigning to YYVAL
3104 unconditionally makes the parser a bit smaller, and it avoids a
3105 GCC warning that YYVAL may be used uninitialized. */
3106 yyval = yyvsp[1-yylen];
3109 YY_REDUCE_PRINT (yyn);
3113 #line 1105 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3115 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3116 GEN_ERROR("Value too large for type!");
3117 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3123 #line 1114 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3125 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
3126 GEN_ERROR("Value too large for type!");
3127 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
3133 #line 1131 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3134 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3138 #line 1131 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3139 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3143 #line 1132 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3144 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3148 #line 1132 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3149 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3153 #line 1133 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3154 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3158 #line 1133 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3159 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3163 #line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3164 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3168 #line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3169 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3173 #line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3174 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3178 #line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3179 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3183 #line 1139 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3184 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3188 #line 1139 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3189 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3193 #line 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3194 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3198 #line 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3199 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3203 #line 1141 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3204 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3208 #line 1141 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3209 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3213 #line 1142 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3214 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3218 #line 1142 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3219 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3223 #line 1143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3224 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3228 #line 1143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3229 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3233 #line 1144 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3234 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3238 #line 1144 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3239 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3243 #line 1145 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3244 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3248 #line 1145 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3249 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3253 #line 1146 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3254 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3258 #line 1147 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3259 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3263 #line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3265 (yyval.StrVal) = (yyvsp[-1].StrVal);
3271 #line 1162 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3279 #line 1167 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3280 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3284 #line 1168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3285 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3289 #line 1169 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3290 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3294 #line 1170 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3295 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3299 #line 1171 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3300 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3304 #line 1172 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3305 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3309 #line 1173 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3310 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3314 #line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3315 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3319 #line 1176 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3320 { (yyval.UIntVal) = CallingConv::C; ;}
3324 #line 1177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3325 { (yyval.UIntVal) = CallingConv::C; ;}
3329 #line 1178 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3330 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3334 #line 1179 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3335 { (yyval.UIntVal) = CallingConv::Fast; ;}
3339 #line 1180 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3340 { (yyval.UIntVal) = CallingConv::Cold; ;}
3344 #line 1181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3345 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3349 #line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3350 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3354 #line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3356 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3357 GEN_ERROR("Calling conv too large!");
3358 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3364 #line 1192 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3365 { (yyval.UIntVal) = 0; ;}
3369 #line 1193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3371 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3372 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3373 GEN_ERROR("Alignment must be a power of two!");
3379 #line 1199 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3380 { (yyval.UIntVal) = 0; ;}
3384 #line 1200 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3386 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3387 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3388 GEN_ERROR("Alignment must be a power of two!");
3394 #line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3396 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3397 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3398 GEN_ERROR("Invalid character in section name!");
3399 (yyval.StrVal) = (yyvsp[0].StrVal);
3405 #line 1216 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3406 { (yyval.StrVal) = 0; ;}
3410 #line 1217 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3411 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3415 #line 1222 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3420 #line 1223 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3425 #line 1224 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3427 CurGV->setSection((yyvsp[0].StrVal));
3428 free((yyvsp[0].StrVal));
3434 #line 1229 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3436 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3437 GEN_ERROR("Alignment must be a power of two!");
3438 CurGV->setAlignment((yyvsp[0].UInt64Val));
3444 #line 1243 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3445 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3449 #line 1244 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3450 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3454 #line 1246 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3456 if (!UpRefs.empty())
3457 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3458 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3464 #line 1258 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3466 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3472 #line 1262 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3474 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3480 #line 1266 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3481 { // Named types are also simple types...
3482 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3484 (yyval.TypeVal) = new PATypeHolder(tmp);
3489 #line 1274 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3490 { // Type UpReference
3491 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3492 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3493 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3494 (yyval.TypeVal) = new PATypeHolder(OT);
3495 UR_OUT("New Upreference!\n");
3501 #line 1282 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3502 { // Function derived type?
3503 std::vector<const Type*> Params;
3504 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3505 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3506 Params.push_back(*I);
3507 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3508 if (isVarArg) Params.pop_back();
3510 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3511 delete (yyvsp[-1].TypeList); // Delete the argument list
3512 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3518 #line 1295 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3519 { // Sized array type?
3520 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3521 delete (yyvsp[-1].TypeVal);
3527 #line 1300 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3528 { // Packed array type?
3529 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3530 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3531 GEN_ERROR("Unsigned result not equal to signed result");
3532 if (!ElemTy->isPrimitiveType())
3533 GEN_ERROR("Elemental type of a PackedType must be primitive");
3534 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3535 GEN_ERROR("Vector length should be a power of 2!");
3536 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3537 delete (yyvsp[-1].TypeVal);
3543 #line 1312 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3544 { // Structure type?
3545 std::vector<const Type*> Elements;
3546 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3547 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3548 Elements.push_back(*I);
3550 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3551 delete (yyvsp[-1].TypeList);
3557 #line 1322 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3558 { // Empty structure type?
3559 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3565 #line 1326 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3567 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3568 GEN_ERROR("Cannot form a pointer to a basic block");
3569 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3570 delete (yyvsp[-1].TypeVal);
3576 #line 1337 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3578 (yyval.TypeList) = new std::list<PATypeHolder>();
3579 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3585 #line 1342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3587 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3593 #line 1349 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3595 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3601 #line 1353 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3603 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3609 #line 1357 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3611 (yyval.TypeList) = new std::list<PATypeHolder>();
3617 #line 1368 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3618 { // Nonempty unsized arr
3619 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3621 GEN_ERROR("Cannot make array constant with type: '" +
3622 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3623 const Type *ETy = ATy->getElementType();
3624 int NumElements = ATy->getNumElements();
3626 // Verify that we have the correct size...
3627 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3628 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3629 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3630 itostr(NumElements) + "!");
3632 // Verify all elements are correct type!
3633 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3634 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3635 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3636 ETy->getDescription() +"' as required!\nIt is of type '"+
3637 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3640 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3641 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3647 #line 1394 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3649 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3651 GEN_ERROR("Cannot make array constant with type: '" +
3652 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3654 int NumElements = ATy->getNumElements();
3655 if (NumElements != -1 && NumElements != 0)
3656 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3657 " arguments, but has size of " + itostr(NumElements) +"!");
3658 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3659 delete (yyvsp[-2].TypeVal);
3665 #line 1408 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3667 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3669 GEN_ERROR("Cannot make array constant with type: '" +
3670 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3672 int NumElements = ATy->getNumElements();
3673 const Type *ETy = ATy->getElementType();
3674 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3675 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3676 GEN_ERROR("Can't build string constant of size " +
3677 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3678 " when array has size " + itostr(NumElements) + "!");
3679 std::vector<Constant*> Vals;
3680 if (ETy == Type::SByteTy) {
3681 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3682 Vals.push_back(ConstantInt::get(ETy, *C));
3683 } else if (ETy == Type::UByteTy) {
3684 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3685 C != (unsigned char*)EndStr; ++C)
3686 Vals.push_back(ConstantInt::get(ETy, *C));
3688 free((yyvsp[0].StrVal));
3689 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3691 free((yyvsp[0].StrVal));
3692 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3693 delete (yyvsp[-2].TypeVal);
3699 #line 1438 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3700 { // Nonempty unsized arr
3701 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3703 GEN_ERROR("Cannot make packed constant with type: '" +
3704 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3705 const Type *ETy = PTy->getElementType();
3706 int NumElements = PTy->getNumElements();
3708 // Verify that we have the correct size...
3709 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3710 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3711 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3712 itostr(NumElements) + "!");
3714 // Verify all elements are correct type!
3715 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3716 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3717 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3718 ETy->getDescription() +"' as required!\nIt is of type '"+
3719 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3722 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3723 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3729 #line 1464 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3731 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3733 GEN_ERROR("Cannot make struct constant with type: '" +
3734 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3736 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3737 GEN_ERROR("Illegal number of initializers for structure type!");
3739 // Check to ensure that constants are compatible with the type initializer!
3740 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3741 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3742 GEN_ERROR("Expected type '" +
3743 STy->getElementType(i)->getDescription() +
3744 "' for element #" + utostr(i) +
3745 " of structure initializer!");
3747 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3748 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3754 #line 1485 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3756 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3758 GEN_ERROR("Cannot make struct constant with type: '" +
3759 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3761 if (STy->getNumContainedTypes() != 0)
3762 GEN_ERROR("Illegal number of initializers for structure type!");
3764 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3765 delete (yyvsp[-2].TypeVal);
3771 #line 1498 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3773 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3775 GEN_ERROR("Cannot make null pointer constant with type: '" +
3776 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3778 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3779 delete (yyvsp[-1].TypeVal);
3785 #line 1508 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3787 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3788 delete (yyvsp[-1].TypeVal);
3794 #line 1513 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3796 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3798 GEN_ERROR("Global const reference must be a pointer type!");
3800 // ConstExprs can exist in the body of a function, thus creating
3801 // GlobalValues whenever they refer to a variable. Because we are in
3802 // the context of a function, getValNonImprovising will search the functions
3803 // symbol table instead of the module symbol table for the global symbol,
3804 // which throws things all off. To get around this, we just tell
3805 // getValNonImprovising that we are at global scope here.
3807 Function *SavedCurFn = CurFun.CurrentFunction;
3808 CurFun.CurrentFunction = 0;
3810 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3813 CurFun.CurrentFunction = SavedCurFn;
3815 // If this is an initializer for a constant pointer, which is referencing a
3816 // (currently) undefined variable, create a stub now that shall be replaced
3817 // in the future with the right type of variable.
3820 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3821 const PointerType *PT = cast<PointerType>(Ty);
3823 // First check to see if the forward references value is already created!
3824 PerModuleInfo::GlobalRefsType::iterator I =
3825 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3827 if (I != CurModule.GlobalRefs.end()) {
3828 V = I->second; // Placeholder already exists, use it...
3829 (yyvsp[0].ValIDVal).destroy();
3832 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3834 // Create the forward referenced global.
3836 if (const FunctionType *FTy =
3837 dyn_cast<FunctionType>(PT->getElementType())) {
3838 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3839 CurModule.CurrentModule);
3841 GV = new GlobalVariable(PT->getElementType(), false,
3842 GlobalValue::ExternalLinkage, 0,
3843 Name, CurModule.CurrentModule);
3846 // Keep track of the fact that we have a forward ref to recycle it
3847 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3852 (yyval.ConstVal) = cast<GlobalValue>(V);
3853 delete (yyvsp[-1].TypeVal); // Free the type handle
3859 #line 1574 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3861 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3862 GEN_ERROR("Mismatched types for constant expression!");
3863 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3864 delete (yyvsp[-1].TypeVal);
3870 #line 1581 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3872 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3873 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3874 GEN_ERROR("Cannot create a null initialized value of this type!");
3875 (yyval.ConstVal) = Constant::getNullValue(Ty);
3876 delete (yyvsp[-1].TypeVal);
3882 #line 1589 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3883 { // integral constants
3884 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3885 GEN_ERROR("Constant value doesn't fit in type!");
3886 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3892 #line 1595 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3893 { // integral constants
3894 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3895 GEN_ERROR("Constant value doesn't fit in type!");
3896 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3902 #line 1601 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3903 { // Boolean constants
3904 (yyval.ConstVal) = ConstantBool::getTrue();
3910 #line 1605 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3911 { // Boolean constants
3912 (yyval.ConstVal) = ConstantBool::getFalse();
3918 #line 1609 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3919 { // Float & Double constants
3920 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3921 GEN_ERROR("Floating point constant invalid for type!!");
3922 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3928 #line 1617 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3930 Constant *Val = (yyvsp[-3].ConstVal);
3931 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3932 if (!Val->getType()->isFirstClassType())
3933 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3934 Val->getType()->getDescription() + "'!");
3935 if (!Ty->isFirstClassType())
3936 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3937 Ty->getDescription() + "'!");
3938 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3939 delete (yyvsp[-1].TypeVal);
3944 #line 1629 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3946 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3947 GEN_ERROR("GetElementPtr requires a pointer operand!");
3949 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3950 // indices to uint struct indices for compatibility.
3951 generic_gep_type_iterator<std::vector<Value*>::iterator>
3952 GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
3953 GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
3954 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
3955 if (isa<StructType>(*GTI)) // Only change struct indices
3956 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[-1].ValueList))[i]))
3957 if (CUI->getType() == Type::UByteTy)
3958 (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3961 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3963 GEN_ERROR("Index list invalid for constant getelementptr!");
3965 std::vector<Constant*> IdxVec;
3966 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3967 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3968 IdxVec.push_back(C);
3970 GEN_ERROR("Indices to constant getelementptr must be constants!");
3972 delete (yyvsp[-1].ValueList);
3974 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3980 #line 1661 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3982 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3983 GEN_ERROR("Select condition must be of boolean type!");
3984 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3985 GEN_ERROR("Select operand types must match!");
3986 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3992 #line 1669 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3994 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3995 GEN_ERROR("Binary operator types must match!");
3998 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
3999 // To retain backward compatibility with these early compilers, we emit a
4000 // cast to the appropriate integer type automatically if we are in the
4001 // broken case. See PR424 for more information.
4002 if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
4003 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4005 const Type *IntPtrTy = 0;
4006 switch (CurModule.CurrentModule->getPointerSize()) {
4007 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
4008 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
4009 default: GEN_ERROR("invalid pointer binary constant expr!");
4011 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
4012 ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
4013 (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
4020 #line 1693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4022 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4023 GEN_ERROR("Logical operator types must match!");
4024 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4025 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4026 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
4027 GEN_ERROR("Logical operator requires integral operands!");
4029 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4035 #line 1704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4037 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4038 GEN_ERROR("setcc operand types must match!");
4039 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4045 #line 1710 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4047 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4048 GEN_ERROR("icmp operand types must match!");
4049 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4054 #line 1715 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4056 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4057 GEN_ERROR("fcmp operand types must match!");
4058 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4063 #line 1720 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4065 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
4066 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
4067 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4068 GEN_ERROR("Shift constant expression requires integer operand!");
4070 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4076 #line 1729 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4078 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4079 GEN_ERROR("Invalid extractelement operands!");
4080 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4086 #line 1735 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4088 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4089 GEN_ERROR("Invalid insertelement operands!");
4090 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4096 #line 1741 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4098 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4099 GEN_ERROR("Invalid shufflevector operands!");
4100 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4106 #line 1750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4108 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4114 #line 1754 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4116 (yyval.ConstVector) = new std::vector<Constant*>();
4117 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4123 #line 1762 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4124 { (yyval.BoolVal) = false; ;}
4128 #line 1762 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4129 { (yyval.BoolVal) = true; ;}
4133 #line 1772 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4135 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
4136 CurModule.ModuleDone();
4142 #line 1780 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4144 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4145 CurFun.FunctionDone();
4151 #line 1785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4153 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4159 #line 1789 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4161 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
4167 #line 1793 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4169 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4175 #line 1797 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4177 (yyval.ModuleVal) = CurModule.CurrentModule;
4178 // Emit an error if there are any unresolved types left.
4179 if (!CurModule.LateResolveTypes.empty()) {
4180 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4181 if (DID.Type == ValID::NameVal) {
4182 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4184 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4192 #line 1812 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4194 // Eagerly resolve types. This is not an optimization, this is a
4195 // requirement that is due to the fact that we could have this:
4197 // %list = type { %list * }
4198 // %list = type { %list * } ; repeated type decl
4200 // If types are not resolved eagerly, then the two types will not be
4201 // determined to be the same type!
4203 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4205 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4207 // If this is a named type that is not a redefinition, add it to the slot
4209 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4212 delete (yyvsp[0].TypeVal);
4218 #line 1834 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4219 { // Function prototypes can be in const pool
4225 #line 1837 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4226 { // Asm blocks can be in the const pool
4232 #line 1840 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4234 if ((yyvsp[0].ConstVal) == 0)
4235 GEN_ERROR("Global value initializer is not a constant!");
4236 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4242 #line 1845 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4249 #line 1848 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4251 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4253 delete (yyvsp[0].TypeVal);
4258 #line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4266 #line 1856 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4268 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4270 delete (yyvsp[0].TypeVal);
4275 #line 1860 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4283 #line 1864 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4286 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4288 delete (yyvsp[0].TypeVal);
4293 #line 1869 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4301 #line 1873 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4308 #line 1876 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4315 #line 1879 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4321 #line 1883 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4323 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4324 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4325 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4326 free((yyvsp[0].StrVal));
4328 if (AsmSoFar.empty())
4329 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4331 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4337 #line 1896 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4338 { (yyval.Endianness) = Module::BigEndian; ;}
4342 #line 1897 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4343 { (yyval.Endianness) = Module::LittleEndian; ;}
4347 #line 1899 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4349 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4355 #line 1903 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4357 if ((yyvsp[0].UInt64Val) == 32)
4358 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4359 else if ((yyvsp[0].UInt64Val) == 64)
4360 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4362 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4368 #line 1912 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4370 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4371 free((yyvsp[0].StrVal));
4376 #line 1916 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4378 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4379 free((yyvsp[0].StrVal));
4384 #line 1923 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4386 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4387 free((yyvsp[0].StrVal));
4393 #line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4395 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4396 free((yyvsp[0].StrVal));
4402 #line 1933 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4409 #line 1943 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4410 { (yyval.StrVal) = 0; ;}
4414 #line 1945 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4416 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4417 GEN_ERROR("void typed arguments are invalid!");
4418 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4424 #line 1952 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4426 (yyval.ArgList) = (yyvsp[-2].ArgList);
4427 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4428 delete (yyvsp[0].ArgVal);
4434 #line 1958 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4436 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4437 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4438 delete (yyvsp[0].ArgVal);
4444 #line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4446 (yyval.ArgList) = (yyvsp[0].ArgList);
4452 #line 1969 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4454 (yyval.ArgList) = (yyvsp[-2].ArgList);
4455 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4456 char*>(new PATypeHolder(Type::VoidTy), 0));
4462 #line 1975 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4464 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4465 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4471 #line 1980 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4473 (yyval.ArgList) = 0;
4479 #line 1986 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4481 UnEscapeLexed((yyvsp[-5].StrVal));
4482 std::string FunctionName((yyvsp[-5].StrVal));
4483 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4485 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4486 GEN_ERROR("LLVM functions cannot return aggregate types!");
4488 std::vector<const Type*> ParamTypeList;
4489 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4490 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4491 I != (yyvsp[-3].ArgList)->end(); ++I)
4492 ParamTypeList.push_back(I->first->get());
4495 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4496 if (isVarArg) ParamTypeList.pop_back();
4498 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4499 const PointerType *PFT = PointerType::get(FT);
4500 delete (yyvsp[-6].TypeVal);
4503 if (!FunctionName.empty()) {
4504 ID = ValID::create((char*)FunctionName.c_str());
4506 ID = ValID::create((int)CurModule.Values[PFT].size());
4510 // See if this function was forward referenced. If so, recycle the object.
4511 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4512 // Move the function to the end of the list, from whereever it was
4513 // previously inserted.
4514 Fn = cast<Function>(FWRef);
4515 CurModule.CurrentModule->getFunctionList().remove(Fn);
4516 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4517 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4518 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4519 // If this is the case, either we need to be a forward decl, or it needs
4521 if (!CurFun.isDeclare && !Fn->isExternal())
4522 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4524 // Make sure to strip off any argument names so we can't get conflicts.
4525 if (Fn->isExternal())
4526 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4529 } else { // Not already defined?
4530 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4531 CurModule.CurrentModule);
4533 InsertValue(Fn, CurModule.Values);
4536 CurFun.FunctionStart(Fn);
4538 if (CurFun.isDeclare) {
4539 // If we have declaration, always overwrite linkage. This will allow us to
4540 // correctly handle cases, when pointer to function is passed as argument to
4541 // another function.
4542 Fn->setLinkage(CurFun.Linkage);
4544 Fn->setCallingConv((yyvsp[-7].UIntVal));
4545 Fn->setAlignment((yyvsp[0].UIntVal));
4546 if ((yyvsp[-1].StrVal)) {
4547 Fn->setSection((yyvsp[-1].StrVal));
4548 free((yyvsp[-1].StrVal));
4551 // Add all of the arguments we parsed to the function...
4552 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4553 if (isVarArg) { // Nuke the last entry
4554 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4555 "Not a varargs marker!");
4556 delete (yyvsp[-3].ArgList)->back().first;
4557 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4559 Function::arg_iterator ArgIt = Fn->arg_begin();
4560 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4561 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4562 delete I->first; // Delete the typeholder...
4564 setValueName(ArgIt, I->second); // Insert arg into symtab...
4569 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4576 #line 2082 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4578 (yyval.FunctionVal) = CurFun.CurrentFunction;
4580 // Make sure that we keep track of the linkage type even if there was a
4581 // previous "declare".
4582 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4587 #line 2092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4589 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4595 #line 2098 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4596 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4600 #line 2099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4601 { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
4605 #line 2101 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4606 { CurFun.isDeclare = true; ;}
4610 #line 2101 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4612 (yyval.FunctionVal) = CurFun.CurrentFunction;
4613 CurFun.FunctionDone();
4619 #line 2111 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4621 (yyval.BoolVal) = false;
4627 #line 2115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4629 (yyval.BoolVal) = true;
4635 #line 2120 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4636 { // A reference to a direct constant
4637 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4643 #line 2124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4645 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4651 #line 2128 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4652 { // Perhaps it's an FP constant?
4653 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4659 #line 2132 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4661 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4667 #line 2136 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4669 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4675 #line 2140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4677 (yyval.ValIDVal) = ValID::createNull();
4683 #line 2144 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4685 (yyval.ValIDVal) = ValID::createUndef();
4691 #line 2148 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4692 { // A vector zero constant.
4693 (yyval.ValIDVal) = ValID::createZeroInit();
4699 #line 2152 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4700 { // Nonempty unsized packed vector
4701 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4702 int NumElements = (yyvsp[-1].ConstVector)->size();
4704 PackedType* pt = PackedType::get(ETy, NumElements);
4705 PATypeHolder* PTy = new PATypeHolder(
4713 // Verify all elements are correct type!
4714 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4715 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4716 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4717 ETy->getDescription() +"' as required!\nIt is of type '" +
4718 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4721 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4722 delete PTy; delete (yyvsp[-1].ConstVector);
4728 #line 2177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4730 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4736 #line 2181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4738 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4739 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4740 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4741 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4742 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4743 free((yyvsp[-2].StrVal));
4744 free((yyvsp[0].StrVal));
4750 #line 2195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4751 { // Is it an integer reference...?
4752 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4758 #line 2199 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4759 { // Is it a named reference...?
4760 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4766 #line 2211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4768 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4774 #line 2216 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4776 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4782 #line 2220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4783 { // Do not allow functions with 0 basic blocks
4784 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4790 #line 2229 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4792 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4794 InsertValue((yyvsp[0].TermInstVal));
4796 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4797 InsertValue((yyvsp[-2].BasicBlockVal));
4798 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4804 #line 2240 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4806 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4807 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4808 if (CI2->getParent() == 0)
4809 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4810 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4811 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4817 #line 2249 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4819 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4822 // Make sure to move the basic block to the correct location in the
4823 // function, instead of leaving it inserted wherever it was first
4825 Function::BasicBlockListType &BBL =
4826 CurFun.CurrentFunction->getBasicBlockList();
4827 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4833 #line 2261 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4835 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4838 // Make sure to move the basic block to the correct location in the
4839 // function, instead of leaving it inserted wherever it was first
4841 Function::BasicBlockListType &BBL =
4842 CurFun.CurrentFunction->getBasicBlockList();
4843 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4849 #line 2274 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4850 { // Return with a result...
4851 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4857 #line 2278 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4858 { // Return with no result...
4859 (yyval.TermInstVal) = new ReturnInst();
4865 #line 2282 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4866 { // Unconditional Branch...
4867 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4869 (yyval.TermInstVal) = new BranchInst(tmpBB);
4874 #line 2287 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4876 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4878 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4880 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4882 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4887 #line 2296 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4889 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4891 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4893 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4894 (yyval.TermInstVal) = S;
4896 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4897 E = (yyvsp[-1].JumpTable)->end();
4898 for (; I != E; ++I) {
4899 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4900 S->addCase(CI, I->second);
4902 GEN_ERROR("Switch case is constant, but not a simple integer!");
4904 delete (yyvsp[-1].JumpTable);
4910 #line 2315 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4912 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4914 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4916 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4917 (yyval.TermInstVal) = S;
4923 #line 2325 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4925 const PointerType *PFTy;
4926 const FunctionType *Ty;
4928 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4929 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4930 // Pull out the types of all of the arguments...
4931 std::vector<const Type*> ParamTypes;
4932 if ((yyvsp[-7].ValueList)) {
4933 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4935 ParamTypes.push_back((*I)->getType());
4938 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4939 if (isVarArg) ParamTypes.pop_back();
4941 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4942 PFTy = PointerType::get(Ty);
4945 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4947 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4949 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4952 // Create the call node...
4953 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4954 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4955 } else { // Has arguments?
4956 // Loop through FunctionType's arguments and ensure they are specified
4959 FunctionType::param_iterator I = Ty->param_begin();
4960 FunctionType::param_iterator E = Ty->param_end();
4961 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4963 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4964 if ((*ArgI)->getType() != *I)
4965 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4966 (*I)->getDescription() + "'!");
4968 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4969 GEN_ERROR("Invalid number of parameters detected!");
4971 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4973 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4975 delete (yyvsp[-10].TypeVal);
4976 delete (yyvsp[-7].ValueList);
4982 #line 2380 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4984 (yyval.TermInstVal) = new UnwindInst();
4990 #line 2384 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4992 (yyval.TermInstVal) = new UnreachableInst();
4998 #line 2391 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5000 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5001 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5004 GEN_ERROR("May only switch on a constant pool value!");
5006 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5008 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5013 #line 2402 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5015 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5016 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5020 GEN_ERROR("May only switch on a constant pool value!");
5022 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5024 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5029 #line 2415 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5031 // Is this definition named?? if so, assign the name...
5032 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5034 InsertValue((yyvsp[0].InstVal));
5035 (yyval.InstVal) = (yyvsp[0].InstVal);
5041 #line 2424 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5042 { // Used for PHI nodes
5043 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5044 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5046 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5048 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5049 delete (yyvsp[-5].TypeVal);
5054 #line 2433 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5056 (yyval.PHIList) = (yyvsp[-6].PHIList);
5057 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5059 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5061 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5066 #line 2443 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5067 { // Used for call statements, and memory insts...
5068 (yyval.ValueList) = new std::vector<Value*>();
5069 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5074 #line 2447 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5076 (yyval.ValueList) = (yyvsp[-2].ValueList);
5077 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
5083 #line 2454 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5084 { (yyval.ValueList) = 0; ;}
5088 #line 2456 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5090 (yyval.BoolVal) = true;
5096 #line 2460 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5098 (yyval.BoolVal) = false;
5104 #line 2465 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5106 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5107 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5109 "Arithmetic operator requires integer, FP, or packed operands!");
5110 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5111 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5112 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5113 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5114 GEN_ERROR("U/S/FRem not supported on packed types!");
5115 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5117 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5119 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5120 if ((yyval.InstVal) == 0)
5121 GEN_ERROR("binary operator returned null!");
5122 delete (yyvsp[-3].TypeVal);
5127 #line 2484 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5129 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5130 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5131 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5132 GEN_ERROR("Logical operator requires integral operands!");
5134 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5136 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5138 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5139 if ((yyval.InstVal) == 0)
5140 GEN_ERROR("binary operator returned null!");
5141 delete (yyvsp[-3].TypeVal);
5146 #line 2499 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5148 if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
5150 "PackedTypes currently not supported in setcc instructions!");
5152 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5154 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5156 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5157 if ((yyval.InstVal) == 0)
5158 GEN_ERROR("binary operator returned null!");
5159 delete (yyvsp[-3].TypeVal);
5164 #line 2513 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5166 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5167 GEN_ERROR("Packed types not supported by icmp instruction");
5168 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5170 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5172 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5173 if ((yyval.InstVal) == 0)
5174 GEN_ERROR("icmp operator returned null!");
5179 #line 2524 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5181 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5182 GEN_ERROR("Packed types not supported by fcmp instruction");
5183 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5185 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5187 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5188 if ((yyval.InstVal) == 0)
5189 GEN_ERROR("fcmp operator returned null!");
5194 #line 2535 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5196 llvm_cerr << "WARNING: Use of eliminated 'not' instruction:"
5197 << " Replacing with 'xor'.\n";
5199 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5201 GEN_ERROR("Expected integral type for not instruction!");
5203 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5204 if ((yyval.InstVal) == 0)
5205 GEN_ERROR("Could not create a xor instruction!");
5211 #line 2548 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5213 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
5214 GEN_ERROR("Shift amount must be ubyte!");
5215 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5216 GEN_ERROR("Shift constant expression requires integer operand!");
5218 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5224 #line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5226 Value* Val = (yyvsp[-2].ValueVal);
5227 const Type* Ty = (yyvsp[0].TypeVal)->get();
5228 if (!Val->getType()->isFirstClassType())
5229 GEN_ERROR("cast from a non-primitive type: '" +
5230 Val->getType()->getDescription() + "'!");
5231 if (!Ty->isFirstClassType())
5232 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5233 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get());
5234 delete (yyvsp[0].TypeVal);
5239 #line 2568 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5241 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5242 GEN_ERROR("select condition must be boolean!");
5243 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5244 GEN_ERROR("select value types should match!");
5245 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5251 #line 2576 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5254 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5255 delete (yyvsp[0].TypeVal);
5261 #line 2582 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5263 ObsoleteVarArgs = true;
5264 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5265 Function* NF = CurModule.CurrentModule->
5266 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5269 //foo = alloca 1 of t
5273 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
5274 CurBB->getInstList().push_back(foo);
5275 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5276 CurBB->getInstList().push_back(bar);
5277 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5278 (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5279 delete (yyvsp[0].TypeVal);
5285 #line 2602 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5287 ObsoleteVarArgs = true;
5288 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5289 Function* NF = CurModule.CurrentModule->
5290 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5292 //b = vanext a, t ->
5293 //foo = alloca 1 of t
5296 //tmp = vaarg foo, t
5298 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
5299 CurBB->getInstList().push_back(foo);
5300 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5301 CurBB->getInstList().push_back(bar);
5302 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5303 Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5304 CurBB->getInstList().push_back(tmp);
5305 (yyval.InstVal) = new LoadInst(foo);
5306 delete (yyvsp[0].TypeVal);
5312 #line 2625 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5314 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5315 GEN_ERROR("Invalid extractelement operands!");
5316 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5322 #line 2631 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5324 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5325 GEN_ERROR("Invalid insertelement operands!");
5326 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5332 #line 2637 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5334 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5335 GEN_ERROR("Invalid shufflevector operands!");
5336 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5342 #line 2643 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5344 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5345 if (!Ty->isFirstClassType())
5346 GEN_ERROR("PHI node operands must be of first class type!");
5347 (yyval.InstVal) = new PHINode(Ty);
5348 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5349 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5350 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5351 GEN_ERROR("All elements of a PHI node must be of the same type!");
5352 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5353 (yyvsp[0].PHIList)->pop_front();
5355 delete (yyvsp[0].PHIList); // Free the list...
5361 #line 2658 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5363 const PointerType *PFTy = 0;
5364 const FunctionType *Ty = 0;
5366 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5367 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5368 // Pull out the types of all of the arguments...
5369 std::vector<const Type*> ParamTypes;
5370 if ((yyvsp[-1].ValueList)) {
5371 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5373 ParamTypes.push_back((*I)->getType());
5376 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5377 if (isVarArg) ParamTypes.pop_back();
5379 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5380 GEN_ERROR("LLVM functions cannot return aggregate types!");
5382 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5383 PFTy = PointerType::get(Ty);
5386 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5389 // Create the call node...
5390 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5391 // Make sure no arguments is a good thing!
5392 if (Ty->getNumParams() != 0)
5393 GEN_ERROR("No arguments passed to a function that "
5394 "expects arguments!");
5396 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5397 } else { // Has arguments?
5398 // Loop through FunctionType's arguments and ensure they are specified
5401 FunctionType::param_iterator I = Ty->param_begin();
5402 FunctionType::param_iterator E = Ty->param_end();
5403 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5405 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5406 if ((*ArgI)->getType() != *I)
5407 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5408 (*I)->getDescription() + "'!");
5410 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5411 GEN_ERROR("Invalid number of parameters detected!");
5413 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5415 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5416 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5417 delete (yyvsp[-4].TypeVal);
5418 delete (yyvsp[-1].ValueList);
5424 #line 2717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5426 (yyval.InstVal) = (yyvsp[0].InstVal);
5432 #line 2724 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5434 (yyval.ValueList) = (yyvsp[0].ValueList);
5440 #line 2727 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5442 (yyval.ValueList) = new std::vector<Value*>();
5448 #line 2732 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5450 (yyval.BoolVal) = true;
5456 #line 2736 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5458 (yyval.BoolVal) = false;
5464 #line 2743 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5466 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5467 delete (yyvsp[-1].TypeVal);
5473 #line 2748 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5475 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5477 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5478 delete (yyvsp[-4].TypeVal);
5483 #line 2754 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5485 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5486 delete (yyvsp[-1].TypeVal);
5492 #line 2759 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5494 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5496 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5497 delete (yyvsp[-4].TypeVal);
5502 #line 2765 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5504 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5505 GEN_ERROR("Trying to free nonpointer type " +
5506 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5507 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5513 #line 2773 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5515 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5516 GEN_ERROR("Can't load from nonpointer type: " +
5517 (*(yyvsp[-1].TypeVal))->getDescription());
5518 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5519 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5520 (*(yyvsp[-1].TypeVal))->getDescription());
5521 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5523 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5524 delete (yyvsp[-1].TypeVal);
5529 #line 2785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5531 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5533 GEN_ERROR("Can't store to a nonpointer type: " +
5534 (*(yyvsp[-1].TypeVal))->getDescription());
5535 const Type *ElTy = PT->getElementType();
5536 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5537 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5538 "' into space of type '" + ElTy->getDescription() + "'!");
5540 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5542 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5543 delete (yyvsp[-1].TypeVal);
5548 #line 2800 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5550 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5551 GEN_ERROR("getelementptr insn requires pointer operand!");
5553 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
5554 // indices to uint struct indices for compatibility.
5555 generic_gep_type_iterator<std::vector<Value*>::iterator>
5556 GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
5557 GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
5558 for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
5559 if (isa<StructType>(*GTI)) // Only change struct indices
5560 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[0].ValueList))[i]))
5561 if (CUI->getType() == Type::UByteTy)
5562 (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
5564 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5565 GEN_ERROR("Invalid getelementptr indices for type '" +
5566 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5567 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5569 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5570 delete (yyvsp[-2].TypeVal);
5571 delete (yyvsp[0].ValueList);
5579 /* Line 1126 of yacc.c. */
5580 #line 5581 "llvmAsmParser.tab.c"
5586 YY_STACK_PRINT (yyss, yyssp);
5591 /* Now `shift' the result of the reduction. Determine what state
5592 that goes to, based on the state we popped back to and the rule
5593 number reduced by. */
5597 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5598 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5599 yystate = yytable[yystate];
5601 yystate = yydefgoto[yyn - YYNTOKENS];
5606 /*------------------------------------.
5607 | yyerrlab -- here on detecting error |
5608 `------------------------------------*/
5610 /* If not already recovering from an error, report this error. */
5615 yyn = yypact[yystate];
5617 if (YYPACT_NINF < yyn && yyn < YYLAST)
5619 int yytype = YYTRANSLATE (yychar);
5620 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5621 YYSIZE_T yysize = yysize0;
5623 int yysize_overflow = 0;
5625 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5626 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5630 /* This is so xgettext sees the translatable formats that are
5631 constructed on the fly. */
5632 YY_("syntax error, unexpected %s");
5633 YY_("syntax error, unexpected %s, expecting %s");
5634 YY_("syntax error, unexpected %s, expecting %s or %s");
5635 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5636 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5640 static char const yyunexpected[] = "syntax error, unexpected %s";
5641 static char const yyexpecting[] = ", expecting %s";
5642 static char const yyor[] = " or %s";
5643 char yyformat[sizeof yyunexpected
5644 + sizeof yyexpecting - 1
5645 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5646 * (sizeof yyor - 1))];
5647 char const *yyprefix = yyexpecting;
5649 /* Start YYX at -YYN if negative to avoid negative indexes in
5651 int yyxbegin = yyn < 0 ? -yyn : 0;
5653 /* Stay within bounds of both yycheck and yytname. */
5654 int yychecklim = YYLAST - yyn;
5655 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5658 yyarg[0] = yytname[yytype];
5659 yyfmt = yystpcpy (yyformat, yyunexpected);
5661 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5662 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5664 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5668 yyformat[sizeof yyunexpected - 1] = '\0';
5671 yyarg[yycount++] = yytname[yyx];
5672 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5673 yysize_overflow |= yysize1 < yysize;
5675 yyfmt = yystpcpy (yyfmt, yyprefix);
5679 yyf = YY_(yyformat);
5680 yysize1 = yysize + yystrlen (yyf);
5681 yysize_overflow |= yysize1 < yysize;
5684 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5685 yymsg = (char *) YYSTACK_ALLOC (yysize);
5688 /* Avoid sprintf, as that infringes on the user's name space.
5689 Don't have undefined behavior even if the translation
5690 produced a string with the wrong number of "%s"s. */
5693 while ((*yyp = *yyf))
5695 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5697 yyp += yytnamerr (yyp, yyarg[yyi++]);
5707 YYSTACK_FREE (yymsg);
5711 yyerror (YY_("syntax error"));
5712 goto yyexhaustedlab;
5716 #endif /* YYERROR_VERBOSE */
5717 yyerror (YY_("syntax error"));
5722 if (yyerrstatus == 3)
5724 /* If just tried and failed to reuse look-ahead token after an
5725 error, discard it. */
5727 if (yychar <= YYEOF)
5729 /* Return failure if at end of input. */
5730 if (yychar == YYEOF)
5735 yydestruct ("Error: discarding", yytoken, &yylval);
5740 /* Else will try to reuse look-ahead token after shifting the error
5745 /*---------------------------------------------------.
5746 | yyerrorlab -- error raised explicitly by YYERROR. |
5747 `---------------------------------------------------*/
5750 /* Pacify compilers like GCC when the user code never invokes
5751 YYERROR and the label yyerrorlab therefore never appears in user
5762 /*-------------------------------------------------------------.
5763 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5764 `-------------------------------------------------------------*/
5766 yyerrstatus = 3; /* Each real token shifted decrements this. */
5770 yyn = yypact[yystate];
5771 if (yyn != YYPACT_NINF)
5774 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5782 /* Pop the current state because it cannot handle the error token. */
5787 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5790 YY_STACK_PRINT (yyss, yyssp);
5799 /* Shift the error token. */
5800 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5806 /*-------------------------------------.
5807 | yyacceptlab -- YYACCEPT comes here. |
5808 `-------------------------------------*/
5813 /*-----------------------------------.
5814 | yyabortlab -- YYABORT comes here. |
5815 `-----------------------------------*/
5821 /*-------------------------------------------------.
5822 | yyexhaustedlab -- memory exhaustion comes here. |
5823 `-------------------------------------------------*/
5825 yyerror (YY_("memory exhausted"));
5831 if (yychar != YYEOF && yychar != YYEMPTY)
5832 yydestruct ("Cleanup: discarding lookahead",
5834 while (yyssp != yyss)
5836 yydestruct ("Cleanup: popping",
5837 yystos[*yyssp], yyvsp);
5842 YYSTACK_FREE (yyss);
5848 #line 2826 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5851 void llvm::GenerateError(const std::string &message, int LineNo) {
5852 if (LineNo == -1) LineNo = llvmAsmlineno;
5853 // TODO: column number in exception
5855 TheParseError->setError(CurFilename, message, LineNo);
5859 int yyerror(const char *ErrorMsg) {
5861 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5862 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5863 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5864 if (yychar == YYEMPTY || yychar == 0)
5865 errMsg += "end-of-file.";
5867 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5868 GenerateError(errMsg);