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,
184 EXTRACTELEMENT = 375,
192 #define ESINT64VAL 258
193 #define EUINT64VAL 259
213 #define STRINGCONSTANT 279
214 #define IMPLEMENTATION 280
215 #define ZEROINITIALIZER 281
226 #define DOTDOTDOT 292
233 #define APPENDING 299
234 #define DLLIMPORT 300
235 #define DLLEXPORT 301
236 #define EXTERN_WEAK 302
243 #define POINTERSIZE 309
252 #define SIDEEFFECT 318
255 #define CSRETCC_TOK 321
256 #define FASTCC_TOK 322
257 #define COLDCC_TOK 323
258 #define X86_STDCALLCC_TOK 324
259 #define X86_FASTCALLCC_TOK 325
260 #define DATALAYOUT 326
266 #define UNREACHABLE 332
290 #define GETELEMENTPTR 356
309 #define EXTRACTELEMENT 375
310 #define INSERTELEMENT 376
311 #define SHUFFLEVECTOR 377
312 #define VAARG_old 378
313 #define VANEXT_old 379
318 /* Copy the first part of user declarations. */
319 #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
321 #include "ParserInternals.h"
322 #include "llvm/CallingConv.h"
323 #include "llvm/InlineAsm.h"
324 #include "llvm/Instructions.h"
325 #include "llvm/Module.h"
326 #include "llvm/SymbolTable.h"
327 #include "llvm/Assembly/AutoUpgrade.h"
328 #include "llvm/Support/GetElementPtrTypeIterator.h"
329 #include "llvm/ADT/STLExtras.h"
330 #include "llvm/Support/MathExtras.h"
336 // The following is a gross hack. In order to rid the libAsmParser library of
337 // exceptions, we have to have a way of getting the yyparse function to go into
338 // an error situation. So, whenever we want an error to occur, the GenerateError
339 // function (see bottom of file) sets TriggerError. Then, at the end of each
340 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
341 // (a goto) to put YACC in error state. Furthermore, several calls to
342 // GenerateError are made from inside productions and they must simulate the
343 // previous exception behavior by exiting the production immediately. We have
344 // replaced these with the GEN_ERROR macro which calls GeneratError and then
345 // immediately invokes YYERROR. This would be so much cleaner if it was a
346 // recursive descent parser.
347 static bool TriggerError = false;
348 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
349 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
351 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
352 int yylex(); // declaration" of xxx warnings.
356 std::string CurFilename;
358 using namespace llvm;
360 static Module *ParserResult;
362 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
363 // relating to upreferences in the input stream.
365 //#define DEBUG_UPREFS 1
367 #define UR_OUT(X) std::cerr << X
372 #define YYERROR_VERBOSE 1
374 static bool ObsoleteVarArgs;
375 static bool NewVarArgs;
376 static BasicBlock *CurBB;
377 static GlobalVariable *CurGV;
380 // This contains info used when building the body of a function. It is
381 // destroyed when the function is completed.
383 typedef std::vector<Value *> ValueList; // Numbered defs
385 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
386 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
388 static struct PerModuleInfo {
389 Module *CurrentModule;
390 std::map<const Type *, ValueList> Values; // Module level numbered definitions
391 std::map<const Type *,ValueList> LateResolveValues;
392 std::vector<PATypeHolder> Types;
393 std::map<ValID, PATypeHolder> LateResolveTypes;
395 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
396 /// how they were referenced and on which line of the input they came from so
397 /// that we can resolve them later and print error messages as appropriate.
398 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
400 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
401 // references to global values. Global values may be referenced before they
402 // are defined, and if so, the temporary object that they represent is held
403 // here. This is used for forward references of GlobalValues.
405 typedef std::map<std::pair<const PointerType *,
406 ValID>, GlobalValue*> GlobalRefsType;
407 GlobalRefsType GlobalRefs;
410 // If we could not resolve some functions at function compilation time
411 // (calls to functions before they are defined), resolve them now... Types
412 // are resolved when the constant pool has been completely parsed.
414 ResolveDefinitions(LateResolveValues);
418 // Check to make sure that all global value forward references have been
421 if (!GlobalRefs.empty()) {
422 std::string UndefinedReferences = "Unresolved global references exist:\n";
424 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
426 UndefinedReferences += " " + I->first.first->getDescription() + " " +
427 I->first.second.getName() + "\n";
429 GenerateError(UndefinedReferences);
433 // Look for intrinsic functions and CallInst that need to be upgraded
434 for (Module::iterator FI = CurrentModule->begin(),
435 FE = CurrentModule->end(); FI != FE; )
436 UpgradeCallsToIntrinsic(FI++);
438 Values.clear(); // Clear out function local definitions
443 // GetForwardRefForGlobal - Check to see if there is a forward reference
444 // for this global. If so, remove it from the GlobalRefs map and return it.
445 // If not, just return null.
446 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
447 // Check to see if there is a forward reference to this global variable...
448 // if there is, eliminate it and patch the reference to use the new def'n.
449 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
450 GlobalValue *Ret = 0;
451 if (I != GlobalRefs.end()) {
459 static struct PerFunctionInfo {
460 Function *CurrentFunction; // Pointer to current function being created
462 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
463 std::map<const Type*, ValueList> LateResolveValues;
464 bool isDeclare; // Is this function a forward declararation?
465 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
467 /// BBForwardRefs - When we see forward references to basic blocks, keep
468 /// track of them here.
469 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
470 std::vector<BasicBlock*> NumberedBlocks;
473 inline PerFunctionInfo() {
476 Linkage = GlobalValue::ExternalLinkage;
479 inline void FunctionStart(Function *M) {
484 void FunctionDone() {
485 NumberedBlocks.clear();
487 // Any forward referenced blocks left?
488 if (!BBForwardRefs.empty()) {
489 GenerateError("Undefined reference to label " +
490 BBForwardRefs.begin()->first->getName());
494 // Resolve all forward references now.
495 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
497 Values.clear(); // Clear out function local definitions
500 Linkage = GlobalValue::ExternalLinkage;
502 } CurFun; // Info for the current function...
504 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
507 //===----------------------------------------------------------------------===//
508 // Code to handle definitions of all the types
509 //===----------------------------------------------------------------------===//
511 static int InsertValue(Value *V,
512 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
513 if (V->hasName()) return -1; // Is this a numbered definition?
515 // Yes, insert the value into the value table...
516 ValueList &List = ValueTab[V->getType()];
518 return List.size()-1;
521 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
523 case ValID::NumberVal: // Is it a numbered definition?
524 // Module constants occupy the lowest numbered slots...
525 if ((unsigned)D.Num < CurModule.Types.size())
526 return CurModule.Types[(unsigned)D.Num];
528 case ValID::NameVal: // Is it a named definition?
529 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
530 D.destroy(); // Free old strdup'd memory...
535 GenerateError("Internal parser error: Invalid symbol type reference!");
539 // If we reached here, we referenced either a symbol that we don't know about
540 // or an id number that hasn't been read yet. We may be referencing something
541 // forward, so just create an entry to be resolved later and get to it...
543 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
546 if (inFunctionScope()) {
547 if (D.Type == ValID::NameVal) {
548 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
551 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
556 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
557 if (I != CurModule.LateResolveTypes.end())
560 Type *Typ = OpaqueType::get();
561 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
565 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
566 SymbolTable &SymTab =
567 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
568 CurModule.CurrentModule->getSymbolTable();
569 return SymTab.lookup(Ty, Name);
572 // getValNonImprovising - Look up the value specified by the provided type and
573 // the provided ValID. If the value exists and has already been defined, return
574 // it. Otherwise return null.
576 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
577 if (isa<FunctionType>(Ty)) {
578 GenerateError("Functions are not values and "
579 "must be referenced as pointers");
584 case ValID::NumberVal: { // Is it a numbered definition?
585 unsigned Num = (unsigned)D.Num;
587 // Module constants occupy the lowest numbered slots...
588 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
589 if (VI != CurModule.Values.end()) {
590 if (Num < VI->second.size())
591 return VI->second[Num];
592 Num -= VI->second.size();
595 // Make sure that our type is within bounds
596 VI = CurFun.Values.find(Ty);
597 if (VI == CurFun.Values.end()) return 0;
599 // Check that the number is within bounds...
600 if (VI->second.size() <= Num) return 0;
602 return VI->second[Num];
605 case ValID::NameVal: { // Is it a named definition?
606 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
607 if (N == 0) return 0;
609 D.destroy(); // Free old strdup'd memory...
613 // Check to make sure that "Ty" is an integral type, and that our
614 // value will fit into the specified type...
615 case ValID::ConstSIntVal: // Is it a constant pool reference??
616 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
617 GenerateError("Signed integral constant '" +
618 itostr(D.ConstPool64) + "' is invalid for type '" +
619 Ty->getDescription() + "'!");
622 return ConstantInt::get(Ty, D.ConstPool64);
624 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
625 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
626 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
627 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
628 "' is invalid or out of range!");
630 } else { // This is really a signed reference. Transmogrify.
631 return ConstantInt::get(Ty, D.ConstPool64);
634 return ConstantInt::get(Ty, D.UConstPool64);
637 case ValID::ConstFPVal: // Is it a floating point const pool reference?
638 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
639 GenerateError("FP constant invalid for type!!");
642 return ConstantFP::get(Ty, D.ConstPoolFP);
644 case ValID::ConstNullVal: // Is it a null value?
645 if (!isa<PointerType>(Ty)) {
646 GenerateError("Cannot create a a non pointer null!");
649 return ConstantPointerNull::get(cast<PointerType>(Ty));
651 case ValID::ConstUndefVal: // Is it an undef value?
652 return UndefValue::get(Ty);
654 case ValID::ConstZeroVal: // Is it a zero value?
655 return Constant::getNullValue(Ty);
657 case ValID::ConstantVal: // Fully resolved constant?
658 if (D.ConstantValue->getType() != Ty) {
659 GenerateError("Constant expression type different from required type!");
662 return D.ConstantValue;
664 case ValID::InlineAsmVal: { // Inline asm expression
665 const PointerType *PTy = dyn_cast<PointerType>(Ty);
666 const FunctionType *FTy =
667 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
668 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
669 GenerateError("Invalid type for asm constraint string!");
672 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
673 D.IAD->HasSideEffects);
674 D.destroy(); // Free InlineAsmDescriptor.
678 assert(0 && "Unhandled case!");
682 assert(0 && "Unhandled case!");
686 // getVal - This function is identical to getValNonImprovising, except that if a
687 // value is not already defined, it "improvises" by creating a placeholder var
688 // that looks and acts just like the requested variable. When the value is
689 // defined later, all uses of the placeholder variable are replaced with the
692 static Value *getVal(const Type *Ty, const ValID &ID) {
693 if (Ty == Type::LabelTy) {
694 GenerateError("Cannot use a basic block here");
698 // See if the value has already been defined.
699 Value *V = getValNonImprovising(Ty, ID);
701 if (TriggerError) return 0;
703 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
704 GenerateError("Invalid use of a composite type!");
708 // If we reached here, we referenced either a symbol that we don't know about
709 // or an id number that hasn't been read yet. We may be referencing something
710 // forward, so just create an entry to be resolved later and get to it...
712 V = new Argument(Ty);
714 // Remember where this forward reference came from. FIXME, shouldn't we try
715 // to recycle these things??
716 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
719 if (inFunctionScope())
720 InsertValue(V, CurFun.LateResolveValues);
722 InsertValue(V, CurModule.LateResolveValues);
726 /// getBBVal - This is used for two purposes:
727 /// * If isDefinition is true, a new basic block with the specified ID is being
729 /// * If isDefinition is true, this is a reference to a basic block, which may
730 /// or may not be a forward reference.
732 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
733 assert(inFunctionScope() && "Can't get basic block at global scope!");
739 GenerateError("Illegal label reference " + ID.getName());
741 case ValID::NumberVal: // Is it a numbered definition?
742 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
743 CurFun.NumberedBlocks.resize(ID.Num+1);
744 BB = CurFun.NumberedBlocks[ID.Num];
746 case ValID::NameVal: // Is it a named definition?
748 if (Value *N = CurFun.CurrentFunction->
749 getSymbolTable().lookup(Type::LabelTy, Name))
750 BB = cast<BasicBlock>(N);
754 // See if the block has already been defined.
756 // If this is the definition of the block, make sure the existing value was
757 // just a forward reference. If it was a forward reference, there will be
758 // an entry for it in the PlaceHolderInfo map.
759 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
760 // The existing value was a definition, not a forward reference.
761 GenerateError("Redefinition of label " + ID.getName());
765 ID.destroy(); // Free strdup'd memory.
769 // Otherwise this block has not been seen before.
770 BB = new BasicBlock("", CurFun.CurrentFunction);
771 if (ID.Type == ValID::NameVal) {
772 BB->setName(ID.Name);
774 CurFun.NumberedBlocks[ID.Num] = BB;
777 // If this is not a definition, keep track of it so we can use it as a forward
780 // Remember where this forward reference came from.
781 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
783 // The forward declaration could have been inserted anywhere in the
784 // function: insert it into the correct place now.
785 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
786 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
793 //===----------------------------------------------------------------------===//
794 // Code to handle forward references in instructions
795 //===----------------------------------------------------------------------===//
797 // This code handles the late binding needed with statements that reference
798 // values not defined yet... for example, a forward branch, or the PHI node for
801 // This keeps a table (CurFun.LateResolveValues) of all such forward references
802 // and back patchs after we are done.
805 // ResolveDefinitions - If we could not resolve some defs at parsing
806 // time (forward branches, phi functions for loops, etc...) resolve the
810 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
811 std::map<const Type*,ValueList> *FutureLateResolvers) {
812 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
813 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
814 E = LateResolvers.end(); LRI != E; ++LRI) {
815 ValueList &List = LRI->second;
816 while (!List.empty()) {
817 Value *V = List.back();
820 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
821 CurModule.PlaceHolderInfo.find(V);
822 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
824 ValID &DID = PHI->second.first;
826 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
830 V->replaceAllUsesWith(TheRealValue);
832 CurModule.PlaceHolderInfo.erase(PHI);
833 } else if (FutureLateResolvers) {
834 // Functions have their unresolved items forwarded to the module late
836 InsertValue(V, *FutureLateResolvers);
838 if (DID.Type == ValID::NameVal) {
839 GenerateError("Reference to an invalid definition: '" +DID.getName()+
840 "' of type '" + V->getType()->getDescription() + "'",
844 GenerateError("Reference to an invalid definition: #" +
845 itostr(DID.Num) + " of type '" +
846 V->getType()->getDescription() + "'",
854 LateResolvers.clear();
857 // ResolveTypeTo - A brand new type was just declared. This means that (if
858 // name is not null) things referencing Name can be resolved. Otherwise, things
859 // refering to the number can be resolved. Do this now.
861 static void ResolveTypeTo(char *Name, const Type *ToTy) {
863 if (Name) D = ValID::create(Name);
864 else D = ValID::create((int)CurModule.Types.size());
866 std::map<ValID, PATypeHolder>::iterator I =
867 CurModule.LateResolveTypes.find(D);
868 if (I != CurModule.LateResolveTypes.end()) {
869 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
870 CurModule.LateResolveTypes.erase(I);
874 // setValueName - Set the specified value to the name given. The name may be
875 // null potentially, in which case this is a noop. The string passed in is
876 // assumed to be a malloc'd string buffer, and is free'd by this function.
878 static void setValueName(Value *V, char *NameStr) {
880 std::string Name(NameStr); // Copy string
881 free(NameStr); // Free old string
883 if (V->getType() == Type::VoidTy) {
884 GenerateError("Can't assign name '" + Name+"' to value with void type!");
888 assert(inFunctionScope() && "Must be in function scope!");
889 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
890 if (ST.lookup(V->getType(), Name)) {
891 GenerateError("Redefinition of value named '" + Name + "' in the '" +
892 V->getType()->getDescription() + "' type plane!");
901 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
902 /// this is a declaration, otherwise it is a definition.
903 static GlobalVariable *
904 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
905 bool isConstantGlobal, const Type *Ty,
906 Constant *Initializer) {
907 if (isa<FunctionType>(Ty)) {
908 GenerateError("Cannot declare global vars of function type!");
912 const PointerType *PTy = PointerType::get(Ty);
916 Name = NameStr; // Copy string
917 free(NameStr); // Free old string
920 // See if this global value was forward referenced. If so, recycle the
924 ID = ValID::create((char*)Name.c_str());
926 ID = ValID::create((int)CurModule.Values[PTy].size());
929 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
930 // Move the global to the end of the list, from whereever it was
931 // previously inserted.
932 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
933 CurModule.CurrentModule->getGlobalList().remove(GV);
934 CurModule.CurrentModule->getGlobalList().push_back(GV);
935 GV->setInitializer(Initializer);
936 GV->setLinkage(Linkage);
937 GV->setConstant(isConstantGlobal);
938 InsertValue(GV, CurModule.Values);
942 // If this global has a name, check to see if there is already a definition
943 // of this global in the module. If so, merge as appropriate. Note that
944 // this is really just a hack around problems in the CFE. :(
946 // We are a simple redefinition of a value, check to see if it is defined
947 // the same as the old one.
948 if (GlobalVariable *EGV =
949 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
950 // We are allowed to redefine a global variable in two circumstances:
951 // 1. If at least one of the globals is uninitialized or
952 // 2. If both initializers have the same value.
954 if (!EGV->hasInitializer() || !Initializer ||
955 EGV->getInitializer() == Initializer) {
957 // Make sure the existing global version gets the initializer! Make
958 // sure that it also gets marked const if the new version is.
959 if (Initializer && !EGV->hasInitializer())
960 EGV->setInitializer(Initializer);
961 if (isConstantGlobal)
962 EGV->setConstant(true);
963 EGV->setLinkage(Linkage);
967 GenerateError("Redefinition of global variable named '" + Name +
968 "' in the '" + Ty->getDescription() + "' type plane!");
973 // Otherwise there is no existing GV to use, create one now.
975 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
976 CurModule.CurrentModule);
977 InsertValue(GV, CurModule.Values);
981 // setTypeName - Set the specified type to the name given. The name may be
982 // null potentially, in which case this is a noop. The string passed in is
983 // assumed to be a malloc'd string buffer, and is freed by this function.
985 // This function returns true if the type has already been defined, but is
986 // allowed to be redefined in the specified context. If the name is a new name
987 // for the type plane, it is inserted and false is returned.
988 static bool setTypeName(const Type *T, char *NameStr) {
989 assert(!inFunctionScope() && "Can't give types function-local names!");
990 if (NameStr == 0) return false;
992 std::string Name(NameStr); // Copy string
993 free(NameStr); // Free old string
995 // We don't allow assigning names to void type
996 if (T == Type::VoidTy) {
997 GenerateError("Can't assign name '" + Name + "' to the void type!");
1001 // Set the type name, checking for conflicts as we do so.
1002 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1004 if (AlreadyExists) { // Inserting a name that is already defined???
1005 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1006 assert(Existing && "Conflict but no matching type?");
1008 // There is only one case where this is allowed: when we are refining an
1009 // opaque type. In this case, Existing will be an opaque type.
1010 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1011 // We ARE replacing an opaque type!
1012 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1016 // Otherwise, this is an attempt to redefine a type. That's okay if
1017 // the redefinition is identical to the original. This will be so if
1018 // Existing and T point to the same Type object. In this one case we
1019 // allow the equivalent redefinition.
1020 if (Existing == T) return true; // Yes, it's equal.
1022 // Any other kind of (non-equivalent) redefinition is an error.
1023 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1024 T->getDescription() + "' type plane!");
1030 //===----------------------------------------------------------------------===//
1031 // Code for handling upreferences in type names...
1034 // TypeContains - Returns true if Ty directly contains E in it.
1036 static bool TypeContains(const Type *Ty, const Type *E) {
1037 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1038 E) != Ty->subtype_end();
1042 struct UpRefRecord {
1043 // NestingLevel - The number of nesting levels that need to be popped before
1044 // this type is resolved.
1045 unsigned NestingLevel;
1047 // LastContainedTy - This is the type at the current binding level for the
1048 // type. Every time we reduce the nesting level, this gets updated.
1049 const Type *LastContainedTy;
1051 // UpRefTy - This is the actual opaque type that the upreference is
1052 // represented with.
1053 OpaqueType *UpRefTy;
1055 UpRefRecord(unsigned NL, OpaqueType *URTy)
1056 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1060 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1061 static std::vector<UpRefRecord> UpRefs;
1063 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1064 /// called. It loops through the UpRefs vector, which is a list of the
1065 /// currently active types. For each type, if the up reference is contained in
1066 /// the newly completed type, we decrement the level count. When the level
1067 /// count reaches zero, the upreferenced type is the type that is passed in:
1068 /// thus we can complete the cycle.
1070 static PATypeHolder HandleUpRefs(const Type *ty) {
1071 // If Ty isn't abstract, or if there are no up-references in it, then there is
1072 // nothing to resolve here.
1073 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1075 PATypeHolder Ty(ty);
1076 UR_OUT("Type '" << Ty->getDescription() <<
1077 "' newly formed. Resolving upreferences.\n" <<
1078 UpRefs.size() << " upreferences active!\n");
1080 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1081 // to zero), we resolve them all together before we resolve them to Ty. At
1082 // the end of the loop, if there is anything to resolve to Ty, it will be in
1084 OpaqueType *TypeToResolve = 0;
1086 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1087 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1088 << UpRefs[i].second->getDescription() << ") = "
1089 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1090 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1091 // Decrement level of upreference
1092 unsigned Level = --UpRefs[i].NestingLevel;
1093 UpRefs[i].LastContainedTy = Ty;
1094 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1095 if (Level == 0) { // Upreference should be resolved!
1096 if (!TypeToResolve) {
1097 TypeToResolve = UpRefs[i].UpRefTy;
1099 UR_OUT(" * Resolving upreference for "
1100 << UpRefs[i].second->getDescription() << "\n";
1101 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1102 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1103 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1104 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1106 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1107 --i; // Do not skip the next element...
1112 if (TypeToResolve) {
1113 UR_OUT(" * Resolving upreference for "
1114 << UpRefs[i].second->getDescription() << "\n";
1115 std::string OldName = TypeToResolve->getDescription());
1116 TypeToResolve->refineAbstractTypeTo(Ty);
1122 /// This function is used to obtain the correct opcode for an instruction when
1123 /// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both
1124 /// an opcode and an "obsolete" flag. These are generated by the lexer and
1125 /// the "obsolete" member will be true when the lexer encounters the token for
1126 /// an obsolete opcode. For example, "div" was replaced by [usf]div but we need
1127 /// to maintain backwards compatibility for asm files that still have the "div"
1128 /// instruction. This function handles converting div -> [usf]div appropriately.
1129 /// @brief Convert obsolete BinaryOps opcodes to new values
1131 sanitizeOpcode(OpcodeInfo<Instruction::BinaryOps> &OI, const Type *Ty)
1133 // If its not obsolete, don't do anything
1137 // If its a packed type we want to use the element type
1138 if (const PackedType *PTy = dyn_cast<PackedType>(Ty))
1139 Ty = PTy->getElementType();
1141 // Depending on the opcode ..
1142 switch (OI.opcode) {
1144 GenerateError("Invalid obsolete opCode (check Lexer.l)");
1146 case Instruction::UDiv:
1147 // Handle cases where the opcode needs to change
1148 if (Ty->isFloatingPoint())
1149 OI.opcode = Instruction::FDiv;
1150 else if (Ty->isSigned())
1151 OI.opcode = Instruction::SDiv;
1153 case Instruction::URem:
1154 if (Ty->isFloatingPoint())
1155 OI.opcode = Instruction::FRem;
1156 else if (Ty->isSigned())
1157 OI.opcode = Instruction::SRem;
1160 // Its not obsolete any more, we fixed it.
1161 OI.obsolete = false;
1164 /// This function is similar to the previous overload of sanitizeOpcode but
1165 /// operates on Instruction::OtherOps instead of Instruction::BinaryOps.
1166 /// @brief Convert obsolete OtherOps opcodes to new values
1168 sanitizeOpcode(OpcodeInfo<Instruction::OtherOps> &OI, const Type *Ty)
1170 // If its not obsolete, don't do anything
1174 switch (OI.opcode) {
1176 GenerateError("Invalid obsolete opcode (check Lexer.l)");
1178 case Instruction::LShr:
1180 OI.opcode = Instruction::AShr;
1183 // Its not obsolete any more, we fixed it.
1184 OI.obsolete = false;
1187 // common code from the two 'RunVMAsmParser' functions
1188 static Module* RunParser(Module * M) {
1190 llvmAsmlineno = 1; // Reset the current line number...
1191 ObsoleteVarArgs = false;
1193 CurModule.CurrentModule = M;
1195 // Check to make sure the parser succeeded
1198 delete ParserResult;
1202 // Check to make sure that parsing produced a result
1206 // Reset ParserResult variable while saving its value for the result.
1207 Module *Result = ParserResult;
1210 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1213 if ((F = Result->getNamedFunction("llvm.va_start"))
1214 && F->getFunctionType()->getNumParams() == 0)
1215 ObsoleteVarArgs = true;
1216 if((F = Result->getNamedFunction("llvm.va_copy"))
1217 && F->getFunctionType()->getNumParams() == 1)
1218 ObsoleteVarArgs = true;
1221 if (ObsoleteVarArgs && NewVarArgs) {
1223 "This file is corrupt: it uses both new and old style varargs");
1227 if(ObsoleteVarArgs) {
1228 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1229 if (F->arg_size() != 0) {
1230 GenerateError("Obsolete va_start takes 0 argument!");
1236 //bar = alloca typeof(foo)
1240 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1241 const Type* ArgTy = F->getFunctionType()->getReturnType();
1242 const Type* ArgTyPtr = PointerType::get(ArgTy);
1243 Function* NF = Result->getOrInsertFunction("llvm.va_start",
1244 RetTy, ArgTyPtr, (Type *)0);
1246 while (!F->use_empty()) {
1247 CallInst* CI = cast<CallInst>(F->use_back());
1248 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1249 new CallInst(NF, bar, "", CI);
1250 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1251 CI->replaceAllUsesWith(foo);
1252 CI->getParent()->getInstList().erase(CI);
1254 Result->getFunctionList().erase(F);
1257 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1258 if(F->arg_size() != 1) {
1259 GenerateError("Obsolete va_end takes 1 argument!");
1265 //bar = alloca 1 of typeof(foo)
1267 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1268 const Type* ArgTy = F->getFunctionType()->getParamType(0);
1269 const Type* ArgTyPtr = PointerType::get(ArgTy);
1270 Function* NF = Result->getOrInsertFunction("llvm.va_end",
1271 RetTy, ArgTyPtr, (Type *)0);
1273 while (!F->use_empty()) {
1274 CallInst* CI = cast<CallInst>(F->use_back());
1275 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1276 new StoreInst(CI->getOperand(1), bar, CI);
1277 new CallInst(NF, bar, "", CI);
1278 CI->getParent()->getInstList().erase(CI);
1280 Result->getFunctionList().erase(F);
1283 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1284 if(F->arg_size() != 1) {
1285 GenerateError("Obsolete va_copy takes 1 argument!");
1290 //a = alloca 1 of typeof(foo)
1291 //b = alloca 1 of typeof(foo)
1296 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1297 const Type* ArgTy = F->getFunctionType()->getReturnType();
1298 const Type* ArgTyPtr = PointerType::get(ArgTy);
1299 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
1300 RetTy, ArgTyPtr, ArgTyPtr,
1303 while (!F->use_empty()) {
1304 CallInst* CI = cast<CallInst>(F->use_back());
1305 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1306 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1307 new StoreInst(CI->getOperand(1), b, CI);
1308 new CallInst(NF, a, b, "", CI);
1309 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1310 CI->replaceAllUsesWith(foo);
1311 CI->getParent()->getInstList().erase(CI);
1313 Result->getFunctionList().erase(F);
1320 //===----------------------------------------------------------------------===//
1321 // RunVMAsmParser - Define an interface to this parser
1322 //===----------------------------------------------------------------------===//
1324 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1327 CurFilename = Filename;
1328 return RunParser(new Module(CurFilename));
1331 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1332 set_scan_string(AsmString);
1334 CurFilename = "from_memory";
1336 return RunParser(new Module (CurFilename));
1338 return RunParser(M);
1344 /* Enabling traces. */
1349 /* Enabling verbose error messages. */
1350 #ifdef YYERROR_VERBOSE
1351 # undef YYERROR_VERBOSE
1352 # define YYERROR_VERBOSE 1
1354 # define YYERROR_VERBOSE 0
1357 /* Enabling the token table. */
1358 #ifndef YYTOKEN_TABLE
1359 # define YYTOKEN_TABLE 0
1362 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1363 #line 1038 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
1364 typedef union YYSTYPE {
1365 llvm::Module *ModuleVal;
1366 llvm::Function *FunctionVal;
1367 std::pair<TypeInfo, char*> *ArgVal;
1368 llvm::BasicBlock *BasicBlockVal;
1369 llvm::TerminatorInst *TermInstVal;
1370 llvm::Instruction *InstVal;
1375 std::vector<std::pair<TypeInfo,char*> >*ArgList;
1376 std::vector<ValueInfo> *ValueList;
1377 std::list<TypeInfo> *TypeList;
1378 // Represent the RHS of PHI node
1379 std::list<std::pair<llvm::Value*, llvm::BasicBlock*> > *PHIList;
1380 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1381 std::vector<ConstInfo> *ConstVector;
1383 llvm::GlobalValue::LinkageTypes Linkage;
1391 char *StrVal; // This memory is strdup'd!
1392 llvm::ValID ValIDVal; // strdup'd memory maybe!
1394 BinaryOpInfo BinaryOpVal;
1395 TermOpInfo TermOpVal;
1397 CastOpInfo CastOpVal;
1398 OtherOpInfo OtherOpVal;
1399 llvm::Module::Endianness Endianness;
1401 /* Line 196 of yacc.c. */
1402 #line 1403 "llvmAsmParser.tab.c"
1403 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1404 # define YYSTYPE_IS_DECLARED 1
1405 # define YYSTYPE_IS_TRIVIAL 1
1410 /* Copy the second part of user declarations. */
1413 /* Line 219 of yacc.c. */
1414 #line 1415 "llvmAsmParser.tab.c"
1416 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1417 # define YYSIZE_T __SIZE_TYPE__
1419 #if ! defined (YYSIZE_T) && defined (size_t)
1420 # define YYSIZE_T size_t
1422 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1423 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1424 # define YYSIZE_T size_t
1426 #if ! defined (YYSIZE_T)
1427 # define YYSIZE_T unsigned int
1433 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1434 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1438 # define YY_(msgid) msgid
1442 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1444 /* The parser invokes alloca or malloc; define the necessary symbols. */
1446 # ifdef YYSTACK_USE_ALLOCA
1447 # if YYSTACK_USE_ALLOCA
1449 # define YYSTACK_ALLOC __builtin_alloca
1451 # define YYSTACK_ALLOC alloca
1452 # if defined (__STDC__) || defined (__cplusplus)
1453 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1454 # define YYINCLUDED_STDLIB_H
1460 # ifdef YYSTACK_ALLOC
1461 /* Pacify GCC's `empty if-body' warning. */
1462 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1463 # ifndef YYSTACK_ALLOC_MAXIMUM
1464 /* The OS might guarantee only one guard page at the bottom of the stack,
1465 and a page size can be as small as 4096 bytes. So we cannot safely
1466 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1467 to allow for a few compiler-allocated temporary stack slots. */
1468 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1471 # define YYSTACK_ALLOC YYMALLOC
1472 # define YYSTACK_FREE YYFREE
1473 # ifndef YYSTACK_ALLOC_MAXIMUM
1474 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1480 # define YYMALLOC malloc
1481 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1482 && (defined (__STDC__) || defined (__cplusplus)))
1483 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1487 # define YYFREE free
1488 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1489 && (defined (__STDC__) || defined (__cplusplus)))
1490 void free (void *); /* INFRINGES ON USER NAME SPACE */
1497 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1500 #if (! defined (yyoverflow) \
1501 && (! defined (__cplusplus) \
1502 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1504 /* A type that is properly aligned for any stack member. */
1511 /* The size of the maximum gap between one aligned stack and the next. */
1512 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1514 /* The size of an array large to enough to hold all stacks, each with
1516 # define YYSTACK_BYTES(N) \
1517 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1518 + YYSTACK_GAP_MAXIMUM)
1520 /* Copy COUNT objects from FROM to TO. The source and destination do
1523 # if defined (__GNUC__) && 1 < __GNUC__
1524 # define YYCOPY(To, From, Count) \
1525 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1527 # define YYCOPY(To, From, Count) \
1531 for (yyi = 0; yyi < (Count); yyi++) \
1532 (To)[yyi] = (From)[yyi]; \
1538 /* Relocate STACK from its old location to the new one. The
1539 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1540 elements in the stack, and YYPTR gives the new location of the
1541 stack. Advance YYPTR to a properly aligned location for the next
1543 # define YYSTACK_RELOCATE(Stack) \
1546 YYSIZE_T yynewbytes; \
1547 YYCOPY (&yyptr->Stack, Stack, yysize); \
1548 Stack = &yyptr->Stack; \
1549 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1550 yyptr += yynewbytes / sizeof (*yyptr); \
1556 #if defined (__STDC__) || defined (__cplusplus)
1557 typedef signed char yysigned_char;
1559 typedef short int yysigned_char;
1562 /* YYFINAL -- State number of the termination state. */
1564 /* YYLAST -- Last index in YYTABLE. */
1567 /* YYNTOKENS -- Number of terminals. */
1568 #define YYNTOKENS 139
1569 /* YYNNTS -- Number of nonterminals. */
1571 /* YYNRULES -- Number of rules. */
1572 #define YYNRULES 269
1573 /* YYNRULES -- Number of states. */
1574 #define YYNSTATES 534
1576 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1577 #define YYUNDEFTOK 2
1578 #define YYMAXUTOK 379
1580 #define YYTRANSLATE(YYX) \
1581 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1583 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1584 static const unsigned char yytranslate[] =
1586 0, 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 128, 129, 137, 2, 126, 2, 2, 2, 2, 2,
1591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1592 133, 125, 134, 2, 2, 2, 2, 2, 2, 2,
1593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1595 2, 130, 127, 132, 2, 2, 2, 2, 2, 138,
1596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1598 131, 2, 2, 135, 2, 136, 2, 2, 2, 2,
1599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1611 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1612 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1613 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1614 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1615 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1616 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1617 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1618 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1619 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1620 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1621 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1622 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1623 115, 116, 117, 118, 119, 120, 121, 122, 123, 124
1627 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1629 static const unsigned short int yyprhs[] =
1631 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1632 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1633 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1634 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1635 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1636 99, 101, 104, 105, 107, 109, 111, 113, 115, 117,
1637 119, 120, 121, 123, 125, 127, 129, 131, 133, 136,
1638 137, 140, 141, 145, 148, 149, 151, 152, 156, 158,
1639 161, 163, 165, 167, 169, 171, 173, 175, 177, 179,
1640 181, 183, 185, 187, 189, 191, 193, 195, 197, 199,
1641 201, 203, 206, 211, 217, 223, 227, 230, 233, 235,
1642 239, 241, 245, 247, 248, 253, 257, 261, 266, 271,
1643 275, 278, 281, 284, 287, 290, 293, 296, 299, 302,
1644 305, 312, 318, 327, 334, 341, 348, 355, 362, 371,
1645 380, 384, 386, 388, 390, 392, 395, 398, 403, 406,
1646 408, 413, 416, 421, 422, 430, 431, 439, 440, 448,
1647 449, 457, 461, 466, 467, 469, 471, 473, 477, 481,
1648 485, 489, 493, 497, 499, 500, 502, 504, 506, 507,
1649 510, 514, 516, 518, 522, 524, 525, 534, 536, 538,
1650 542, 544, 546, 549, 550, 552, 554, 555, 560, 561,
1651 563, 565, 567, 569, 571, 573, 575, 577, 579, 583,
1652 585, 591, 593, 595, 597, 599, 602, 605, 608, 612,
1653 615, 616, 618, 621, 624, 628, 638, 648, 657, 671,
1654 673, 675, 682, 688, 691, 698, 706, 708, 712, 714,
1655 715, 718, 720, 726, 732, 738, 741, 746, 751, 758,
1656 763, 768, 773, 778, 785, 792, 795, 803, 805, 808,
1657 809, 811, 812, 816, 823, 827, 834, 837, 842, 849
1660 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1661 static const short int yyrhs[] =
1663 171, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1664 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1665 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1666 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1667 -1, 93, -1, 94, -1, 95, -1, 102, -1, 103,
1668 -1, 104, -1, 105, -1, 106, -1, 107, -1, 108,
1669 -1, 109, -1, 110, -1, 111, -1, 112, -1, 113,
1670 -1, 116, -1, 117, -1, 118, -1, 16, -1, 14,
1671 -1, 12, -1, 10, -1, 17, -1, 15, -1, 13,
1672 -1, 11, -1, 147, -1, 148, -1, 18, -1, 19,
1673 -1, 183, 125, -1, -1, 41, -1, 42, -1, 43,
1674 -1, 44, -1, 45, -1, 46, -1, 47, -1, -1,
1675 -1, 65, -1, 66, -1, 67, -1, 68, -1, 69,
1676 -1, 70, -1, 64, 4, -1, -1, 57, 4, -1,
1677 -1, 126, 57, 4, -1, 34, 24, -1, -1, 156,
1678 -1, -1, 126, 159, 158, -1, 156, -1, 57, 4,
1679 -1, 162, -1, 8, -1, 164, -1, 8, -1, 164,
1680 -1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
1681 -1, 14, -1, 15, -1, 16, -1, 17, -1, 18,
1682 -1, 19, -1, 20, -1, 21, -1, 48, -1, 163,
1683 -1, 198, -1, 127, 4, -1, 161, 128, 166, 129,
1684 -1, 130, 4, 131, 164, 132, -1, 133, 4, 131,
1685 164, 134, -1, 135, 165, 136, -1, 135, 136, -1,
1686 164, 137, -1, 164, -1, 165, 126, 164, -1, 165,
1687 -1, 165, 126, 37, -1, 37, -1, -1, 162, 130,
1688 169, 132, -1, 162, 130, 132, -1, 162, 138, 24,
1689 -1, 162, 133, 169, 134, -1, 162, 135, 169, 136,
1690 -1, 162, 135, 136, -1, 162, 38, -1, 162, 39,
1691 -1, 162, 198, -1, 162, 168, -1, 162, 26, -1,
1692 147, 141, -1, 148, 4, -1, 9, 27, -1, 9,
1693 28, -1, 150, 7, -1, 145, 128, 167, 36, 162,
1694 129, -1, 101, 128, 167, 212, 129, -1, 115, 128,
1695 167, 126, 167, 126, 167, 129, -1, 142, 128, 167,
1696 126, 167, 129, -1, 143, 128, 167, 126, 167, 129,
1697 -1, 144, 128, 167, 126, 167, 129, -1, 146, 128,
1698 167, 126, 167, 129, -1, 120, 128, 167, 126, 167,
1699 129, -1, 121, 128, 167, 126, 167, 126, 167, 129,
1700 -1, 122, 128, 167, 126, 167, 126, 167, 129, -1,
1701 169, 126, 167, -1, 167, -1, 32, -1, 33, -1,
1702 172, -1, 172, 192, -1, 172, 194, -1, 172, 62,
1703 61, 178, -1, 172, 25, -1, 173, -1, 173, 151,
1704 20, 160, -1, 173, 194, -1, 173, 62, 61, 178,
1705 -1, -1, 173, 151, 152, 170, 167, 174, 158, -1,
1706 -1, 173, 151, 50, 170, 162, 175, 158, -1, -1,
1707 173, 151, 45, 170, 162, 176, 158, -1, -1, 173,
1708 151, 47, 170, 162, 177, 158, -1, 173, 51, 180,
1709 -1, 173, 58, 125, 181, -1, -1, 24, -1, 56,
1710 -1, 55, -1, 53, 125, 179, -1, 54, 125, 4,
1711 -1, 52, 125, 24, -1, 71, 125, 24, -1, 130,
1712 182, 132, -1, 182, 126, 24, -1, 24, -1, -1,
1713 22, -1, 24, -1, 183, -1, -1, 162, 184, -1,
1714 186, 126, 185, -1, 185, -1, 186, -1, 186, 126,
1715 37, -1, 37, -1, -1, 153, 160, 183, 128, 187,
1716 129, 157, 154, -1, 29, -1, 135, -1, 152, 188,
1717 189, -1, 30, -1, 136, -1, 201, 191, -1, -1,
1718 45, -1, 47, -1, -1, 31, 195, 193, 188, -1,
1719 -1, 63, -1, 3, -1, 4, -1, 7, -1, 27,
1720 -1, 28, -1, 38, -1, 39, -1, 26, -1, 133,
1721 169, 134, -1, 168, -1, 61, 196, 24, 126, 24,
1722 -1, 140, -1, 183, -1, 198, -1, 197, -1, 162,
1723 199, -1, 201, 202, -1, 190, 202, -1, 203, 151,
1724 204, -1, 203, 206, -1, -1, 23, -1, 72, 200,
1725 -1, 72, 8, -1, 73, 21, 199, -1, 73, 9,
1726 199, 126, 21, 199, 126, 21, 199, -1, 74, 149,
1727 199, 126, 21, 199, 130, 205, 132, -1, 74, 149,
1728 199, 126, 21, 199, 130, 132, -1, 75, 153, 160,
1729 199, 128, 209, 129, 36, 21, 199, 76, 21, 199,
1730 -1, 76, -1, 77, -1, 205, 149, 197, 126, 21,
1731 199, -1, 149, 197, 126, 21, 199, -1, 151, 211,
1732 -1, 162, 130, 199, 126, 199, 132, -1, 207, 126,
1733 130, 199, 126, 199, 132, -1, 200, -1, 208, 126,
1734 200, -1, 208, -1, -1, 60, 59, -1, 59, -1,
1735 142, 162, 199, 126, 199, -1, 143, 162, 199, 126,
1736 199, -1, 144, 162, 199, 126, 199, -1, 49, 200,
1737 -1, 146, 200, 126, 200, -1, 145, 200, 36, 162,
1738 -1, 115, 200, 126, 200, 126, 200, -1, 119, 200,
1739 126, 162, -1, 123, 200, 126, 162, -1, 124, 200,
1740 126, 162, -1, 120, 200, 126, 200, -1, 121, 200,
1741 126, 200, 126, 200, -1, 122, 200, 126, 200, 126,
1742 200, -1, 114, 207, -1, 210, 153, 160, 199, 128,
1743 209, 129, -1, 214, -1, 126, 208, -1, -1, 35,
1744 -1, -1, 96, 162, 155, -1, 96, 162, 126, 15,
1745 199, 155, -1, 97, 162, 155, -1, 97, 162, 126,
1746 15, 199, 155, -1, 98, 200, -1, 213, 99, 162,
1747 199, -1, 213, 100, 200, 126, 162, 199, -1, 101,
1751 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1752 static const unsigned short int yyrline[] =
1754 0, 1164, 1164, 1165, 1173, 1174, 1184, 1184, 1184, 1184,
1755 1184, 1184, 1184, 1184, 1184, 1185, 1185, 1185, 1186, 1186,
1756 1186, 1186, 1186, 1186, 1187, 1187, 1187, 1187, 1187, 1187,
1757 1188, 1188, 1188, 1188, 1188, 1188, 1189, 1189, 1189, 1193,
1758 1193, 1193, 1193, 1194, 1194, 1194, 1194, 1195, 1195, 1196,
1759 1196, 1199, 1203, 1208, 1209, 1210, 1211, 1212, 1213, 1214,
1760 1215, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1233,
1761 1234, 1240, 1241, 1249, 1257, 1258, 1263, 1264, 1265, 1270,
1762 1284, 1284, 1288, 1288, 1293, 1304, 1304, 1304, 1304, 1304,
1763 1304, 1304, 1305, 1305, 1305, 1305, 1305, 1305, 1306, 1311,
1764 1315, 1324, 1333, 1348, 1355, 1369, 1380, 1385, 1397, 1402,
1765 1408, 1409, 1415, 1421, 1432, 1463, 1478, 1509, 1539, 1564,
1766 1578, 1589, 1595, 1657, 1664, 1674, 1681, 1688, 1693, 1698,
1767 1707, 1733, 1755, 1764, 1793, 1805, 1812, 1824, 1831, 1838,
1768 1848, 1852, 1860, 1860, 1870, 1878, 1883, 1887, 1891, 1895,
1769 1910, 1932, 1935, 1938, 1938, 1946, 1946, 1955, 1955, 1964,
1770 1964, 1974, 1977, 1980, 1984, 1997, 1998, 2000, 2004, 2013,
1771 2017, 2022, 2024, 2029, 2034, 2043, 2043, 2044, 2044, 2046,
1772 2053, 2059, 2066, 2070, 2078, 2086, 2091, 2185, 2185, 2187,
1773 2195, 2195, 2197, 2202, 2203, 2204, 2206, 2206, 2216, 2220,
1774 2225, 2229, 2233, 2237, 2241, 2245, 2249, 2253, 2257, 2280,
1775 2284, 2298, 2302, 2308, 2308, 2314, 2321, 2325, 2334, 2345,
1776 2354, 2366, 2379, 2383, 2387, 2392, 2401, 2420, 2429, 2494,
1777 2498, 2505, 2516, 2529, 2538, 2547, 2557, 2561, 2568, 2571,
1778 2575, 2579, 2584, 2606, 2621, 2635, 2648, 2659, 2685, 2693,
1779 2699, 2719, 2742, 2748, 2754, 2760, 2775, 2848, 2855, 2858,
1780 2863, 2867, 2874, 2879, 2885, 2890, 2896, 2904, 2916, 2931
1784 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1785 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1786 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1787 static const char *const yytname[] =
1789 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1790 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1791 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1792 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1793 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1794 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1795 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1796 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1797 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1798 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1799 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1800 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1801 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1802 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1803 "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC",
1804 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1805 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1806 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR",
1807 "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1808 "VAARG_old", "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['",
1809 "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept",
1810 "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps",
1811 "CastOps", "ShiftOps", "SIntType", "UIntType", "IntType", "FPType",
1812 "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign",
1813 "SectionString", "OptSection", "GlobalVarAttributes",
1814 "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType",
1815 "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr",
1816 "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1",
1817 "@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition",
1818 "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal",
1819 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1820 "END", "Function", "FnDeclareLinkage", "FunctionProto", "@5",
1821 "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1822 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1823 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList",
1824 "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile",
1830 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1832 static const unsigned short int yytoknum[] =
1834 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1835 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1836 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1837 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1838 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1839 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1840 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1841 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1842 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1843 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1844 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1845 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1846 375, 376, 377, 378, 379, 61, 44, 92, 40, 41,
1847 91, 120, 93, 60, 62, 123, 125, 42, 99
1851 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1852 static const unsigned char yyr1[] =
1854 0, 139, 140, 140, 141, 141, 142, 142, 142, 142,
1855 142, 142, 142, 142, 142, 143, 143, 143, 144, 144,
1856 144, 144, 144, 144, 145, 145, 145, 145, 145, 145,
1857 145, 145, 145, 145, 145, 145, 146, 146, 146, 147,
1858 147, 147, 147, 148, 148, 148, 148, 149, 149, 150,
1859 150, 151, 151, 152, 152, 152, 152, 152, 152, 152,
1860 152, 153, 153, 153, 153, 153, 153, 153, 153, 154,
1861 154, 155, 155, 156, 157, 157, 158, 158, 159, 159,
1862 160, 160, 161, 161, 162, 163, 163, 163, 163, 163,
1863 163, 163, 163, 163, 163, 163, 163, 163, 164, 164,
1864 164, 164, 164, 164, 164, 164, 164, 164, 165, 165,
1865 166, 166, 166, 166, 167, 167, 167, 167, 167, 167,
1866 167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
1867 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1868 169, 169, 170, 170, 171, 172, 172, 172, 172, 172,
1869 173, 173, 173, 174, 173, 175, 173, 176, 173, 177,
1870 173, 173, 173, 173, 178, 179, 179, 180, 180, 180,
1871 180, 181, 182, 182, 182, 183, 183, 184, 184, 185,
1872 186, 186, 187, 187, 187, 187, 188, 189, 189, 190,
1873 191, 191, 192, 193, 193, 193, 195, 194, 196, 196,
1874 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1875 197, 198, 198, 199, 199, 200, 201, 201, 202, 203,
1876 203, 203, 204, 204, 204, 204, 204, 204, 204, 204,
1877 204, 205, 205, 206, 207, 207, 208, 208, 209, 209,
1878 210, 210, 211, 211, 211, 211, 211, 211, 211, 211,
1879 211, 211, 211, 211, 211, 211, 211, 211, 212, 212,
1880 213, 213, 214, 214, 214, 214, 214, 214, 214, 214
1883 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1884 static const unsigned char yyr2[] =
1886 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1887 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1888 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1889 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1890 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1891 1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1892 0, 0, 1, 1, 1, 1, 1, 1, 2, 0,
1893 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1894 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1895 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1896 1, 2, 4, 5, 5, 3, 2, 2, 1, 3,
1897 1, 3, 1, 0, 4, 3, 3, 4, 4, 3,
1898 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1899 6, 5, 8, 6, 6, 6, 6, 6, 8, 8,
1900 3, 1, 1, 1, 1, 2, 2, 4, 2, 1,
1901 4, 2, 4, 0, 7, 0, 7, 0, 7, 0,
1902 7, 3, 4, 0, 1, 1, 1, 3, 3, 3,
1903 3, 3, 3, 1, 0, 1, 1, 1, 0, 2,
1904 3, 1, 1, 3, 1, 0, 8, 1, 1, 3,
1905 1, 1, 2, 0, 1, 1, 0, 4, 0, 1,
1906 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1907 5, 1, 1, 1, 1, 2, 2, 2, 3, 2,
1908 0, 1, 2, 2, 3, 9, 9, 8, 13, 1,
1909 1, 6, 5, 2, 6, 7, 1, 3, 1, 0,
1910 2, 1, 5, 5, 5, 2, 4, 4, 6, 4,
1911 4, 4, 4, 6, 6, 2, 7, 1, 2, 0,
1912 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
1915 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1916 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1917 means the default is an error. */
1918 static const unsigned short int yydefact[] =
1920 163, 0, 60, 149, 1, 148, 196, 53, 54, 55,
1921 56, 57, 58, 59, 0, 61, 220, 145, 146, 220,
1922 175, 176, 0, 0, 0, 60, 0, 151, 193, 0,
1923 0, 62, 63, 64, 65, 66, 67, 0, 0, 221,
1924 217, 52, 190, 191, 192, 216, 0, 0, 0, 0,
1925 161, 0, 0, 0, 0, 0, 0, 0, 51, 194,
1926 195, 61, 164, 147, 68, 2, 3, 81, 85, 86,
1927 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1928 97, 98, 0, 0, 0, 0, 211, 0, 0, 80,
1929 99, 84, 212, 100, 187, 188, 189, 261, 219, 0,
1930 0, 0, 0, 174, 162, 152, 150, 142, 143, 0,
1931 0, 0, 0, 197, 101, 0, 0, 83, 106, 108,
1932 0, 0, 113, 107, 260, 0, 241, 0, 0, 0,
1933 0, 61, 229, 230, 6, 7, 8, 9, 10, 11,
1934 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1935 22, 23, 0, 0, 0, 0, 24, 25, 26, 27,
1936 28, 29, 30, 31, 32, 33, 34, 35, 0, 0,
1937 36, 37, 38, 0, 0, 0, 0, 0, 0, 0,
1938 0, 0, 0, 0, 218, 61, 233, 0, 257, 169,
1939 166, 165, 167, 168, 170, 173, 0, 157, 159, 155,
1940 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1941 95, 0, 0, 0, 0, 153, 0, 0, 0, 105,
1942 185, 112, 110, 0, 0, 245, 240, 223, 222, 0,
1943 0, 42, 46, 41, 45, 40, 44, 39, 43, 47,
1944 48, 0, 0, 71, 71, 266, 0, 0, 255, 0,
1945 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1946 0, 0, 0, 0, 0, 171, 76, 76, 76, 127,
1947 128, 4, 5, 125, 126, 129, 124, 120, 121, 0,
1948 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1949 0, 0, 0, 123, 122, 76, 82, 82, 109, 184,
1950 178, 181, 182, 0, 0, 102, 200, 201, 202, 207,
1951 203, 204, 205, 206, 198, 0, 209, 214, 213, 215,
1952 0, 224, 0, 0, 0, 262, 0, 264, 259, 0,
1953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1954 0, 0, 0, 0, 0, 0, 172, 0, 158, 160,
1955 156, 0, 0, 0, 0, 0, 115, 141, 0, 0,
1956 119, 0, 116, 0, 0, 0, 0, 0, 154, 103,
1957 104, 177, 179, 0, 74, 111, 199, 0, 0, 0,
1958 0, 0, 0, 0, 0, 0, 269, 0, 0, 0,
1959 249, 252, 0, 0, 250, 251, 0, 0, 0, 247,
1960 246, 0, 267, 0, 0, 0, 78, 76, 259, 0,
1961 0, 0, 0, 0, 114, 117, 118, 0, 0, 0,
1962 0, 0, 183, 180, 75, 69, 0, 208, 0, 0,
1963 239, 71, 72, 71, 236, 258, 0, 0, 0, 0,
1964 0, 242, 243, 244, 239, 0, 73, 79, 77, 0,
1965 0, 0, 0, 0, 140, 0, 0, 0, 0, 0,
1966 0, 186, 0, 0, 0, 238, 0, 0, 263, 265,
1967 0, 0, 0, 248, 253, 254, 0, 268, 131, 0,
1968 0, 0, 0, 0, 0, 0, 0, 0, 70, 210,
1969 0, 0, 0, 237, 234, 0, 256, 0, 137, 0,
1970 0, 133, 134, 135, 130, 136, 0, 227, 0, 0,
1971 0, 235, 0, 0, 0, 225, 0, 226, 0, 0,
1972 132, 138, 139, 0, 0, 0, 0, 0, 0, 232,
1976 /* YYDEFGOTO[NTERM-NUM]. */
1977 static const short int yydefgoto[] =
1979 -1, 86, 273, 288, 289, 290, 291, 292, 211, 212,
1980 241, 213, 25, 15, 37, 461, 325, 406, 425, 348,
1981 407, 87, 88, 214, 90, 91, 120, 223, 357, 316,
1982 358, 109, 1, 2, 3, 295, 268, 266, 267, 63,
1983 192, 50, 104, 196, 92, 372, 301, 302, 303, 38,
1984 96, 16, 44, 17, 61, 18, 28, 377, 317, 93,
1985 319, 434, 19, 40, 41, 184, 509, 98, 248, 465,
1986 466, 185, 186, 386, 187, 188
1989 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1991 #define YYPACT_NINF -472
1992 static const short int yypact[] =
1994 -472, 24, 395, 501, -472, -472, -472, -472, -472, -472,
1995 -472, -472, -472, -472, -13, 112, 46, -472, -472, -11,
1996 -472, -472, -18, -41, 45, 51, -1, -472, 40, 106,
1997 131, -472, -472, -472, -472, -472, -472, 1136, -23, -472,
1998 -472, 81, -472, -472, -472, -472, 30, 33, 49, 61,
1999 -472, 57, 106, 1136, 78, 78, 78, 78, -472, -472,
2000 -472, 112, -472, -472, -472, -472, -472, 62, -472, -472,
2001 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
2002 -472, -472, 185, 187, 188, 619, -472, 81, 67, -472,
2003 -472, -71, -472, -472, -472, -472, -472, 1286, -472, 174,
2004 58, 196, 177, 178, -472, -472, -472, -472, -472, 1177,
2005 1177, 1177, 1197, -472, -472, 72, 73, -472, -472, -71,
2006 -89, 79, 151, -472, -472, 1177, -472, 147, 1222, 12,
2007 218, 112, -472, -472, -472, -472, -472, -472, -472, -472,
2008 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
2009 -472, -472, 1177, 1177, 1177, 1177, -472, -472, -472, -472,
2010 -472, -472, -472, -472, -472, -472, -472, -472, 1177, 1177,
2011 -472, -472, -472, 1177, 1177, 1177, 1177, 1177, 1177, 1177,
2012 1177, 1177, 1177, 1177, -472, 112, -472, -55, -472, -472,
2013 -472, -472, -472, -472, -472, -472, -62, -472, -472, -472,
2014 95, 123, 204, 125, 205, 130, 206, 149, 207, 208,
2015 210, 181, 209, 214, 488, -472, 1177, 1177, 1177, -472,
2016 944, -472, 88, 93, 698, -472, -472, 62, -472, 698,
2017 698, -472, -472, -472, -472, -472, -472, -472, -472, -472,
2018 -472, 698, 1136, 97, 110, -472, 698, 108, 113, 114,
2019 120, 121, 124, 126, 133, 136, 698, 698, 698, 213,
2020 139, 1136, 1177, 1177, 227, -472, 140, 140, 140, -472,
2021 -472, -472, -472, -472, -472, -472, -472, -472, -472, 141,
2022 142, 143, 145, 146, 985, 1197, 639, 243, 148, 154,
2023 155, 157, 165, -472, -472, 140, -28, -51, -71, -472,
2024 81, -472, 153, 172, 1005, -472, -472, -472, -472, -472,
2025 -472, -472, -472, -472, 244, 1197, -472, -472, -472, -472,
2026 180, -472, 182, 698, -7, -472, -6, -472, 183, 698,
2027 138, 1177, 1177, 1177, 1177, 1177, 1177, 1177, 184, 186,
2028 189, 1177, 1177, 698, 698, 190, -472, -17, -472, -472,
2029 -472, 1197, 1197, 1197, 1197, 1197, -472, -472, -24, -85,
2030 -472, -80, -472, 1197, 1197, 1197, 1197, 1197, -472, -472,
2031 -472, -472, -472, 1046, 277, -472, -472, 289, -27, 293,
2032 296, 191, 698, 314, 698, 1177, -472, 194, 698, 195,
2033 -472, -472, 200, 201, -472, -472, 698, 698, 698, -472,
2034 -472, 202, -472, 1177, 298, 324, -472, 140, 183, 203,
2035 211, 212, 224, 1197, -472, -472, -472, 225, 226, 230,
2036 295, 232, -472, -472, -472, 275, 233, -472, 698, 698,
2037 1177, 235, -472, 235, -472, 239, 698, 241, 1177, 1177,
2038 1177, -472, -472, -472, 1177, 698, -472, -472, -472, 215,
2039 1197, 1197, 1197, 1197, -472, 1197, 1197, 1197, 1177, 1197,
2040 329, -472, 310, 242, 223, 239, 240, 278, -472, -472,
2041 1177, 238, 698, -472, -472, -472, 247, -472, -472, 245,
2042 250, 246, 255, 254, 256, 257, 259, 262, -472, -472,
2043 318, 15, 337, -472, -472, 252, -472, 1197, -472, 1197,
2044 1197, -472, -472, -472, -472, -472, 698, -472, 818, 65,
2045 371, -472, 265, 267, 268, -472, 272, -472, 818, 698,
2046 -472, -472, -472, 378, 274, 328, 698, 384, 385, -472,
2047 698, 698, -472, -472
2050 /* YYPGOTO[NTERM-NUM]. */
2051 static const short int yypgoto[] =
2053 -472, -472, -472, 311, 312, 313, 315, 317, -129, -127,
2054 -471, -472, 370, 392, -120, -472, -237, 50, -472, -253,
2055 -472, -49, -472, -37, -472, -67, 301, -472, -110, 220,
2056 -263, 64, -472, -472, -472, -472, -472, -472, -472, 373,
2057 -472, -472, -472, -472, 2, -472, 70, -472, -472, 374,
2058 -472, -472, -472, -472, -472, 441, -472, -472, -418, 34,
2059 31, -115, -472, 426, -472, -472, -472, -472, -472, 63,
2060 3, -472, -472, 38, -472, -472
2063 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2064 positive, shift that token. If negative, reduce the rule which
2065 number is the opposite. If zero, do what YYDEFACT says.
2066 If YYTABLE_NINF, syntax error. */
2067 #define YYTABLE_NINF -145
2068 static const short int yytable[] =
2070 89, 239, 215, 240, 106, 26, 94, 327, 382, 384,
2071 225, 242, 39, 228, 349, 350, 89, 404, 119, 42,
2072 508, 229, 359, 361, 4, 231, 232, 233, 234, 235,
2073 236, 237, 238, 230, 46, 47, 48, 218, 518, 245,
2074 405, 413, 368, 26, 262, 263, 413, 219, 29, 415,
2075 383, 383, 378, 49, 249, 119, 416, -82, 250, 251,
2076 252, 253, 254, 255, 264, 261, 123, 259, 260, 39,
2077 265, 53, 197, 198, 199, 231, 232, 233, 234, 235,
2078 236, 237, 238, 370, 51, 59, 123, 60, 224, 121,
2079 516, 224, 7, 8, 9, 10, 54, 12, 55, 413,
2080 524, 56, 413, 20, 369, 21, 52, 427, 414, 123,
2081 107, 108, 95, 190, 191, 243, 244, 224, 246, 110,
2082 111, 112, 269, 270, 58, 43, -42, -42, -41, -41,
2083 62, 247, 224, -40, -40, 64, 224, 224, 224, 224,
2084 224, 224, 256, 257, 258, 224, 224, 507, 345, 296,
2085 297, 298, -39, -39, 448, 99, 65, 66, 100, 117,
2086 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2087 78, 79, 80, 20, 101, 21, 30, 31, 32, 33,
2088 34, 35, 36, 300, 271, 272, 102, 103, 221, 114,
2089 -83, 115, 116, 323, 468, 122, 469, 517, 189, 81,
2090 193, 194, 195, 216, 217, 89, 226, 220, -46, -45,
2091 -44, -43, 343, 274, 304, -49, 389, -50, 391, 392,
2092 393, 275, 305, 324, 89, 344, 224, 400, 231, 232,
2093 233, 234, 235, 236, 237, 238, 326, 298, 329, 330,
2094 331, 408, 409, 410, 411, 412, 332, 333, 294, 341,
2095 334, 346, 335, 417, 418, 419, 420, 421, 318, 336,
2096 320, 321, 337, 318, 318, 342, 347, 362, 388, 351,
2097 352, 353, 322, 354, 355, 318, 363, 328, 82, 373,
2098 318, 83, 364, 365, 84, 366, 85, 338, 339, 340,
2099 318, 318, 318, 367, 224, 390, 224, 224, 224, 394,
2100 395, 374, 371, 454, 399, 224, 379, 376, 380, 385,
2101 396, 404, 397, 426, 428, 398, 403, 429, 432, 430,
2102 436, 438, 446, 473, 474, 475, 439, 440, 447, 450,
2103 444, 458, 460, 488, 489, 383, 300, 451, 452, 506,
2104 479, 480, 481, 482, 478, 483, 484, 485, 224, 487,
2105 453, 455, 456, 491, 381, 493, 457, 318, 459, 462,
2106 387, 467, 239, 318, 240, 470, 445, 472, 490, 492,
2107 494, 497, 499, 510, 401, 402, 496, 318, 318, 498,
2108 239, 500, 240, 501, 511, 502, 503, 512, 504, 513,
2109 514, 505, 519, 224, 520, -144, 521, 522, 523, 526,
2110 527, 224, 224, 224, 528, 530, 531, 224, 179, 180,
2111 181, 97, 182, 431, 183, 433, 318, 57, 318, 437,
2112 5, 486, 318, 222, 424, 105, 6, 441, 442, 443,
2113 318, 318, 318, 224, 293, 113, 7, 8, 9, 10,
2114 11, 12, 13, 423, 27, 45, 449, 476, 435, 0,
2115 0, 0, 0, 0, 0, 0, 0, 14, 0, 463,
2116 464, 0, 318, 318, 0, 0, 0, 471, 0, 0,
2117 318, 0, 0, 0, 0, 0, 477, 0, 0, 318,
2118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2119 0, 0, 0, 65, 66, 0, 0, 0, 0, 0,
2120 0, 0, 0, 495, 0, 0, 318, 0, 0, 0,
2121 20, 0, 21, 0, 276, 0, 0, 0, 0, 0,
2122 0, -52, 0, 20, 0, 21, 277, 278, 0, 0,
2123 0, 0, 6, -52, -52, 0, 0, 515, 0, 0,
2124 318, 0, -52, -52, -52, -52, -52, -52, -52, 0,
2125 525, -52, 22, 318, 0, 0, 0, 529, 0, 23,
2126 318, 532, 533, 24, 318, 318, 134, 135, 136, 137,
2127 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
2128 148, 149, 150, 151, 0, 0, 0, 0, 0, 279,
2129 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2130 166, 167, 0, 280, 170, 171, 172, 0, 281, 282,
2131 283, 0, 0, 0, 0, 0, 0, 0, 284, 0,
2132 0, 285, 0, 286, 65, 66, 287, 117, 68, 69,
2133 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2134 80, 20, 0, 21, 65, 66, 0, 117, 200, 201,
2135 202, 203, 204, 205, 206, 207, 208, 209, 210, 79,
2136 80, 20, 0, 21, 0, 0, 0, 81, 0, 0,
2137 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 0, 0, 0, 0, 0, 81, 0, 0,
2139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2140 0, 306, 307, 65, 66, 308, 0, 0, 0, 0,
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2142 20, 0, 21, 0, 309, 310, 311, 0, 0, 0,
2143 0, 0, 0, 0, 0, 0, 312, 313, 0, 0,
2144 0, 0, 0, 0, 0, 0, 82, 0, 0, 83,
2145 0, 0, 84, 0, 85, 118, 0, 0, 0, 314,
2146 0, 0, 0, 0, 0, 0, 82, 0, 0, 83,
2147 0, 0, 84, 0, 85, 360, 134, 135, 136, 137,
2148 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
2149 148, 149, 150, 151, 0, 0, 0, 0, 0, 279,
2150 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2151 166, 167, 0, 280, 170, 171, 172, 0, 281, 282,
2152 283, 306, 307, 0, 0, 308, 0, 0, 0, 0,
2153 0, 315, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0, 0, 0, 0, 309, 310, 311, 0, 0, 0,
2155 0, 0, 0, 0, 0, 0, 312, 313, 0, 0,
2156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2157 0, 0, 0, 0, 0, 0, 0, 0, 0, 314,
2158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2159 0, 0, 0, 0, 0, 0, 134, 135, 136, 137,
2160 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
2161 148, 149, 150, 151, 0, 0, 0, 0, 0, 279,
2162 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2163 166, 167, 0, 280, 170, 171, 172, 0, 281, 282,
2164 283, 0, 0, 0, 0, 0, 0, 0, 0, 65,
2165 66, 315, 117, 68, 69, 70, 71, 72, 73, 74,
2166 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2167 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2168 0, 299, 0, 0, 0, 0, 0, 0, 0, 0,
2169 65, 66, 81, 117, 200, 201, 202, 203, 204, 205,
2170 206, 207, 208, 209, 210, 79, 80, 20, 0, 21,
2171 65, 66, 0, 117, 68, 69, 70, 71, 72, 73,
2172 74, 75, 76, 77, 78, 79, 80, 20, 0, 21,
2173 0, 0, 0, 81, 0, 0, 0, 0, 0, 0,
2174 0, 0, 375, 0, 0, 0, 0, 0, 0, 0,
2175 0, 65, 66, 81, 117, 68, 69, 70, 71, 72,
2176 73, 74, 75, 76, 77, 78, 79, 80, 20, 0,
2177 21, 82, 0, 0, 83, 0, 0, 84, 0, 85,
2178 0, 0, 0, 422, 0, 0, 0, 0, 0, 0,
2179 0, 0, 0, 0, 81, 0, 0, 0, 0, 0,
2180 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2181 0, 0, 82, 0, 0, 83, 0, 356, 84, 0,
2182 85, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2183 0, 0, 82, 0, 0, 83, 0, 0, 84, 0,
2184 85, 65, 66, 0, 67, 68, 69, 70, 71, 72,
2185 73, 74, 75, 76, 77, 78, 79, 80, 20, 0,
2186 21, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2187 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2188 0, 85, 65, 66, 81, 117, 68, 69, 70, 71,
2189 72, 73, 74, 75, 76, 77, 78, 79, 80, 20,
2190 0, 21, 65, 66, 0, 117, 200, 201, 202, 203,
2191 204, 205, 206, 207, 208, 209, 210, 79, 80, 20,
2192 0, 21, 0, 0, 0, 81, 0, 65, 66, 0,
2193 227, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2194 77, 78, 79, 80, 20, 81, 21, 0, 0, 0,
2195 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2196 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2197 81, 85, 0, 0, 0, 0, 0, 0, 0, 0,
2198 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2200 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
2201 84, 0, 85, 0, 0, 0, 0, 0, 0, 0,
2202 0, 124, 0, 0, 82, 0, 0, 83, 0, 0,
2203 84, 0, 85, 0, 0, 125, 0, 0, 0, 0,
2204 0, 0, 0, 0, 0, 126, 127, 0, 0, 82,
2205 0, 0, 83, 0, 0, 84, 0, 85, 128, 129,
2206 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
2207 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
2208 150, 151, 152, 153, 154, 0, 0, 155, 156, 157,
2209 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
2210 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
2214 static const short int yycheck[] =
2216 37, 130, 112, 130, 53, 3, 29, 244, 15, 15,
2217 125, 131, 23, 128, 267, 268, 53, 34, 85, 30,
2218 491, 9, 285, 286, 0, 10, 11, 12, 13, 14,
2219 15, 16, 17, 21, 52, 53, 54, 126, 509, 154,
2220 57, 126, 295, 41, 99, 100, 126, 136, 61, 134,
2221 57, 57, 315, 71, 169, 122, 136, 128, 173, 174,
2222 175, 176, 177, 178, 126, 185, 137, 182, 183, 23,
2223 132, 20, 109, 110, 111, 10, 11, 12, 13, 14,
2224 15, 16, 17, 134, 125, 45, 137, 47, 125, 87,
2225 508, 128, 41, 42, 43, 44, 45, 46, 47, 126,
2226 518, 50, 126, 22, 132, 24, 61, 134, 132, 137,
2227 32, 33, 135, 55, 56, 152, 153, 154, 155, 55,
2228 56, 57, 27, 28, 125, 136, 3, 4, 3, 4,
2229 24, 168, 169, 3, 4, 4, 173, 174, 175, 176,
2230 177, 178, 179, 180, 181, 182, 183, 132, 263, 216,
2231 217, 218, 3, 4, 407, 125, 5, 6, 125, 8,
2232 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2233 19, 20, 21, 22, 125, 24, 64, 65, 66, 67,
2234 68, 69, 70, 220, 3, 4, 125, 130, 37, 4,
2235 128, 4, 4, 242, 431, 128, 433, 132, 24, 48,
2236 4, 24, 24, 131, 131, 242, 59, 128, 4, 4,
2237 4, 4, 261, 4, 126, 7, 331, 7, 333, 334,
2238 335, 7, 129, 126, 261, 262, 263, 342, 10, 11,
2239 12, 13, 14, 15, 16, 17, 126, 304, 130, 126,
2240 126, 351, 352, 353, 354, 355, 126, 126, 214, 36,
2241 126, 24, 126, 363, 364, 365, 366, 367, 224, 126,
2242 229, 230, 126, 229, 230, 126, 126, 24, 130, 128,
2243 128, 128, 241, 128, 128, 241, 128, 246, 127, 126,
2244 246, 130, 128, 128, 133, 128, 135, 256, 257, 258,
2245 256, 257, 258, 128, 331, 332, 333, 334, 335, 336,
2246 337, 129, 300, 413, 341, 342, 126, 63, 126, 126,
2247 126, 34, 126, 24, 21, 126, 126, 21, 4, 128,
2248 126, 126, 24, 438, 439, 440, 126, 126, 4, 126,
2249 128, 36, 57, 4, 24, 57, 373, 126, 126, 21,
2250 450, 451, 452, 453, 129, 455, 456, 457, 385, 459,
2251 126, 126, 126, 130, 323, 470, 126, 323, 126, 126,
2252 329, 126, 491, 329, 491, 126, 403, 126, 126, 129,
2253 132, 126, 126, 36, 343, 344, 129, 343, 344, 129,
2254 509, 126, 509, 129, 132, 129, 129, 497, 129, 499,
2255 500, 129, 21, 430, 129, 0, 129, 129, 126, 21,
2256 126, 438, 439, 440, 76, 21, 21, 444, 97, 97,
2257 97, 41, 97, 382, 97, 384, 382, 25, 384, 388,
2258 25, 458, 388, 122, 374, 52, 31, 396, 397, 398,
2259 396, 397, 398, 470, 214, 61, 41, 42, 43, 44,
2260 45, 46, 47, 373, 3, 19, 408, 444, 385, -1,
2261 -1, -1, -1, -1, -1, -1, -1, 62, -1, 428,
2262 429, -1, 428, 429, -1, -1, -1, 436, -1, -1,
2263 436, -1, -1, -1, -1, -1, 445, -1, -1, 445,
2264 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2265 -1, -1, -1, 5, 6, -1, -1, -1, -1, -1,
2266 -1, -1, -1, 472, -1, -1, 472, -1, -1, -1,
2267 22, -1, 24, -1, 26, -1, -1, -1, -1, -1,
2268 -1, 20, -1, 22, -1, 24, 38, 39, -1, -1,
2269 -1, -1, 31, 32, 33, -1, -1, 506, -1, -1,
2270 506, -1, 41, 42, 43, 44, 45, 46, 47, -1,
2271 519, 50, 51, 519, -1, -1, -1, 526, -1, 58,
2272 526, 530, 531, 62, 530, 531, 78, 79, 80, 81,
2273 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2274 92, 93, 94, 95, -1, -1, -1, -1, -1, 101,
2275 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2276 112, 113, -1, 115, 116, 117, 118, -1, 120, 121,
2277 122, -1, -1, -1, -1, -1, -1, -1, 130, -1,
2278 -1, 133, -1, 135, 5, 6, 138, 8, 9, 10,
2279 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2280 21, 22, -1, 24, 5, 6, -1, 8, 9, 10,
2281 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2282 21, 22, -1, 24, -1, -1, -1, 48, -1, -1,
2283 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2284 -1, -1, -1, -1, -1, -1, -1, 48, -1, -1,
2285 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2286 -1, 3, 4, 5, 6, 7, -1, -1, -1, -1,
2287 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2288 22, -1, 24, -1, 26, 27, 28, -1, -1, -1,
2289 -1, -1, -1, -1, -1, -1, 38, 39, -1, -1,
2290 -1, -1, -1, -1, -1, -1, 127, -1, -1, 130,
2291 -1, -1, 133, -1, 135, 136, -1, -1, -1, 61,
2292 -1, -1, -1, -1, -1, -1, 127, -1, -1, 130,
2293 -1, -1, 133, -1, 135, 136, 78, 79, 80, 81,
2294 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2295 92, 93, 94, 95, -1, -1, -1, -1, -1, 101,
2296 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2297 112, 113, -1, 115, 116, 117, 118, -1, 120, 121,
2298 122, 3, 4, -1, -1, 7, -1, -1, -1, -1,
2299 -1, 133, -1, -1, -1, -1, -1, -1, -1, -1,
2300 -1, -1, -1, -1, 26, 27, 28, -1, -1, -1,
2301 -1, -1, -1, -1, -1, -1, 38, 39, -1, -1,
2302 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2303 -1, -1, -1, -1, -1, -1, -1, -1, -1, 61,
2304 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2305 -1, -1, -1, -1, -1, -1, 78, 79, 80, 81,
2306 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2307 92, 93, 94, 95, -1, -1, -1, -1, -1, 101,
2308 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2309 112, 113, -1, 115, 116, 117, 118, -1, 120, 121,
2310 122, -1, -1, -1, -1, -1, -1, -1, -1, 5,
2311 6, 133, 8, 9, 10, 11, 12, 13, 14, 15,
2312 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2313 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2314 -1, 37, -1, -1, -1, -1, -1, -1, -1, -1,
2315 5, 6, 48, 8, 9, 10, 11, 12, 13, 14,
2316 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2317 5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
2318 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2319 -1, -1, -1, 48, -1, -1, -1, -1, -1, -1,
2320 -1, -1, 37, -1, -1, -1, -1, -1, -1, -1,
2321 -1, 5, 6, 48, 8, 9, 10, 11, 12, 13,
2322 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2323 24, 127, -1, -1, 130, -1, -1, 133, -1, 135,
2324 -1, -1, -1, 37, -1, -1, -1, -1, -1, -1,
2325 -1, -1, -1, -1, 48, -1, -1, -1, -1, -1,
2326 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2327 -1, -1, 127, -1, -1, 130, -1, 132, 133, -1,
2328 135, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2329 -1, -1, 127, -1, -1, 130, -1, -1, 133, -1,
2330 135, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2331 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2332 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2333 -1, -1, -1, 127, -1, -1, 130, -1, -1, 133,
2334 -1, 135, 5, 6, 48, 8, 9, 10, 11, 12,
2335 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2336 -1, 24, 5, 6, -1, 8, 9, 10, 11, 12,
2337 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2338 -1, 24, -1, -1, -1, 48, -1, 5, 6, -1,
2339 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2340 18, 19, 20, 21, 22, 48, 24, -1, -1, -1,
2341 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2342 -1, -1, -1, 127, -1, -1, 130, -1, -1, 133,
2343 48, 135, -1, -1, -1, -1, -1, -1, -1, -1,
2344 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2345 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2346 -1, -1, -1, -1, 127, -1, -1, 130, -1, -1,
2347 133, -1, 135, -1, -1, -1, -1, -1, -1, -1,
2348 -1, 35, -1, -1, 127, -1, -1, 130, -1, -1,
2349 133, -1, 135, -1, -1, 49, -1, -1, -1, -1,
2350 -1, -1, -1, -1, -1, 59, 60, -1, -1, 127,
2351 -1, -1, 130, -1, -1, 133, -1, 135, 72, 73,
2352 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2353 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2354 94, 95, 96, 97, 98, -1, -1, 101, 102, 103,
2355 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
2356 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2360 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2361 symbol of state STATE-NUM. */
2362 static const unsigned char yystos[] =
2364 0, 171, 172, 173, 0, 25, 31, 41, 42, 43,
2365 44, 45, 46, 47, 62, 152, 190, 192, 194, 201,
2366 22, 24, 51, 58, 62, 151, 183, 194, 195, 61,
2367 64, 65, 66, 67, 68, 69, 70, 153, 188, 23,
2368 202, 203, 30, 136, 191, 202, 52, 53, 54, 71,
2369 180, 125, 61, 20, 45, 47, 50, 152, 125, 45,
2370 47, 193, 24, 178, 4, 5, 6, 8, 9, 10,
2371 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2372 21, 48, 127, 130, 133, 135, 140, 160, 161, 162,
2373 163, 164, 183, 198, 29, 135, 189, 151, 206, 125,
2374 125, 125, 125, 130, 181, 178, 160, 32, 33, 170,
2375 170, 170, 170, 188, 4, 4, 4, 8, 136, 164,
2376 165, 183, 128, 137, 35, 49, 59, 60, 72, 73,
2377 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2378 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2379 94, 95, 96, 97, 98, 101, 102, 103, 104, 105,
2380 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2381 116, 117, 118, 119, 120, 121, 122, 123, 124, 142,
2382 143, 144, 145, 146, 204, 210, 211, 213, 214, 24,
2383 55, 56, 179, 4, 24, 24, 182, 162, 162, 162,
2384 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2385 19, 147, 148, 150, 162, 167, 131, 131, 126, 136,
2386 128, 37, 165, 166, 162, 200, 59, 8, 200, 9,
2387 21, 10, 11, 12, 13, 14, 15, 16, 17, 147,
2388 148, 149, 153, 162, 162, 200, 162, 162, 207, 200,
2389 200, 200, 200, 200, 200, 200, 162, 162, 162, 200,
2390 200, 153, 99, 100, 126, 132, 176, 177, 175, 27,
2391 28, 3, 4, 141, 4, 7, 26, 38, 39, 101,
2392 115, 120, 121, 122, 130, 133, 135, 138, 142, 143,
2393 144, 145, 146, 168, 198, 174, 164, 164, 164, 37,
2394 162, 185, 186, 187, 126, 129, 3, 4, 7, 26,
2395 27, 28, 38, 39, 61, 133, 168, 197, 198, 199,
2396 199, 199, 199, 160, 126, 155, 126, 155, 199, 130,
2397 126, 126, 126, 126, 126, 126, 126, 126, 199, 199,
2398 199, 36, 126, 160, 162, 200, 24, 126, 158, 158,
2399 158, 128, 128, 128, 128, 128, 132, 167, 169, 169,
2400 136, 169, 24, 128, 128, 128, 128, 128, 158, 132,
2401 134, 183, 184, 126, 129, 37, 63, 196, 169, 126,
2402 126, 199, 15, 57, 15, 126, 212, 199, 130, 200,
2403 162, 200, 200, 200, 162, 162, 126, 126, 126, 162,
2404 200, 199, 199, 126, 34, 57, 156, 159, 167, 167,
2405 167, 167, 167, 126, 132, 134, 136, 167, 167, 167,
2406 167, 167, 37, 185, 156, 157, 24, 134, 21, 21,
2407 128, 199, 4, 199, 200, 208, 126, 199, 126, 126,
2408 126, 199, 199, 199, 128, 162, 24, 4, 158, 212,
2409 126, 126, 126, 126, 167, 126, 126, 126, 36, 126,
2410 57, 154, 126, 199, 199, 208, 209, 126, 155, 155,
2411 126, 199, 126, 200, 200, 200, 209, 199, 129, 167,
2412 167, 167, 167, 167, 167, 167, 162, 167, 4, 24,
2413 126, 130, 129, 200, 132, 199, 129, 126, 129, 126,
2414 126, 129, 129, 129, 129, 129, 21, 132, 149, 205,
2415 36, 132, 167, 167, 167, 199, 197, 132, 149, 21,
2416 129, 129, 129, 126, 197, 199, 21, 126, 76, 199,
2420 #define yyerrok (yyerrstatus = 0)
2421 #define yyclearin (yychar = YYEMPTY)
2422 #define YYEMPTY (-2)
2425 #define YYACCEPT goto yyacceptlab
2426 #define YYABORT goto yyabortlab
2427 #define YYERROR goto yyerrorlab
2430 /* Like YYERROR except do call yyerror. This remains here temporarily
2431 to ease the transition to the new meaning of YYERROR, for GCC.
2432 Once GCC version 2 has supplanted version 1, this can go. */
2434 #define YYFAIL goto yyerrlab
2436 #define YYRECOVERING() (!!yyerrstatus)
2438 #define YYBACKUP(Token, Value) \
2440 if (yychar == YYEMPTY && yylen == 1) \
2444 yytoken = YYTRANSLATE (yychar); \
2450 yyerror (YY_("syntax error: cannot back up")); \
2457 #define YYERRCODE 256
2460 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2461 If N is 0, then set CURRENT to the empty location which ends
2462 the previous symbol: RHS[0] (always defined). */
2464 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2465 #ifndef YYLLOC_DEFAULT
2466 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2470 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2471 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2472 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2473 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2477 (Current).first_line = (Current).last_line = \
2478 YYRHSLOC (Rhs, 0).last_line; \
2479 (Current).first_column = (Current).last_column = \
2480 YYRHSLOC (Rhs, 0).last_column; \
2486 /* YY_LOCATION_PRINT -- Print the location on the stream.
2487 This macro was not mandated originally: define only if we know
2488 we won't break user code: when these are the locations we know. */
2490 #ifndef YY_LOCATION_PRINT
2491 # if YYLTYPE_IS_TRIVIAL
2492 # define YY_LOCATION_PRINT(File, Loc) \
2493 fprintf (File, "%d.%d-%d.%d", \
2494 (Loc).first_line, (Loc).first_column, \
2495 (Loc).last_line, (Loc).last_column)
2497 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2502 /* YYLEX -- calling `yylex' with the right arguments. */
2505 # define YYLEX yylex (YYLEX_PARAM)
2507 # define YYLEX yylex ()
2510 /* Enable debugging if requested. */
2514 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2515 # define YYFPRINTF fprintf
2518 # define YYDPRINTF(Args) \
2524 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2528 YYFPRINTF (stderr, "%s ", Title); \
2529 yysymprint (stderr, \
2531 YYFPRINTF (stderr, "\n"); \
2535 /*------------------------------------------------------------------.
2536 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2538 `------------------------------------------------------------------*/
2540 #if defined (__STDC__) || defined (__cplusplus)
2542 yy_stack_print (short int *bottom, short int *top)
2545 yy_stack_print (bottom, top)
2550 YYFPRINTF (stderr, "Stack now");
2551 for (/* Nothing. */; bottom <= top; ++bottom)
2552 YYFPRINTF (stderr, " %d", *bottom);
2553 YYFPRINTF (stderr, "\n");
2556 # define YY_STACK_PRINT(Bottom, Top) \
2559 yy_stack_print ((Bottom), (Top)); \
2563 /*------------------------------------------------.
2564 | Report that the YYRULE is going to be reduced. |
2565 `------------------------------------------------*/
2567 #if defined (__STDC__) || defined (__cplusplus)
2569 yy_reduce_print (int yyrule)
2572 yy_reduce_print (yyrule)
2577 unsigned long int yylno = yyrline[yyrule];
2578 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2580 /* Print the symbols being reduced, and their result. */
2581 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2582 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2583 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2586 # define YY_REDUCE_PRINT(Rule) \
2589 yy_reduce_print (Rule); \
2592 /* Nonzero means print parse trace. It is left uninitialized so that
2593 multiple parsers can coexist. */
2595 #else /* !YYDEBUG */
2596 # define YYDPRINTF(Args)
2597 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2598 # define YY_STACK_PRINT(Bottom, Top)
2599 # define YY_REDUCE_PRINT(Rule)
2600 #endif /* !YYDEBUG */
2603 /* YYINITDEPTH -- initial size of the parser's stacks. */
2605 # define YYINITDEPTH 200
2608 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2609 if the built-in stack extension method is used).
2611 Do not make this value too large; the results are undefined if
2612 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2613 evaluated with infinite-precision integer arithmetic. */
2616 # define YYMAXDEPTH 10000
2624 # if defined (__GLIBC__) && defined (_STRING_H)
2625 # define yystrlen strlen
2627 /* Return the length of YYSTR. */
2629 # if defined (__STDC__) || defined (__cplusplus)
2630 yystrlen (const char *yystr)
2636 const char *yys = yystr;
2638 while (*yys++ != '\0')
2641 return yys - yystr - 1;
2647 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2648 # define yystpcpy stpcpy
2650 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2653 # if defined (__STDC__) || defined (__cplusplus)
2654 yystpcpy (char *yydest, const char *yysrc)
2656 yystpcpy (yydest, yysrc)
2662 const char *yys = yysrc;
2664 while ((*yyd++ = *yys++) != '\0')
2673 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2674 quotes and backslashes, so that it's suitable for yyerror. The
2675 heuristic is that double-quoting is unnecessary unless the string
2676 contains an apostrophe, a comma, or backslash (other than
2677 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2678 null, do not copy; instead, return the length of what the result
2681 yytnamerr (char *yyres, const char *yystr)
2686 char const *yyp = yystr;
2693 goto do_not_strip_quotes;
2697 goto do_not_strip_quotes;
2710 do_not_strip_quotes: ;
2714 return yystrlen (yystr);
2716 return yystpcpy (yyres, yystr) - yyres;
2720 #endif /* YYERROR_VERBOSE */
2725 /*--------------------------------.
2726 | Print this symbol on YYOUTPUT. |
2727 `--------------------------------*/
2729 #if defined (__STDC__) || defined (__cplusplus)
2731 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2734 yysymprint (yyoutput, yytype, yyvaluep)
2740 /* Pacify ``unused variable'' warnings. */
2743 if (yytype < YYNTOKENS)
2744 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2746 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2750 if (yytype < YYNTOKENS)
2751 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2758 YYFPRINTF (yyoutput, ")");
2761 #endif /* ! YYDEBUG */
2762 /*-----------------------------------------------.
2763 | Release the memory associated to this symbol. |
2764 `-----------------------------------------------*/
2766 #if defined (__STDC__) || defined (__cplusplus)
2768 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2771 yydestruct (yymsg, yytype, yyvaluep)
2777 /* Pacify ``unused variable'' warnings. */
2782 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2793 /* Prevent warnings from -Wmissing-prototypes. */
2795 #ifdef YYPARSE_PARAM
2796 # if defined (__STDC__) || defined (__cplusplus)
2797 int yyparse (void *YYPARSE_PARAM);
2801 #else /* ! YYPARSE_PARAM */
2802 #if defined (__STDC__) || defined (__cplusplus)
2807 #endif /* ! YYPARSE_PARAM */
2811 /* The look-ahead symbol. */
2814 /* The semantic value of the look-ahead symbol. */
2817 /* Number of syntax errors so far. */
2826 #ifdef YYPARSE_PARAM
2827 # if defined (__STDC__) || defined (__cplusplus)
2828 int yyparse (void *YYPARSE_PARAM)
2830 int yyparse (YYPARSE_PARAM)
2831 void *YYPARSE_PARAM;
2833 #else /* ! YYPARSE_PARAM */
2834 #if defined (__STDC__) || defined (__cplusplus)
2848 /* Number of tokens to shift before error messages enabled. */
2850 /* Look-ahead token as an internal (translated) token number. */
2853 /* Three stacks and their tools:
2854 `yyss': related to states,
2855 `yyvs': related to semantic values,
2856 `yyls': related to locations.
2858 Refer to the stacks thru separate pointers, to allow yyoverflow
2859 to reallocate them elsewhere. */
2861 /* The state stack. */
2862 short int yyssa[YYINITDEPTH];
2863 short int *yyss = yyssa;
2866 /* The semantic value stack. */
2867 YYSTYPE yyvsa[YYINITDEPTH];
2868 YYSTYPE *yyvs = yyvsa;
2873 #define YYPOPSTACK (yyvsp--, yyssp--)
2875 YYSIZE_T yystacksize = YYINITDEPTH;
2877 /* The variables used to return semantic value and location from the
2882 /* When reducing, the number of symbols on the RHS of the reduced
2886 YYDPRINTF ((stderr, "Starting parse\n"));
2891 yychar = YYEMPTY; /* Cause a token to be read. */
2893 /* Initialize stack pointers.
2894 Waste one element of value and location stack
2895 so that they stay on the same level as the state stack.
2896 The wasted elements are never initialized. */
2903 /*------------------------------------------------------------.
2904 | yynewstate -- Push a new state, which is found in yystate. |
2905 `------------------------------------------------------------*/
2907 /* In all cases, when you get here, the value and location stacks
2908 have just been pushed. so pushing a state here evens the stacks.
2915 if (yyss + yystacksize - 1 <= yyssp)
2917 /* Get the current used size of the three stacks, in elements. */
2918 YYSIZE_T yysize = yyssp - yyss + 1;
2922 /* Give user a chance to reallocate the stack. Use copies of
2923 these so that the &'s don't force the real ones into
2925 YYSTYPE *yyvs1 = yyvs;
2926 short int *yyss1 = yyss;
2929 /* Each stack pointer address is followed by the size of the
2930 data in use in that stack, in bytes. This used to be a
2931 conditional around just the two extra args, but that might
2932 be undefined if yyoverflow is a macro. */
2933 yyoverflow (YY_("memory exhausted"),
2934 &yyss1, yysize * sizeof (*yyssp),
2935 &yyvs1, yysize * sizeof (*yyvsp),
2942 #else /* no yyoverflow */
2943 # ifndef YYSTACK_RELOCATE
2944 goto yyexhaustedlab;
2946 /* Extend the stack our own way. */
2947 if (YYMAXDEPTH <= yystacksize)
2948 goto yyexhaustedlab;
2950 if (YYMAXDEPTH < yystacksize)
2951 yystacksize = YYMAXDEPTH;
2954 short int *yyss1 = yyss;
2955 union yyalloc *yyptr =
2956 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2958 goto yyexhaustedlab;
2959 YYSTACK_RELOCATE (yyss);
2960 YYSTACK_RELOCATE (yyvs);
2962 # undef YYSTACK_RELOCATE
2964 YYSTACK_FREE (yyss1);
2967 #endif /* no yyoverflow */
2969 yyssp = yyss + yysize - 1;
2970 yyvsp = yyvs + yysize - 1;
2973 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2974 (unsigned long int) yystacksize));
2976 if (yyss + yystacksize - 1 <= yyssp)
2980 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2989 /* Do appropriate processing given the current state. */
2990 /* Read a look-ahead token if we need one and don't already have one. */
2993 /* First try to decide what to do without reference to look-ahead token. */
2995 yyn = yypact[yystate];
2996 if (yyn == YYPACT_NINF)
2999 /* Not known => get a look-ahead token if don't already have one. */
3001 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3002 if (yychar == YYEMPTY)
3004 YYDPRINTF ((stderr, "Reading a token: "));
3008 if (yychar <= YYEOF)
3010 yychar = yytoken = YYEOF;
3011 YYDPRINTF ((stderr, "Now at end of input.\n"));
3015 yytoken = YYTRANSLATE (yychar);
3016 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3019 /* If the proper action on seeing token YYTOKEN is to reduce or to
3020 detect an error, take that action. */
3022 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3027 if (yyn == 0 || yyn == YYTABLE_NINF)
3036 /* Shift the look-ahead token. */
3037 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3039 /* Discard the token being shifted unless it is eof. */
3040 if (yychar != YYEOF)
3046 /* Count tokens shifted since error; after three, turn off error
3055 /*-----------------------------------------------------------.
3056 | yydefault -- do the default action for the current state. |
3057 `-----------------------------------------------------------*/
3059 yyn = yydefact[yystate];
3065 /*-----------------------------.
3066 | yyreduce -- Do a reduction. |
3067 `-----------------------------*/
3069 /* yyn is the number of a rule to reduce with. */
3072 /* If YYLEN is nonzero, implement the default value of the action:
3075 Otherwise, the following line sets YYVAL to garbage.
3076 This behavior is undocumented and Bison
3077 users should not rely upon it. Assigning to YYVAL
3078 unconditionally makes the parser a bit smaller, and it avoids a
3079 GCC warning that YYVAL may be used uninitialized. */
3080 yyval = yyvsp[1-yylen];
3083 YY_REDUCE_PRINT (yyn);
3087 #line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3089 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3090 GEN_ERROR("Value too large for type!");
3091 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3097 #line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3099 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
3100 GEN_ERROR("Value too large for type!");
3101 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
3107 #line 1199 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3109 (yyval.StrVal) = (yyvsp[-1].StrVal);
3115 #line 1203 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3123 #line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3124 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3128 #line 1209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3129 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3133 #line 1210 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3134 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3138 #line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3139 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3143 #line 1212 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3144 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3148 #line 1213 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3149 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3153 #line 1214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3154 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3158 #line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3159 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3163 #line 1217 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3164 { (yyval.UIntVal) = CallingConv::C; ;}
3168 #line 1218 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3169 { (yyval.UIntVal) = CallingConv::C; ;}
3173 #line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3174 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3178 #line 1220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3179 { (yyval.UIntVal) = CallingConv::Fast; ;}
3183 #line 1221 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3184 { (yyval.UIntVal) = CallingConv::Cold; ;}
3188 #line 1222 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3189 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3193 #line 1223 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3194 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3198 #line 1224 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3200 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3201 GEN_ERROR("Calling conv too large!");
3202 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3208 #line 1233 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3209 { (yyval.UIntVal) = 0; ;}
3213 #line 1234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3215 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3216 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3217 GEN_ERROR("Alignment must be a power of two!");
3223 #line 1240 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3224 { (yyval.UIntVal) = 0; ;}
3228 #line 1241 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3230 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3231 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3232 GEN_ERROR("Alignment must be a power of two!");
3238 #line 1249 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3240 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3241 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3242 GEN_ERROR("Invalid character in section name!");
3243 (yyval.StrVal) = (yyvsp[0].StrVal);
3249 #line 1257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3250 { (yyval.StrVal) = 0; ;}
3254 #line 1258 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3255 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3259 #line 1263 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3264 #line 1264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3269 #line 1265 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3271 CurGV->setSection((yyvsp[0].StrVal));
3272 free((yyvsp[0].StrVal));
3278 #line 1270 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3280 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3281 GEN_ERROR("Alignment must be a power of two!");
3282 CurGV->setAlignment((yyvsp[0].UInt64Val));
3288 #line 1284 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3290 (yyval.TypeVal).type = new PATypeHolder((yyvsp[0].TypeVal).type->get());
3291 (yyval.TypeVal).signedness = (yyvsp[0].TypeVal).signedness;
3296 #line 1288 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3298 (yyval.TypeVal).type = new PATypeHolder((yyvsp[0].TypeVal).type->get());
3299 (yyval.TypeVal).signedness = (yyvsp[0].TypeVal).signedness;
3304 #line 1293 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3306 if (!UpRefs.empty())
3307 GEN_ERROR("Invalid upreference in type: " +
3308 ((yyvsp[0].TypeVal).type->get())->getDescription());
3309 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3315 #line 1306 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3317 (yyval.TypeVal).type = new PATypeHolder(OpaqueType::get());
3318 (yyval.TypeVal).signedness = isSignless;
3324 #line 1311 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3326 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3332 #line 1315 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3333 { // Named types are also simple types...
3334 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3336 (yyval.TypeVal).type = new PATypeHolder(tmp);
3337 (yyval.TypeVal).signedness = isSignless;
3342 #line 1324 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3343 { // Type UpReference
3344 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3345 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3346 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3347 (yyval.TypeVal).type = new PATypeHolder(OT);
3348 (yyval.TypeVal).signedness = isSignless;
3349 UR_OUT("New Upreference!\n");
3355 #line 1333 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3356 { // Function derived type?
3357 std::vector<const Type*> Params;
3358 for (std::list<TypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(),
3359 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3360 Params.push_back(I->type->get());
3361 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3362 if (isVarArg) Params.pop_back();
3364 (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs(
3365 FunctionType::get((yyvsp[-3].TypeVal).type->get(),Params,isVarArg)));
3366 (yyval.TypeVal).signedness = isSignless;
3367 delete (yyvsp[-1].TypeList); // Delete the argument list
3368 delete (yyvsp[-3].TypeVal).type;
3374 #line 1348 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3375 { // Sized array type?
3376 (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs(
3377 ArrayType::get((yyvsp[-1].TypeVal).type->get(), (unsigned)(yyvsp[-3].UInt64Val))));
3378 (yyval.TypeVal).signedness = isSignless;
3379 delete (yyvsp[-1].TypeVal).type;
3385 #line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3386 { // Packed array type?
3387 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal).type->get();
3388 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3389 GEN_ERROR("Unsigned result not equal to signed result");
3390 if (!ElemTy->isPrimitiveType())
3391 GEN_ERROR("Elemental type of a PackedType must be primitive");
3392 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3393 GEN_ERROR("Vector length should be a power of 2!");
3394 (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs(
3395 PackedType::get((yyvsp[-1].TypeVal).type->get(), (unsigned)(yyvsp[-3].UInt64Val))));
3396 (yyval.TypeVal).signedness = isSignless;
3397 delete (yyvsp[-1].TypeVal).type;
3403 #line 1369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3404 { // Structure type?
3405 std::vector<const Type*> Elements;
3406 for (std::list<TypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(),
3407 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3408 Elements.push_back((*I).type->get());
3410 (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3411 (yyval.TypeVal).signedness = isSignless;
3412 delete (yyvsp[-1].TypeList);
3418 #line 1380 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3419 { // Empty structure type?
3420 (yyval.TypeVal).type = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3421 (yyval.TypeVal).signedness = isSignless;
3427 #line 1385 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3429 if ((yyvsp[-1].TypeVal).type->get() == Type::LabelTy)
3430 GEN_ERROR("Cannot form a pointer to a basic block");
3431 (yyval.TypeVal).type = new PATypeHolder(HandleUpRefs(PointerType::get((yyvsp[-1].TypeVal).type->get())));
3432 (yyval.TypeVal).signedness = isSignless;
3433 delete (yyvsp[-1].TypeVal).type;
3439 #line 1397 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3441 (yyval.TypeList) = new std::list<TypeInfo>();
3442 (yyval.TypeList)->push_back((yyvsp[0].TypeVal));
3448 #line 1402 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3450 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back((yyvsp[0].TypeVal));
3456 #line 1409 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3459 TI.type = new PATypeHolder(Type::VoidTy); TI.signedness = isSignless;
3460 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(TI);
3466 #line 1415 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3469 TI.type = new PATypeHolder(Type::VoidTy); TI.signedness = isSignless;
3470 ((yyval.TypeList) = new std::list<TypeInfo>())->push_back(TI);
3476 #line 1421 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3478 (yyval.TypeList) = new std::list<TypeInfo>();
3484 #line 1432 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3485 { // Nonempty unsized arr
3486 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal).type->get());
3488 GEN_ERROR("Cannot make array constant with type: '" +
3489 ((yyvsp[-3].TypeVal).type->get())->getDescription() + "'!");
3490 const Type *ETy = ATy->getElementType();
3491 int NumElements = ATy->getNumElements();
3493 // Verify that we have the correct size...
3494 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3495 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3496 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3497 itostr(NumElements) + "!");
3499 // Verify all elements are correct type!
3500 std::vector<Constant*> elems;
3501 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3502 if (ETy != (*(yyvsp[-1].ConstVector))[i].cnst->getType()) {
3503 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3504 ETy->getDescription() +"' as required!\nIt is of type '"+
3505 (*(yyvsp[-1].ConstVector))[i].cnst->getType()->getDescription() + "'.");
3507 elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst);
3511 (yyval.ConstVal).cnst = ConstantArray::get(ATy, elems);
3512 (yyval.ConstVal).signedness = isSignless;
3513 delete (yyvsp[-3].TypeVal).type; delete (yyvsp[-1].ConstVector);
3519 #line 1463 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3521 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal).type->get());
3523 GEN_ERROR("Cannot make array constant with type: '" +
3524 ((yyvsp[-2].TypeVal).type->get())->getDescription() + "'!");
3526 int NumElements = ATy->getNumElements();
3527 if (NumElements != -1 && NumElements != 0)
3528 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3529 " arguments, but has size of " + itostr(NumElements) +"!");
3530 (yyval.ConstVal).cnst = ConstantArray::get(ATy, std::vector<llvm::Constant*>());
3531 (yyval.ConstVal).signedness = isSignless;
3532 delete (yyvsp[-2].TypeVal).type;
3538 #line 1478 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3540 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal).type->get());
3542 GEN_ERROR("Cannot make array constant with type: '" +
3543 ((yyvsp[-2].TypeVal).type->get())->getDescription() + "'!");
3545 int NumElements = ATy->getNumElements();
3546 const Type *ETy = ATy->getElementType();
3547 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3548 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3549 GEN_ERROR("Can't build string constant of size " +
3550 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3551 " when array has size " + itostr(NumElements) + "!");
3552 std::vector<Constant*> Vals;
3553 if (ETy == Type::SByteTy) {
3554 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3555 Vals.push_back(ConstantInt::get(ETy, *C));
3556 } else if (ETy == Type::UByteTy) {
3557 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3558 C != (unsigned char*)EndStr; ++C)
3559 Vals.push_back(ConstantInt::get(ETy, *C));
3561 free((yyvsp[0].StrVal));
3562 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3564 free((yyvsp[0].StrVal));
3565 (yyval.ConstVal).cnst = ConstantArray::get(ATy, Vals);
3566 (yyval.ConstVal).signedness = isSignless;
3567 delete (yyvsp[-2].TypeVal).type;
3573 #line 1509 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3574 { // Nonempty unsized arr
3575 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal).type->get());
3577 GEN_ERROR("Cannot make packed constant with type: '" +
3578 (yyvsp[-3].TypeVal).type->get()->getDescription() + "'!");
3579 const Type *ETy = PTy->getElementType();
3580 int NumElements = PTy->getNumElements();
3582 // Verify that we have the correct size...
3583 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3584 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3585 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3586 itostr(NumElements) + "!");
3588 // Verify all elements are correct type!
3589 std::vector<Constant*> elems;
3590 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3591 if (ETy != (*(yyvsp[-1].ConstVector))[i].cnst->getType()) {
3592 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3593 ETy->getDescription() +"' as required!\nIt is of type '"+
3594 (*(yyvsp[-1].ConstVector))[i].cnst->getType()->getDescription() + "'.");
3596 elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst);
3599 (yyval.ConstVal).cnst = ConstantPacked::get(PTy, elems);
3600 (yyval.ConstVal).signedness = isSignless;
3601 delete (yyvsp[-3].TypeVal).type; delete (yyvsp[-1].ConstVector);
3607 #line 1539 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3609 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal).type->get());
3611 GEN_ERROR("Cannot make struct constant with type: '" +
3612 (yyvsp[-3].TypeVal).type->get()->getDescription() + "'!");
3614 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3615 GEN_ERROR("Illegal number of initializers for structure type!");
3617 // Check to ensure that constants are compatible with the type initializer!
3618 std::vector<Constant*> elems;
3619 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3620 if ((*(yyvsp[-1].ConstVector))[i].cnst->getType() != STy->getElementType(i)) {
3621 GEN_ERROR("Expected type '" +
3622 STy->getElementType(i)->getDescription() +
3623 "' for element #" + utostr(i) +
3624 " of structure initializer!");
3626 elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst);
3628 (yyval.ConstVal).cnst = ConstantStruct::get(STy, elems);
3629 (yyval.ConstVal).signedness = isSignless;
3630 delete (yyvsp[-3].TypeVal).type; delete (yyvsp[-1].ConstVector);
3636 #line 1564 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3638 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal).type->get());
3640 GEN_ERROR("Cannot make struct constant with type: '" +
3641 (yyvsp[-2].TypeVal).type->get()->getDescription() + "'!");
3643 if (STy->getNumContainedTypes() != 0)
3644 GEN_ERROR("Illegal number of initializers for structure type!");
3646 (yyval.ConstVal).cnst = ConstantStruct::get(STy, std::vector<Constant*>());
3647 (yyval.ConstVal).signedness = isSignless;
3648 delete (yyvsp[-2].TypeVal).type;
3654 #line 1578 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3656 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal).type->get());
3658 GEN_ERROR("Cannot make null pointer constant with type: '" +
3659 (yyvsp[-1].TypeVal).type->get()->getDescription() + "'!");
3661 (yyval.ConstVal).cnst = ConstantPointerNull::get(PTy);
3662 (yyval.ConstVal).signedness = isSignless;
3663 delete (yyvsp[-1].TypeVal).type;
3669 #line 1589 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3671 (yyval.ConstVal).cnst = UndefValue::get((yyvsp[-1].TypeVal).type->get());
3672 (yyval.ConstVal).signedness = isSignless;
3673 delete (yyvsp[-1].TypeVal).type;
3679 #line 1595 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3681 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal).type->get());
3683 GEN_ERROR("Global const reference must be a pointer type!");
3685 // ConstExprs can exist in the body of a function, thus creating
3686 // GlobalValues whenever they refer to a variable. Because we are in
3687 // the context of a function, getValNonImprovising will search the functions
3688 // symbol table instead of the module symbol table for the global symbol,
3689 // which throws things all off. To get around this, we just tell
3690 // getValNonImprovising that we are at global scope here.
3692 Function *SavedCurFn = CurFun.CurrentFunction;
3693 CurFun.CurrentFunction = 0;
3695 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3698 CurFun.CurrentFunction = SavedCurFn;
3700 // If this is an initializer for a constant pointer, which is referencing a
3701 // (currently) undefined variable, create a stub now that shall be replaced
3702 // in the future with the right type of variable.
3705 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3706 const PointerType *PT = cast<PointerType>(Ty);
3708 // First check to see if the forward references value is already created!
3709 PerModuleInfo::GlobalRefsType::iterator I =
3710 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3712 if (I != CurModule.GlobalRefs.end()) {
3713 V = I->second; // Placeholder already exists, use it...
3714 (yyvsp[0].ValIDVal).destroy();
3717 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3719 // Create the forward referenced global.
3721 if (const FunctionType *FTy =
3722 dyn_cast<FunctionType>(PT->getElementType())) {
3723 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3724 CurModule.CurrentModule);
3726 GV = new GlobalVariable(PT->getElementType(), false,
3727 GlobalValue::ExternalLinkage, 0,
3728 Name, CurModule.CurrentModule);
3731 // Keep track of the fact that we have a forward ref to recycle it
3732 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3737 (yyval.ConstVal).cnst = cast<GlobalValue>(V);
3738 (yyval.ConstVal).signedness = (yyvsp[-1].TypeVal).signedness;
3739 delete (yyvsp[-1].TypeVal).type; // Free the type handle
3745 #line 1657 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3747 if ((yyvsp[-1].TypeVal).type->get() != (yyvsp[0].ConstVal).cnst->getType())
3748 GEN_ERROR("Mismatched types for constant expression!");
3749 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3750 delete (yyvsp[-1].TypeVal).type;
3756 #line 1664 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3758 const Type *Ty = (yyvsp[-1].TypeVal).type->get();
3759 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3760 GEN_ERROR("Cannot create a null initialized value of this type!");
3761 (yyval.ConstVal).cnst = Constant::getNullValue(Ty);
3762 (yyval.ConstVal).signedness = isSignless;
3763 delete (yyvsp[-1].TypeVal).type;
3769 #line 1674 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3770 { // integral constants
3771 if (!ConstantInt::isValueValidForType((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].SInt64Val)))
3772 GEN_ERROR("Constant value doesn't fit in type!");
3773 (yyval.ConstVal).cnst = ConstantInt::get((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].SInt64Val));
3774 (yyval.ConstVal).signedness = (yyvsp[-1].TypeVal).signedness;
3780 #line 1681 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3781 { // integral constants
3782 if (!ConstantInt::isValueValidForType((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].UInt64Val)))
3783 GEN_ERROR("Constant value doesn't fit in type!");
3784 (yyval.ConstVal).cnst = ConstantInt::get((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].UInt64Val));
3785 (yyval.ConstVal).signedness = (yyvsp[-1].TypeVal).signedness;
3791 #line 1688 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3792 { // Boolean constants
3793 (yyval.ConstVal).cnst = ConstantBool::getTrue();
3794 (yyval.ConstVal).signedness = isSignless;
3800 #line 1693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3801 { // Boolean constants
3802 (yyval.ConstVal).cnst = ConstantBool::getFalse();
3803 (yyval.ConstVal).signedness = isSignless;
3809 #line 1698 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3810 { // Float & Double constants
3811 if (!ConstantFP::isValueValidForType((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].FPVal)))
3812 GEN_ERROR("Floating point constant invalid for type!!");
3813 (yyval.ConstVal).cnst = ConstantFP::get((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].FPVal));
3814 (yyval.ConstVal).signedness = isSignless;
3820 #line 1707 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3822 Constant *Val = (yyvsp[-3].ConstVal).cnst;
3823 const Type *Ty = (yyvsp[-1].TypeVal).type->get();
3824 if (!Val->getType()->isFirstClassType())
3825 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3826 Val->getType()->getDescription() + "'!");
3827 if (!Ty->isFirstClassType())
3828 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3829 Ty->getDescription() + "'!");
3830 if ((yyvsp[-5].CastOpVal).obsolete) {
3831 if (Ty == Type::BoolTy) {
3832 // The previous definition of cast to bool was a compare against zero.
3833 // We have to retain that semantic so we do it here.
3834 (yyval.ConstVal).cnst = ConstantExpr::get(Instruction::SetNE, Val,
3835 Constant::getNullValue(Val->getType()));
3836 } else if (Val->getType()->isFloatingPoint() && isa<PointerType>(Ty)) {
3837 Constant *CE = ConstantExpr::getFPToUI(Val, Type::ULongTy);
3838 (yyval.ConstVal).cnst = ConstantExpr::getIntToPtr(CE, Ty);
3840 (yyval.ConstVal).cnst = ConstantExpr::getCast(Val, Ty);
3843 (yyval.ConstVal).cnst = ConstantExpr::getCast((yyvsp[-5].CastOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].TypeVal).type->get());
3845 delete (yyvsp[-1].TypeVal).type;
3850 #line 1733 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3852 if (!isa<PointerType>((yyvsp[-2].ConstVal).cnst->getType()))
3853 GEN_ERROR("GetElementPtr requires a pointer operand!");
3855 std::vector<llvm::Value*> IdxVec;
3856 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i < e; ++i)
3857 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i].val))
3858 IdxVec.push_back(C);
3860 GEN_ERROR("Indices to constant getelementptr must be constants!");
3863 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal).cnst->getType(), IdxVec, true);
3865 GEN_ERROR("Index list invalid for constant getelementptr!");
3867 delete (yyvsp[-1].ValueList);
3869 (yyval.ConstVal).cnst = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal).cnst, IdxVec);
3870 (yyval.ConstVal).signedness = isSignless;
3876 #line 1755 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3878 if ((yyvsp[-5].ConstVal).cnst->getType() != Type::BoolTy)
3879 GEN_ERROR("Select condition must be of boolean type!");
3880 if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType())
3881 GEN_ERROR("Select operand types must match!");
3882 (yyval.ConstVal).cnst = ConstantExpr::getSelect((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3883 (yyval.ConstVal).signedness = isSignless;
3889 #line 1764 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3891 if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType())
3892 GEN_ERROR("Binary operator types must match!");
3893 // First, make sure we're dealing with the right opcode by upgrading from
3894 // obsolete versions.
3895 sanitizeOpcode((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal).cnst->getType());
3898 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
3899 // To retain backward compatibility with these early compilers, we emit a
3900 // cast to the appropriate integer type automatically if we are in the
3901 // broken case. See PR424 for more information.
3902 if (!isa<PointerType>((yyvsp[-3].ConstVal).cnst->getType())) {
3903 (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3905 const Type *IntPtrTy = 0;
3906 switch (CurModule.CurrentModule->getPointerSize()) {
3907 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
3908 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
3909 default: GEN_ERROR("invalid pointer binary constant expr!");
3911 (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode,
3912 ConstantExpr::getCast((yyvsp[-3].ConstVal).cnst, IntPtrTy),
3913 ConstantExpr::getCast((yyvsp[-1].ConstVal).cnst, IntPtrTy));
3914 (yyval.ConstVal).cnst = ConstantExpr::getCast((yyval.ConstVal).cnst, (yyvsp[-3].ConstVal).cnst->getType());
3916 (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness;
3922 #line 1793 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3924 if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType())
3925 GEN_ERROR("Logical operator types must match!");
3926 if (!(yyvsp[-3].ConstVal).cnst->getType()->isIntegral()) {
3927 if (!isa<PackedType>((yyvsp[-3].ConstVal).cnst->getType()) ||
3928 !cast<PackedType>((yyvsp[-3].ConstVal).cnst->getType())->getElementType()->isIntegral())
3929 GEN_ERROR("Logical operator requires integral operands!");
3931 (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3932 (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness;
3938 #line 1805 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3940 if ((yyvsp[-3].ConstVal).cnst->getType() != (yyvsp[-1].ConstVal).cnst->getType())
3941 GEN_ERROR("setcc operand types must match!");
3942 (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3943 (yyval.ConstVal).signedness = isSignless;
3949 #line 1812 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3951 if ((yyvsp[-1].ConstVal).cnst->getType() != Type::UByteTy)
3952 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3953 if (!(yyvsp[-3].ConstVal).cnst->getType()->isInteger())
3954 GEN_ERROR("Shift constant expression requires integer operand!");
3955 // Handle opcode upgrade situations
3956 sanitizeOpcode((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal).cnst->getType());
3958 (yyval.ConstVal).cnst = ConstantExpr::get((yyvsp[-5].OtherOpVal).opcode, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3959 (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness;
3965 #line 1824 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3967 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst))
3968 GEN_ERROR("Invalid extractelement operands!");
3969 (yyval.ConstVal).cnst = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3970 (yyval.ConstVal).signedness = (yyvsp[-3].ConstVal).signedness;
3976 #line 1831 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3978 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst))
3979 GEN_ERROR("Invalid insertelement operands!");
3980 (yyval.ConstVal).cnst = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3981 (yyval.ConstVal).signedness = isSignless;
3987 #line 1838 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3989 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst))
3990 GEN_ERROR("Invalid shufflevector operands!");
3991 (yyval.ConstVal).cnst = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal).cnst, (yyvsp[-3].ConstVal).cnst, (yyvsp[-1].ConstVal).cnst);
3992 (yyval.ConstVal).signedness = isSignless;
3998 #line 1848 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4000 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4006 #line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4008 (yyval.ConstVector) = new std::vector<ConstInfo>();
4009 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4015 #line 1860 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4016 { (yyval.BoolVal) = false; ;}
4020 #line 1860 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4021 { (yyval.BoolVal) = true; ;}
4025 #line 1870 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4027 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
4028 CurModule.ModuleDone();
4034 #line 1878 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4036 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4037 CurFun.FunctionDone();
4043 #line 1883 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4045 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4051 #line 1887 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4053 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
4059 #line 1891 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4061 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4067 #line 1895 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4069 (yyval.ModuleVal) = CurModule.CurrentModule;
4070 // Emit an error if there are any unresolved types left.
4071 if (!CurModule.LateResolveTypes.empty()) {
4072 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4073 if (DID.Type == ValID::NameVal) {
4074 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4076 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4084 #line 1910 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4086 // Eagerly resolve types. This is not an optimization, this is a
4087 // requirement that is due to the fact that we could have this:
4089 // %list = type { %list * }
4090 // %list = type { %list * } ; repeated type decl
4092 // If types are not resolved eagerly, then the two types will not be
4093 // determined to be the same type!
4095 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].TypeVal).type->get());
4097 if (!setTypeName((yyvsp[0].TypeVal).type->get(), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4099 // If this is a named type that is not a redefinition, add it to the slot
4101 CurModule.Types.push_back(*((yyvsp[0].TypeVal).type));
4103 delete (yyvsp[0].TypeVal).type;
4110 #line 1932 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4111 { // Function prototypes can be in const pool
4117 #line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4118 { // Asm blocks can be in the const pool
4124 #line 1938 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4126 if ((yyvsp[0].ConstVal).cnst == 0)
4127 GEN_ERROR("Global value initializer is not a constant!");
4128 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal).cnst->getType(), (yyvsp[0].ConstVal).cnst);
4134 #line 1943 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4141 #line 1946 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4143 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal),
4144 (yyvsp[0].TypeVal).type->get(), 0);
4146 delete (yyvsp[0].TypeVal).type;
4151 #line 1951 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4159 #line 1955 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4161 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal),
4162 (yyvsp[0].TypeVal).type->get(), 0);
4164 delete (yyvsp[0].TypeVal).type;
4169 #line 1960 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4177 #line 1964 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4180 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal),
4181 (yyvsp[0].TypeVal).type->get(), 0);
4183 delete (yyvsp[0].TypeVal).type;
4188 #line 1970 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4196 #line 1974 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4203 #line 1977 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4210 #line 1980 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4216 #line 1984 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4218 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4219 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4220 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4221 free((yyvsp[0].StrVal));
4223 if (AsmSoFar.empty())
4224 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4226 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4232 #line 1997 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4233 { (yyval.Endianness) = Module::BigEndian; ;}
4237 #line 1998 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4238 { (yyval.Endianness) = Module::LittleEndian; ;}
4242 #line 2000 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4244 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4250 #line 2004 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4252 if ((yyvsp[0].UInt64Val) == 32)
4253 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4254 else if ((yyvsp[0].UInt64Val) == 64)
4255 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4257 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4263 #line 2013 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4265 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4266 free((yyvsp[0].StrVal));
4271 #line 2017 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4273 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4274 free((yyvsp[0].StrVal));
4279 #line 2024 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4281 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4282 free((yyvsp[0].StrVal));
4288 #line 2029 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4290 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4291 free((yyvsp[0].StrVal));
4297 #line 2034 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4304 #line 2044 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4305 { (yyval.StrVal) = 0; ;}
4309 #line 2046 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4311 if ((yyvsp[-1].TypeVal).type->get() == Type::VoidTy)
4312 GEN_ERROR("void typed arguments are invalid!");
4313 (yyval.ArgVal) = new std::pair<TypeInfo, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4319 #line 2053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4321 (yyval.ArgList) = (yyvsp[-2].ArgList);
4322 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4323 delete (yyvsp[0].ArgVal);
4329 #line 2059 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4331 (yyval.ArgList) = new std::vector<std::pair<TypeInfo,char*> >();
4332 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4333 delete (yyvsp[0].ArgVal);
4339 #line 2066 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4341 (yyval.ArgList) = (yyvsp[0].ArgList);
4347 #line 2070 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4349 (yyval.ArgList) = (yyvsp[-2].ArgList);
4351 TI.type = new PATypeHolder(Type::VoidTy);
4352 TI.signedness = isSignless;
4353 (yyval.ArgList)->push_back(std::pair<TypeInfo,char*>(TI,(char*)0));
4359 #line 2078 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4361 (yyval.ArgList) = new std::vector<std::pair<TypeInfo,char*> >();
4363 TI.type = new PATypeHolder(Type::VoidTy);
4364 TI.signedness = isSignless;
4365 (yyval.ArgList)->push_back(std::make_pair(TI, (char*)0));
4371 #line 2086 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4373 (yyval.ArgList) = 0;
4379 #line 2092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4381 UnEscapeLexed((yyvsp[-5].StrVal));
4382 std::string FunctionName((yyvsp[-5].StrVal));
4383 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4385 if (!((yyvsp[-6].TypeVal).type->get())->isFirstClassType() && (yyvsp[-6].TypeVal).type->get() != Type::VoidTy)
4386 GEN_ERROR("LLVM functions cannot return aggregate types!");
4388 std::vector<const Type*> ParamTypeList;
4389 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4390 for (std::vector<std::pair<TypeInfo,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4391 I != (yyvsp[-3].ArgList)->end(); ++I)
4392 ParamTypeList.push_back(I->first.type->get());
4395 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4396 if (isVarArg) ParamTypeList.pop_back();
4398 const FunctionType *FT = FunctionType::get((yyvsp[-6].TypeVal).type->get(), ParamTypeList,
4400 const PointerType *PFT = PointerType::get(FT);
4401 delete (yyvsp[-6].TypeVal).type;
4404 if (!FunctionName.empty()) {
4405 ID = ValID::create((char*)FunctionName.c_str());
4407 ID = ValID::create((int)CurModule.Values[PFT].size());
4411 // See if this function was forward referenced. If so, recycle the object.
4412 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4413 // Move the function to the end of the list, from whereever it was
4414 // previously inserted.
4415 Fn = cast<Function>(FWRef);
4416 CurModule.CurrentModule->getFunctionList().remove(Fn);
4417 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4418 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4419 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4420 // If this is the case, either we need to be a forward decl, or it needs
4422 if (!CurFun.isDeclare && !Fn->isExternal())
4423 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4425 // Make sure to strip off any argument names so we can't get conflicts.
4426 if (Fn->isExternal())
4427 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4430 } else { // Not already defined?
4431 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4432 CurModule.CurrentModule);
4434 InsertValue(Fn, CurModule.Values);
4437 CurFun.FunctionStart(Fn);
4439 if (CurFun.isDeclare) {
4440 // If we have declaration, always overwrite linkage. This will allow us to
4441 // correctly handle cases, when pointer to function is passed as argument to
4442 // another function.
4443 Fn->setLinkage(CurFun.Linkage);
4445 Fn->setCallingConv((yyvsp[-7].UIntVal));
4446 Fn->setAlignment((yyvsp[0].UIntVal));
4447 if ((yyvsp[-1].StrVal)) {
4448 Fn->setSection((yyvsp[-1].StrVal));
4449 free((yyvsp[-1].StrVal));
4452 // Add all of the arguments we parsed to the function...
4453 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4454 if (isVarArg) { // Nuke the last entry
4455 assert((yyvsp[-3].ArgList)->back().first.type->get() == Type::VoidTy &&
4456 (yyvsp[-3].ArgList)->back().second == 0 && "Not a varargs marker!");
4457 delete (yyvsp[-3].ArgList)->back().first.type;
4458 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4460 Function::arg_iterator ArgIt = Fn->arg_begin();
4461 for (std::vector<std::pair<TypeInfo,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4462 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4463 delete I->first.type; // Delete the typeholder...
4464 setValueName(ArgIt, I->second); // Insert arg into symtab...
4468 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4475 #line 2187 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4477 (yyval.FunctionVal) = CurFun.CurrentFunction;
4479 // Make sure that we keep track of the linkage type even if there was a
4480 // previous "declare".
4481 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4486 #line 2197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4488 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4494 #line 2203 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4495 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4499 #line 2204 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4500 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4504 #line 2206 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4505 { CurFun.isDeclare = true; ;}
4509 #line 2206 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4511 (yyval.FunctionVal) = CurFun.CurrentFunction;
4512 CurFun.FunctionDone();
4518 #line 2216 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4520 (yyval.BoolVal) = false;
4526 #line 2220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4528 (yyval.BoolVal) = true;
4534 #line 2225 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4535 { // A reference to a direct constant
4536 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4542 #line 2229 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4544 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4550 #line 2233 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4551 { // Perhaps it's an FP constant?
4552 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4558 #line 2237 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4560 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4566 #line 2241 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4568 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4574 #line 2245 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4576 (yyval.ValIDVal) = ValID::createNull();
4582 #line 2249 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4584 (yyval.ValIDVal) = ValID::createUndef();
4590 #line 2253 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4591 { // A vector zero constant.
4592 (yyval.ValIDVal) = ValID::createZeroInit();
4598 #line 2257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4599 { // Nonempty unsized packed vector
4600 const Type *ETy = (*(yyvsp[-1].ConstVector))[0].cnst->getType();
4601 int NumElements = (yyvsp[-1].ConstVector)->size();
4603 PackedType* pt = PackedType::get(ETy, NumElements);
4604 PATypeHolder* PTy = new PATypeHolder(
4605 HandleUpRefs(PackedType::get( ETy, NumElements)));
4607 // Verify all elements are correct type!
4608 std::vector<Constant*> elems;
4609 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4610 if (ETy != (*(yyvsp[-1].ConstVector))[i].cnst->getType()) {
4611 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4612 ETy->getDescription() +"' as required!\nIt is of type '" +
4613 (*(yyvsp[-1].ConstVector))[i].cnst->getType()->getDescription() + "'.");
4615 elems.push_back((*(yyvsp[-1].ConstVector))[i].cnst);
4618 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, elems));
4619 delete PTy; delete (yyvsp[-1].ConstVector);
4625 #line 2280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4627 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal).cnst);
4633 #line 2284 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4635 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4636 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4637 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4638 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4639 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4640 free((yyvsp[-2].StrVal));
4641 free((yyvsp[0].StrVal));
4647 #line 2298 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4648 { // Is it an integer reference...?
4649 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4655 #line 2302 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4656 { // Is it a named reference...?
4657 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4663 #line 2314 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4665 (yyval.ValueVal).val = getVal((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].ValIDVal));
4666 delete (yyvsp[-1].TypeVal).type;
4668 (yyval.ValueVal).signedness = (yyvsp[-1].TypeVal).signedness;
4673 #line 2321 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4675 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4681 #line 2325 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4682 { // Do not allow functions with 0 basic blocks
4683 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4689 #line 2334 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4691 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4693 InsertValue((yyvsp[0].TermInstVal));
4695 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4696 InsertValue((yyvsp[-2].BasicBlockVal));
4697 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4703 #line 2345 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4705 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4706 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4707 if (CI2->getParent() == 0)
4708 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4709 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4710 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4716 #line 2354 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4718 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4721 // Make sure to move the basic block to the correct location in the
4722 // function, instead of leaving it inserted wherever it was first
4724 Function::BasicBlockListType &BBL =
4725 CurFun.CurrentFunction->getBasicBlockList();
4726 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4732 #line 2366 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4734 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4737 // Make sure to move the basic block to the correct location in the
4738 // function, instead of leaving it inserted wherever it was first
4740 Function::BasicBlockListType &BBL =
4741 CurFun.CurrentFunction->getBasicBlockList();
4742 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4748 #line 2379 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4749 { // Return with a result...
4750 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal).val);
4756 #line 2383 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4757 { // Return with no result...
4758 (yyval.TermInstVal) = new ReturnInst();
4764 #line 2387 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4765 { // Unconditional Branch...
4766 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4768 (yyval.TermInstVal) = new BranchInst(tmpBB);
4773 #line 2392 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4775 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4777 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4779 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4781 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4786 #line 2401 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4788 Value* tmpVal = getVal((yyvsp[-7].TypeVal).type->get(), (yyvsp[-6].ValIDVal));
4790 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4792 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4793 (yyval.TermInstVal) = S;
4795 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4796 E = (yyvsp[-1].JumpTable)->end();
4797 for (; I != E; ++I) {
4798 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4799 S->addCase(CI, I->second);
4801 GEN_ERROR("Switch case is constant, but not a simple integer!");
4803 delete (yyvsp[-1].JumpTable);
4809 #line 2420 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4811 Value* tmpVal = getVal((yyvsp[-6].TypeVal).type->get(), (yyvsp[-5].ValIDVal));
4813 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4815 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4816 (yyval.TermInstVal) = S;
4822 #line 2430 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4824 const PointerType *PFTy;
4825 const FunctionType *Ty;
4827 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal).type->get())) ||
4828 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4829 // Pull out the types of all of the arguments...
4830 std::vector<const Type*> ParamTypes;
4831 if ((yyvsp[-7].ValueList)) {
4832 for (std::vector<ValueInfo>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4834 ParamTypes.push_back((*I).val->getType());
4837 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4838 if (isVarArg) ParamTypes.pop_back();
4840 Ty = FunctionType::get((yyvsp[-10].TypeVal).type->get(), ParamTypes, isVarArg);
4841 PFTy = PointerType::get(Ty);
4844 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4846 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4848 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4851 // Create the call node...
4852 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4853 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4854 } else { // Has arguments?
4855 // Loop through FunctionType's arguments and ensure they are specified
4858 FunctionType::param_iterator I = Ty->param_begin();
4859 FunctionType::param_iterator E = Ty->param_end();
4860 std::vector<ValueInfo>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4862 std::vector<Value*> args;
4863 for (; ArgI != ArgE; ++ArgI)
4865 if (Ty->isVarArg()) {
4866 args.push_back((*ArgI).val);
4868 GEN_ERROR("Too many parameters for function of type " +
4869 Ty->getDescription());
4872 if ((*ArgI).val->getType() != *I) {
4873 GEN_ERROR("Parameter " + (*ArgI).val->getName() +
4874 " is not of type '" + (*I)->getDescription() + "'!");
4876 args.push_back((*ArgI).val);
4879 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, args);
4881 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4883 delete (yyvsp[-10].TypeVal).type;
4884 delete (yyvsp[-7].ValueList);
4890 #line 2494 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4892 (yyval.TermInstVal) = new UnwindInst();
4898 #line 2498 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4900 (yyval.TermInstVal) = new UnreachableInst();
4906 #line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4908 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4909 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].TypeVal).type->get(), (yyvsp[-3].ValIDVal)));
4912 GEN_ERROR("May only switch on a constant pool value!");
4914 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4916 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4921 #line 2516 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4923 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4924 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].TypeVal).type->get(), (yyvsp[-3].ValIDVal)));
4928 GEN_ERROR("May only switch on a constant pool value!");
4930 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4932 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4937 #line 2529 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4939 // Is this definition named?? if so, assign the name...
4940 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
4942 InsertValue((yyvsp[0].InstVal));
4943 (yyval.InstVal) = (yyvsp[0].InstVal);
4949 #line 2538 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4950 { // Used for PHI nodes
4951 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
4952 Value* tmpVal = getVal((yyvsp[-5].TypeVal).type->get(), (yyvsp[-3].ValIDVal));
4954 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4956 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4957 delete (yyvsp[-5].TypeVal).type;
4962 #line 2547 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4964 (yyval.PHIList) = (yyvsp[-6].PHIList);
4965 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
4967 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4969 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4974 #line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4975 { // Used for call statements, and memory insts...
4976 (yyval.ValueList) = new std::vector<ValueInfo>();
4977 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
4982 #line 2561 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4984 (yyval.ValueList) = (yyvsp[-2].ValueList);
4985 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
4991 #line 2568 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4993 (yyval.ValueList) = (yyvsp[0].ValueList);
4998 #line 2571 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5000 (yyval.ValueList) = 0;
5005 #line 2575 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5007 (yyval.BoolVal) = true;
5013 #line 2579 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5015 (yyval.BoolVal) = false;
5021 #line 2584 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5023 if (!(yyvsp[-3].TypeVal).type->get()->isInteger() && !(yyvsp[-3].TypeVal).type->get()->isFloatingPoint() &&
5024 !isa<PackedType>((yyvsp[-3].TypeVal).type->get()))
5026 "Arithmetic operator requires integer, FP, or packed operands!");
5027 if (isa<PackedType>((yyvsp[-3].TypeVal).type->get()) &&
5028 ((yyvsp[-4].BinaryOpVal).opcode == Instruction::URem ||
5029 (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem ||
5030 (yyvsp[-4].BinaryOpVal).opcode == Instruction::FRem))
5031 GEN_ERROR("U/S/FRem not supported on packed types!");
5032 // Upgrade the opcode from obsolete versions before we do anything with it.
5033 sanitizeOpcode((yyvsp[-4].BinaryOpVal),(yyvsp[-3].TypeVal).type->get());
5035 Value* val1 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[-2].ValIDVal));
5037 Value* val2 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[0].ValIDVal));
5039 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, val1, val2);
5040 if ((yyval.InstVal) == 0)
5041 GEN_ERROR("binary operator returned null!");
5042 delete (yyvsp[-3].TypeVal).type;
5047 #line 2606 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5049 if (!(yyvsp[-3].TypeVal).type->get()->isIntegral()) {
5050 if (!isa<PackedType>((yyvsp[-3].TypeVal).type->get()) ||
5051 !cast<PackedType>((yyvsp[-3].TypeVal).type->get())->getElementType()->isIntegral())
5052 GEN_ERROR("Logical operator requires integral operands!");
5054 Value* tmpVal1 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[-2].ValIDVal));
5056 Value* tmpVal2 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[0].ValIDVal));
5058 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2);
5059 if ((yyval.InstVal) == 0)
5060 GEN_ERROR("binary operator returned null!");
5061 delete (yyvsp[-3].TypeVal).type;
5066 #line 2621 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5068 if(isa<PackedType>((yyvsp[-3].TypeVal).type->get())) {
5070 "PackedTypes currently not supported in setcc instructions!");
5072 Value* tmpVal1 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[-2].ValIDVal));
5074 Value* tmpVal2 = getVal((yyvsp[-3].TypeVal).type->get(), (yyvsp[0].ValIDVal));
5076 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2);
5077 if ((yyval.InstVal) == 0)
5078 GEN_ERROR("binary operator returned null!");
5079 delete (yyvsp[-3].TypeVal).type;
5084 #line 2635 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5086 std::cerr << "WARNING: Use of eliminated 'not' instruction:"
5087 << " Replacing with 'xor'.\n";
5089 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal).val->getType());
5091 GEN_ERROR("Expected integral type for not instruction!");
5093 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal).val, Ones);
5094 if ((yyval.InstVal) == 0)
5095 GEN_ERROR("Could not create a xor instruction!");
5101 #line 2648 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5103 if ((yyvsp[0].ValueVal).val->getType() != Type::UByteTy)
5104 GEN_ERROR("Shift amount must be ubyte!");
5105 if (!(yyvsp[-2].ValueVal).val->getType()->isInteger())
5106 GEN_ERROR("Shift constant expression requires integer operand!");
5107 // Handle opcode upgrade situations
5108 sanitizeOpcode((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal).val->getType());
5110 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal).opcode, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val);
5116 #line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5118 Value* Val = (yyvsp[-2].ValueVal).val;
5119 const Type* Ty = (yyvsp[0].TypeVal).type->get();
5120 if (!Val->getType()->isFirstClassType())
5121 GEN_ERROR("cast from a non-primitive type: '" +
5122 Val->getType()->getDescription() + "'!");
5123 if (!Ty->isFirstClassType())
5124 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5126 if ((yyvsp[-3].CastOpVal).obsolete) {
5127 if (Ty == Type::BoolTy) {
5128 // The previous definition of cast to bool was a compare against zero.
5129 // We have to retain that semantic so we do it here.
5130 (yyval.InstVal) = new SetCondInst(Instruction::SetNE, (yyvsp[-2].ValueVal).val,
5131 Constant::getNullValue((yyvsp[-2].ValueVal).val->getType()));
5132 } else if (Val->getType()->isFloatingPoint() && isa<PointerType>(Ty)) {
5133 CastInst *CI = new FPToUIInst(Val, Type::ULongTy);
5134 (yyval.InstVal) = new IntToPtrInst(CI, Ty);
5136 (yyval.InstVal) = CastInst::createInferredCast(Val, Ty);
5139 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal).opcode, (yyvsp[-2].ValueVal).val, (yyvsp[0].TypeVal).type->get());
5141 delete (yyvsp[0].TypeVal).type;
5146 #line 2685 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5148 if ((yyvsp[-4].ValueVal).val->getType() != Type::BoolTy)
5149 GEN_ERROR("select condition must be boolean!");
5150 if ((yyvsp[-2].ValueVal).val->getType() != (yyvsp[0].ValueVal).val->getType())
5151 GEN_ERROR("select value types should match!");
5152 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val);
5158 #line 2693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5161 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal).val, (yyvsp[0].TypeVal).type->get());
5162 delete (yyvsp[0].TypeVal).type;
5168 #line 2699 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5170 ObsoleteVarArgs = true;
5171 const Type* ArgTy = (yyvsp[-2].ValueVal).val->getType();
5172 Function* NF = CurModule.CurrentModule->
5173 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5176 //foo = alloca 1 of t
5180 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
5181 CurBB->getInstList().push_back(foo);
5182 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal).val);
5183 CurBB->getInstList().push_back(bar);
5184 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5185 (yyval.InstVal) = new VAArgInst(foo, (yyvsp[0].TypeVal).type->get());
5186 delete (yyvsp[0].TypeVal).type;
5192 #line 2719 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5194 ObsoleteVarArgs = true;
5195 const Type* ArgTy = (yyvsp[-2].ValueVal).val->getType();
5196 Function* NF = CurModule.CurrentModule->
5197 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5199 //b = vanext a, t ->
5200 //foo = alloca 1 of t
5203 //tmp = vaarg foo, t
5205 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
5206 CurBB->getInstList().push_back(foo);
5207 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal).val);
5208 CurBB->getInstList().push_back(bar);
5209 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5210 Instruction* tmp = new VAArgInst(foo, (yyvsp[0].TypeVal).type->get());
5211 CurBB->getInstList().push_back(tmp);
5212 (yyval.InstVal) = new LoadInst(foo);
5213 delete (yyvsp[0].TypeVal).type;
5219 #line 2742 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5221 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val))
5222 GEN_ERROR("Invalid extractelement operands!");
5223 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val);
5229 #line 2748 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5231 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val))
5232 GEN_ERROR("Invalid insertelement operands!");
5233 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val);
5239 #line 2754 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5241 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val))
5242 GEN_ERROR("Invalid shufflevector operands!");
5243 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal).val, (yyvsp[-2].ValueVal).val, (yyvsp[0].ValueVal).val);
5249 #line 2760 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5251 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5252 if (!Ty->isFirstClassType())
5253 GEN_ERROR("PHI node operands must be of first class type!");
5254 (yyval.InstVal) = new PHINode(Ty);
5255 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5256 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5257 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5258 GEN_ERROR("All elements of a PHI node must be of the same type!");
5259 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5260 (yyvsp[0].PHIList)->pop_front();
5262 delete (yyvsp[0].PHIList); // Free the list...
5268 #line 2775 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5270 const PointerType *PFTy = 0;
5271 const FunctionType *Ty = 0;
5273 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal).type->get())) ||
5274 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5275 // Pull out the types of all of the arguments...
5276 std::vector<const Type*> ParamTypes;
5277 if ((yyvsp[-1].ValueList)) {
5278 for (std::vector<ValueInfo>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5280 ParamTypes.push_back((*I).val->getType());
5283 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5284 if (isVarArg) ParamTypes.pop_back();
5286 if (!(yyvsp[-4].TypeVal).type->get()->isFirstClassType() &&
5287 (yyvsp[-4].TypeVal).type->get() != Type::VoidTy)
5288 GEN_ERROR("LLVM functions cannot return aggregate types!");
5290 Ty = FunctionType::get((yyvsp[-4].TypeVal).type->get(), ParamTypes, isVarArg);
5291 PFTy = PointerType::get(Ty);
5294 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5297 // Create the call node...
5298 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5299 // Make sure no arguments is a good thing!
5300 if (Ty->getNumParams() != 0)
5301 GEN_ERROR("No arguments passed to a function that "
5302 "expects arguments!");
5304 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5305 } else { // Has arguments?
5306 // Loop through FunctionType's arguments and ensure they are specified
5309 FunctionType::param_iterator I = Ty->param_begin();
5310 FunctionType::param_iterator E = Ty->param_end();
5311 std::vector<ValueInfo>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5313 std::vector<Value*> args;
5314 for (; ArgI != ArgE ; ++ArgI)
5316 if (Ty->isVarArg()) {
5317 args.push_back((*ArgI).val);
5319 GEN_ERROR("Too many parameters for function of type " +
5320 Ty->getDescription());
5323 if ((*ArgI).val->getType() != *I) {
5324 GEN_ERROR("Parameter " + (*ArgI).val->getName() +
5325 " is not of type '" + (*I)->getDescription() + "'!");
5327 args.push_back((*ArgI).val);
5331 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5332 GEN_ERROR("Invalid number of parameters detected!");
5334 (yyval.InstVal) = new CallInst(V, args);
5336 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5337 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5338 delete (yyvsp[-4].TypeVal).type;
5339 delete (yyvsp[-1].ValueList);
5345 #line 2848 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5347 (yyval.InstVal) = (yyvsp[0].InstVal);
5353 #line 2855 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5355 (yyval.ValueList) = (yyvsp[0].ValueList);
5361 #line 2858 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5363 (yyval.ValueList) = new std::vector<ValueInfo>();
5369 #line 2863 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5371 (yyval.BoolVal) = true;
5377 #line 2867 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5379 (yyval.BoolVal) = false;
5385 #line 2874 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5387 (yyval.InstVal) = new MallocInst((yyvsp[-1].TypeVal).type->get(), 0, (yyvsp[0].UIntVal));
5388 delete (yyvsp[-1].TypeVal).type;
5394 #line 2879 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5396 Value* tmpVal = getVal((yyvsp[-2].TypeVal).type->get(), (yyvsp[-1].ValIDVal));
5398 (yyval.InstVal) = new MallocInst((yyvsp[-4].TypeVal).type->get(), tmpVal, (yyvsp[0].UIntVal));
5399 delete (yyvsp[-4].TypeVal).type;
5404 #line 2885 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5406 (yyval.InstVal) = new AllocaInst((yyvsp[-1].TypeVal).type->get(), 0, (yyvsp[0].UIntVal));
5407 delete (yyvsp[-1].TypeVal).type;
5413 #line 2890 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5415 Value* tmpVal = getVal((yyvsp[-2].TypeVal).type->get(), (yyvsp[-1].ValIDVal));
5417 (yyval.InstVal) = new AllocaInst((yyvsp[-4].TypeVal).type->get(), tmpVal, (yyvsp[0].UIntVal));
5418 delete (yyvsp[-4].TypeVal).type;
5423 #line 2896 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5425 if (!isa<PointerType>((yyvsp[0].ValueVal).val->getType()))
5426 GEN_ERROR("Trying to free nonpointer type " +
5427 (yyvsp[0].ValueVal).val->getType()->getDescription() + "!");
5428 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal).val);
5434 #line 2904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5436 if (!isa<PointerType>((yyvsp[-1].TypeVal).type->get()))
5437 GEN_ERROR("Can't load from nonpointer type: " +
5438 (yyvsp[-1].TypeVal).type->get()->getDescription());
5439 if (!cast<PointerType>((yyvsp[-1].TypeVal).type->get())->getElementType()->isFirstClassType())
5440 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5441 (yyvsp[-1].TypeVal).type->get()->getDescription());
5442 Value* tmpVal = getVal((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].ValIDVal));
5444 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5445 delete (yyvsp[-1].TypeVal).type;
5450 #line 2916 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5452 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal).type->get());
5454 GEN_ERROR("Can't store to a nonpointer type: " +
5455 ((yyvsp[-1].TypeVal).type->get())->getDescription());
5456 const Type *ElTy = PT->getElementType();
5457 if (ElTy != (yyvsp[-3].ValueVal).val->getType())
5458 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal).val->getType()->getDescription() +
5459 "' into space of type '" + ElTy->getDescription() + "'!");
5461 Value* tmpVal = getVal((yyvsp[-1].TypeVal).type->get(), (yyvsp[0].ValIDVal));
5463 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal).val, tmpVal, (yyvsp[-5].BoolVal));
5464 delete (yyvsp[-1].TypeVal).type;
5469 #line 2931 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5471 if (!isa<PointerType>((yyvsp[-2].TypeVal).type->get()))
5472 GEN_ERROR("getelementptr insn requires pointer operand!");
5474 std::vector<Value*> indices;
5475 for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e; ++i)
5476 indices.push_back((*(yyvsp[0].ValueList))[i].val);
5478 if (!GetElementPtrInst::getIndexedType((yyvsp[-2].TypeVal).type->get(), indices, true))
5479 GEN_ERROR("Invalid getelementptr indices for type '" +
5480 (yyvsp[-2].TypeVal).type->get()->getDescription()+ "'!");
5481 Value* tmpVal = getVal((yyvsp[-2].TypeVal).type->get(), (yyvsp[-1].ValIDVal));
5483 (yyval.InstVal) = new GetElementPtrInst(tmpVal, indices);
5484 delete (yyvsp[-2].TypeVal).type;
5485 delete (yyvsp[0].ValueList);
5493 /* Line 1126 of yacc.c. */
5494 #line 5495 "llvmAsmParser.tab.c"
5500 YY_STACK_PRINT (yyss, yyssp);
5505 /* Now `shift' the result of the reduction. Determine what state
5506 that goes to, based on the state we popped back to and the rule
5507 number reduced by. */
5511 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5512 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5513 yystate = yytable[yystate];
5515 yystate = yydefgoto[yyn - YYNTOKENS];
5520 /*------------------------------------.
5521 | yyerrlab -- here on detecting error |
5522 `------------------------------------*/
5524 /* If not already recovering from an error, report this error. */
5529 yyn = yypact[yystate];
5531 if (YYPACT_NINF < yyn && yyn < YYLAST)
5533 int yytype = YYTRANSLATE (yychar);
5534 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5535 YYSIZE_T yysize = yysize0;
5537 int yysize_overflow = 0;
5539 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5540 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5544 /* This is so xgettext sees the translatable formats that are
5545 constructed on the fly. */
5546 YY_("syntax error, unexpected %s");
5547 YY_("syntax error, unexpected %s, expecting %s");
5548 YY_("syntax error, unexpected %s, expecting %s or %s");
5549 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5550 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5554 static char const yyunexpected[] = "syntax error, unexpected %s";
5555 static char const yyexpecting[] = ", expecting %s";
5556 static char const yyor[] = " or %s";
5557 char yyformat[sizeof yyunexpected
5558 + sizeof yyexpecting - 1
5559 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5560 * (sizeof yyor - 1))];
5561 char const *yyprefix = yyexpecting;
5563 /* Start YYX at -YYN if negative to avoid negative indexes in
5565 int yyxbegin = yyn < 0 ? -yyn : 0;
5567 /* Stay within bounds of both yycheck and yytname. */
5568 int yychecklim = YYLAST - yyn;
5569 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5572 yyarg[0] = yytname[yytype];
5573 yyfmt = yystpcpy (yyformat, yyunexpected);
5575 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5576 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5578 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5582 yyformat[sizeof yyunexpected - 1] = '\0';
5585 yyarg[yycount++] = yytname[yyx];
5586 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5587 yysize_overflow |= yysize1 < yysize;
5589 yyfmt = yystpcpy (yyfmt, yyprefix);
5593 yyf = YY_(yyformat);
5594 yysize1 = yysize + yystrlen (yyf);
5595 yysize_overflow |= yysize1 < yysize;
5598 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5599 yymsg = (char *) YYSTACK_ALLOC (yysize);
5602 /* Avoid sprintf, as that infringes on the user's name space.
5603 Don't have undefined behavior even if the translation
5604 produced a string with the wrong number of "%s"s. */
5607 while ((*yyp = *yyf))
5609 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5611 yyp += yytnamerr (yyp, yyarg[yyi++]);
5621 YYSTACK_FREE (yymsg);
5625 yyerror (YY_("syntax error"));
5626 goto yyexhaustedlab;
5630 #endif /* YYERROR_VERBOSE */
5631 yyerror (YY_("syntax error"));
5636 if (yyerrstatus == 3)
5638 /* If just tried and failed to reuse look-ahead token after an
5639 error, discard it. */
5641 if (yychar <= YYEOF)
5643 /* Return failure if at end of input. */
5644 if (yychar == YYEOF)
5649 yydestruct ("Error: discarding", yytoken, &yylval);
5654 /* Else will try to reuse look-ahead token after shifting the error
5659 /*---------------------------------------------------.
5660 | yyerrorlab -- error raised explicitly by YYERROR. |
5661 `---------------------------------------------------*/
5664 /* Pacify compilers like GCC when the user code never invokes
5665 YYERROR and the label yyerrorlab therefore never appears in user
5676 /*-------------------------------------------------------------.
5677 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5678 `-------------------------------------------------------------*/
5680 yyerrstatus = 3; /* Each real token shifted decrements this. */
5684 yyn = yypact[yystate];
5685 if (yyn != YYPACT_NINF)
5688 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5696 /* Pop the current state because it cannot handle the error token. */
5701 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5704 YY_STACK_PRINT (yyss, yyssp);
5713 /* Shift the error token. */
5714 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5720 /*-------------------------------------.
5721 | yyacceptlab -- YYACCEPT comes here. |
5722 `-------------------------------------*/
5727 /*-----------------------------------.
5728 | yyabortlab -- YYABORT comes here. |
5729 `-----------------------------------*/
5735 /*-------------------------------------------------.
5736 | yyexhaustedlab -- memory exhaustion comes here. |
5737 `-------------------------------------------------*/
5739 yyerror (YY_("memory exhausted"));
5745 if (yychar != YYEOF && yychar != YYEMPTY)
5746 yydestruct ("Cleanup: discarding lookahead",
5748 while (yyssp != yyss)
5750 yydestruct ("Cleanup: popping",
5751 yystos[*yyssp], yyvsp);
5756 YYSTACK_FREE (yyss);
5762 #line 2950 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5765 void llvm::GenerateError(const std::string &message, int LineNo) {
5766 if (LineNo == -1) LineNo = llvmAsmlineno;
5767 // TODO: column number in exception
5769 TheParseError->setError(CurFilename, message, LineNo);
5773 int yyerror(const char *ErrorMsg) {
5775 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5776 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5777 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5778 if (yychar == YYEMPTY || yychar == 0)
5779 errMsg += "end-of-file.";
5781 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5782 GenerateError(errMsg);