1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse llvmAsmparse
63 #define yylex llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval llvmAsmlval
66 #define yychar llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
142 X86_SSECALLCC_TOK = 323,
210 EXTRACTELEMENT = 391,
232 OPTIMIZEFORSIZE = 413,
239 #define ESINT64VAL 258
240 #define EUINT64VAL 259
241 #define ESAPINTVAL 260
242 #define EUAPINTVAL 261
243 #define LOCALVAL_ID 262
244 #define GLOBALVAL_ID 263
252 #define PPC_FP128 271
256 #define GLOBALVAR 275
258 #define STRINGCONSTANT 277
259 #define ATSTRINGCONSTANT 278
260 #define PCTSTRINGCONSTANT 279
261 #define ZEROINITIALIZER 280
273 #define THREAD_LOCAL 292
275 #define DOTDOTDOT 294
281 #define APPENDING 300
282 #define DLLIMPORT 301
283 #define DLLEXPORT 302
284 #define EXTERN_WEAK 303
291 #define ADDRSPACE 310
297 #define SIDEEFFECT 316
300 #define FASTCC_TOK 319
301 #define COLDCC_TOK 320
302 #define X86_STDCALLCC_TOK 321
303 #define X86_FASTCALLCC_TOK 322
304 #define X86_SSECALLCC_TOK 323
305 #define DATALAYOUT 324
311 #define UNREACHABLE 330
356 #define GETELEMENTPTR 375
372 #define EXTRACTELEMENT 391
373 #define INSERTELEMENT 392
374 #define SHUFFLEVECTOR 393
375 #define GETRESULT 394
376 #define EXTRACTVALUE 395
377 #define INSERTVALUE 396
394 #define OPTIMIZEFORSIZE 413
397 #define PROTECTED 416
402 /* Copy the first part of user declarations. */
403 #line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
405 #include "ParserInternals.h"
406 #include "llvm/CallingConv.h"
407 #include "llvm/InlineAsm.h"
408 #include "llvm/Instructions.h"
409 #include "llvm/Module.h"
410 #include "llvm/ValueSymbolTable.h"
411 #include "llvm/AutoUpgrade.h"
412 #include "llvm/Support/GetElementPtrTypeIterator.h"
413 #include "llvm/Support/CommandLine.h"
414 #include "llvm/ADT/SmallVector.h"
415 #include "llvm/ADT/STLExtras.h"
416 #include "llvm/Support/MathExtras.h"
417 #include "llvm/Support/Streams.h"
423 // The following is a gross hack. In order to rid the libAsmParser library of
424 // exceptions, we have to have a way of getting the yyparse function to go into
425 // an error situation. So, whenever we want an error to occur, the GenerateError
426 // function (see bottom of file) sets TriggerError. Then, at the end of each
427 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
428 // (a goto) to put YACC in error state. Furthermore, several calls to
429 // GenerateError are made from inside productions and they must simulate the
430 // previous exception behavior by exiting the production immediately. We have
431 // replaced these with the GEN_ERROR macro which calls GeneratError and then
432 // immediately invokes YYERROR. This would be so much cleaner if it was a
433 // recursive descent parser.
434 static bool TriggerError = false;
435 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
436 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
438 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
439 int yylex(); // declaration" of xxx warnings.
441 using namespace llvm;
443 static Module *ParserResult;
445 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
446 // relating to upreferences in the input stream.
448 //#define DEBUG_UPREFS 1
450 #define UR_OUT(X) cerr << X
455 #define YYERROR_VERBOSE 1
457 static GlobalVariable *CurGV;
460 // This contains info used when building the body of a function. It is
461 // destroyed when the function is completed.
463 typedef std::vector<Value *> ValueList; // Numbered defs
466 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
468 static struct PerModuleInfo {
469 Module *CurrentModule;
470 ValueList Values; // Module level numbered definitions
471 ValueList LateResolveValues;
472 std::vector<PATypeHolder> Types;
473 std::map<ValID, PATypeHolder> LateResolveTypes;
475 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
476 /// how they were referenced and on which line of the input they came from so
477 /// that we can resolve them later and print error messages as appropriate.
478 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
480 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
481 // references to global values. Global values may be referenced before they
482 // are defined, and if so, the temporary object that they represent is held
483 // here. This is used for forward references of GlobalValues.
485 typedef std::map<std::pair<const PointerType *,
486 ValID>, GlobalValue*> GlobalRefsType;
487 GlobalRefsType GlobalRefs;
490 // If we could not resolve some functions at function compilation time
491 // (calls to functions before they are defined), resolve them now... Types
492 // are resolved when the constant pool has been completely parsed.
494 ResolveDefinitions(LateResolveValues);
498 // Check to make sure that all global value forward references have been
501 if (!GlobalRefs.empty()) {
502 std::string UndefinedReferences = "Unresolved global references exist:\n";
504 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
506 UndefinedReferences += " " + I->first.first->getDescription() + " " +
507 I->first.second.getName() + "\n";
509 GenerateError(UndefinedReferences);
513 // Look for intrinsic functions and CallInst that need to be upgraded
514 for (Module::iterator FI = CurrentModule->begin(),
515 FE = CurrentModule->end(); FI != FE; )
516 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
518 Values.clear(); // Clear out function local definitions
523 // GetForwardRefForGlobal - Check to see if there is a forward reference
524 // for this global. If so, remove it from the GlobalRefs map and return it.
525 // If not, just return null.
526 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
527 // Check to see if there is a forward reference to this global variable...
528 // if there is, eliminate it and patch the reference to use the new def'n.
529 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
530 GlobalValue *Ret = 0;
531 if (I != GlobalRefs.end()) {
538 bool TypeIsUnresolved(PATypeHolder* PATy) {
539 // If it isn't abstract, its resolved
540 const Type* Ty = PATy->get();
541 if (!Ty->isAbstract())
543 // Traverse the type looking for abstract types. If it isn't abstract then
544 // we don't need to traverse that leg of the type.
545 std::vector<const Type*> WorkList, SeenList;
546 WorkList.push_back(Ty);
547 while (!WorkList.empty()) {
548 const Type* Ty = WorkList.back();
549 SeenList.push_back(Ty);
551 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
552 // Check to see if this is an unresolved type
553 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
554 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
555 for ( ; I != E; ++I) {
556 if (I->second.get() == OpTy)
559 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
560 const Type* TheTy = SeqTy->getElementType();
561 if (TheTy->isAbstract() && TheTy != Ty) {
562 std::vector<const Type*>::iterator I = SeenList.begin(),
568 WorkList.push_back(TheTy);
570 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
571 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
572 const Type* TheTy = StrTy->getElementType(i);
573 if (TheTy->isAbstract() && TheTy != Ty) {
574 std::vector<const Type*>::iterator I = SeenList.begin(),
580 WorkList.push_back(TheTy);
589 static struct PerFunctionInfo {
590 Function *CurrentFunction; // Pointer to current function being created
592 ValueList Values; // Keep track of #'d definitions
594 ValueList LateResolveValues;
595 bool isDeclare; // Is this function a forward declararation?
596 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
597 GlobalValue::VisibilityTypes Visibility;
599 /// BBForwardRefs - When we see forward references to basic blocks, keep
600 /// track of them here.
601 std::map<ValID, BasicBlock*> BBForwardRefs;
603 inline PerFunctionInfo() {
606 Linkage = GlobalValue::ExternalLinkage;
607 Visibility = GlobalValue::DefaultVisibility;
610 inline void FunctionStart(Function *M) {
615 void FunctionDone() {
616 // Any forward referenced blocks left?
617 if (!BBForwardRefs.empty()) {
618 GenerateError("Undefined reference to label " +
619 BBForwardRefs.begin()->second->getName());
623 // Resolve all forward references now.
624 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
626 Values.clear(); // Clear out function local definitions
627 BBForwardRefs.clear();
630 Linkage = GlobalValue::ExternalLinkage;
631 Visibility = GlobalValue::DefaultVisibility;
633 } CurFun; // Info for the current function...
635 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
638 //===----------------------------------------------------------------------===//
639 // Code to handle definitions of all the types
640 //===----------------------------------------------------------------------===//
642 /// InsertValue - Insert a value into the value table. If it is named, this
643 /// returns -1, otherwise it returns the slot number for the value.
644 static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
645 // Things that have names or are void typed don't get slot numbers
646 if (V->hasName() || (V->getType() == Type::VoidTy))
649 // In the case of function values, we have to allow for the forward reference
650 // of basic blocks, which are included in the numbering. Consequently, we keep
651 // track of the next insertion location with NextValNum. When a BB gets
652 // inserted, it could change the size of the CurFun.Values vector.
653 if (&ValueTab == &CurFun.Values) {
654 if (ValueTab.size() <= CurFun.NextValNum)
655 ValueTab.resize(CurFun.NextValNum+1);
656 ValueTab[CurFun.NextValNum++] = V;
657 return CurFun.NextValNum-1;
659 // For all other lists, its okay to just tack it on the back of the vector.
660 ValueTab.push_back(V);
661 return ValueTab.size()-1;
664 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
666 case ValID::LocalID: // Is it a numbered definition?
667 // Module constants occupy the lowest numbered slots...
668 if (D.Num < CurModule.Types.size())
669 return CurModule.Types[D.Num];
671 case ValID::LocalName: // Is it a named definition?
672 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
673 D.destroy(); // Free old strdup'd memory...
678 GenerateError("Internal parser error: Invalid symbol type reference");
682 // If we reached here, we referenced either a symbol that we don't know about
683 // or an id number that hasn't been read yet. We may be referencing something
684 // forward, so just create an entry to be resolved later and get to it...
686 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
689 if (inFunctionScope()) {
690 if (D.Type == ValID::LocalName) {
691 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
694 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
699 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
700 if (I != CurModule.LateResolveTypes.end())
703 Type *Typ = OpaqueType::get();
704 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
708 // getExistingVal - Look up the value specified by the provided type and
709 // the provided ValID. If the value exists and has already been defined, return
710 // it. Otherwise return null.
712 static Value *getExistingVal(const Type *Ty, const ValID &D) {
713 if (isa<FunctionType>(Ty)) {
714 GenerateError("Functions are not values and "
715 "must be referenced as pointers");
720 case ValID::LocalID: { // Is it a numbered definition?
721 // Check that the number is within bounds.
722 if (D.Num >= CurFun.Values.size())
724 Value *Result = CurFun.Values[D.Num];
725 if (Ty != Result->getType()) {
726 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
727 Result->getType()->getDescription() + "' does not match "
728 "expected type, '" + Ty->getDescription() + "'");
733 case ValID::GlobalID: { // Is it a numbered definition?
734 if (D.Num >= CurModule.Values.size())
736 Value *Result = CurModule.Values[D.Num];
737 if (Ty != Result->getType()) {
738 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
739 Result->getType()->getDescription() + "' does not match "
740 "expected type, '" + Ty->getDescription() + "'");
746 case ValID::LocalName: { // Is it a named definition?
747 if (!inFunctionScope())
749 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
750 Value *N = SymTab.lookup(D.getName());
753 if (N->getType() != Ty)
756 D.destroy(); // Free old strdup'd memory...
759 case ValID::GlobalName: { // Is it a named definition?
760 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
761 Value *N = SymTab.lookup(D.getName());
764 if (N->getType() != Ty)
767 D.destroy(); // Free old strdup'd memory...
771 // Check to make sure that "Ty" is an integral type, and that our
772 // value will fit into the specified type...
773 case ValID::ConstSIntVal: // Is it a constant pool reference??
774 if (!isa<IntegerType>(Ty) ||
775 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
776 GenerateError("Signed integral constant '" +
777 itostr(D.ConstPool64) + "' is invalid for type '" +
778 Ty->getDescription() + "'");
781 return ConstantInt::get(Ty, D.ConstPool64, true);
783 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
784 if (isa<IntegerType>(Ty) &&
785 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
786 return ConstantInt::get(Ty, D.UConstPool64);
788 if (!isa<IntegerType>(Ty) ||
789 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
790 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
791 "' is invalid or out of range for type '" +
792 Ty->getDescription() + "'");
795 // This is really a signed reference. Transmogrify.
796 return ConstantInt::get(Ty, D.ConstPool64, true);
798 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
799 if (!isa<IntegerType>(Ty)) {
800 GenerateError("Integral constant '" + D.getName() +
801 "' is invalid or out of range for type '" +
802 Ty->getDescription() + "'");
807 APSInt Tmp = *D.ConstPoolInt;
808 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
809 return ConstantInt::get(Tmp);
812 case ValID::ConstFPVal: // Is it a floating point const pool reference?
813 if (!Ty->isFloatingPoint() ||
814 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
815 GenerateError("FP constant invalid for type");
818 // Lexer has no type info, so builds all float and double FP constants
819 // as double. Fix this here. Long double does not need this.
820 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
822 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
823 return ConstantFP::get(*D.ConstPoolFP);
825 case ValID::ConstNullVal: // Is it a null value?
826 if (!isa<PointerType>(Ty)) {
827 GenerateError("Cannot create a a non pointer null");
830 return ConstantPointerNull::get(cast<PointerType>(Ty));
832 case ValID::ConstUndefVal: // Is it an undef value?
833 return UndefValue::get(Ty);
835 case ValID::ConstZeroVal: // Is it a zero value?
836 return Constant::getNullValue(Ty);
838 case ValID::ConstantVal: // Fully resolved constant?
839 if (D.ConstantValue->getType() != Ty) {
840 GenerateError("Constant expression type different from required type");
843 return D.ConstantValue;
845 case ValID::InlineAsmVal: { // Inline asm expression
846 const PointerType *PTy = dyn_cast<PointerType>(Ty);
847 const FunctionType *FTy =
848 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
849 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
850 GenerateError("Invalid type for asm constraint string");
853 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
854 D.IAD->HasSideEffects);
855 D.destroy(); // Free InlineAsmDescriptor.
859 assert(0 && "Unhandled case!");
863 assert(0 && "Unhandled case!");
867 // getVal - This function is identical to getExistingVal, except that if a
868 // value is not already defined, it "improvises" by creating a placeholder var
869 // that looks and acts just like the requested variable. When the value is
870 // defined later, all uses of the placeholder variable are replaced with the
873 static Value *getVal(const Type *Ty, const ValID &ID) {
874 if (Ty == Type::LabelTy) {
875 GenerateError("Cannot use a basic block here");
879 // See if the value has already been defined.
880 Value *V = getExistingVal(Ty, ID);
882 if (TriggerError) return 0;
884 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
885 GenerateError("Invalid use of a non-first-class type");
889 // If we reached here, we referenced either a symbol that we don't know about
890 // or an id number that hasn't been read yet. We may be referencing something
891 // forward, so just create an entry to be resolved later and get to it...
894 case ValID::GlobalName:
895 case ValID::GlobalID: {
896 const PointerType *PTy = dyn_cast<PointerType>(Ty);
898 GenerateError("Invalid type for reference to global" );
901 const Type* ElTy = PTy->getElementType();
902 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
903 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
905 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
906 (Module*)0, false, PTy->getAddressSpace());
910 V = new Argument(Ty);
913 // Remember where this forward reference came from. FIXME, shouldn't we try
914 // to recycle these things??
915 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
918 if (inFunctionScope())
919 InsertValue(V, CurFun.LateResolveValues);
921 InsertValue(V, CurModule.LateResolveValues);
925 /// defineBBVal - This is a definition of a new basic block with the specified
926 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
927 static BasicBlock *defineBBVal(const ValID &ID) {
928 assert(inFunctionScope() && "Can't get basic block at global scope!");
932 // First, see if this was forward referenced
934 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
935 if (BBI != CurFun.BBForwardRefs.end()) {
937 // The forward declaration could have been inserted anywhere in the
938 // function: insert it into the correct place now.
939 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
940 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
942 // We're about to erase the entry, save the key so we can clean it up.
943 ValID Tmp = BBI->first;
945 // Erase the forward ref from the map as its no longer "forward"
946 CurFun.BBForwardRefs.erase(ID);
948 // The key has been removed from the map but so we don't want to leave
949 // strdup'd memory around so destroy it too.
952 // If its a numbered definition, bump the number and set the BB value.
953 if (ID.Type == ValID::LocalID) {
954 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
958 // We haven't seen this BB before and its first mention is a definition.
959 // Just create it and return it.
960 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
961 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
962 if (ID.Type == ValID::LocalID) {
963 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
972 /// getBBVal - get an existing BB value or create a forward reference for it.
974 static BasicBlock *getBBVal(const ValID &ID) {
975 assert(inFunctionScope() && "Can't get basic block at global scope!");
979 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
980 if (BBI != CurFun.BBForwardRefs.end()) {
982 } if (ID.Type == ValID::LocalName) {
983 std::string Name = ID.getName();
984 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
986 if (N->getType()->getTypeID() == Type::LabelTyID)
987 BB = cast<BasicBlock>(N);
989 GenerateError("Reference to label '" + Name + "' is actually of type '"+
990 N->getType()->getDescription() + "'");
992 } else if (ID.Type == ValID::LocalID) {
993 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
994 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
995 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
997 GenerateError("Reference to label '%" + utostr(ID.Num) +
998 "' is actually of type '"+
999 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1002 GenerateError("Illegal label reference " + ID.getName());
1006 // If its already been defined, return it now.
1008 ID.destroy(); // Free strdup'd memory.
1012 // Otherwise, this block has not been seen before, create it.
1014 if (ID.Type == ValID::LocalName)
1015 Name = ID.getName();
1016 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
1018 // Insert it in the forward refs map.
1019 CurFun.BBForwardRefs[ID] = BB;
1025 //===----------------------------------------------------------------------===//
1026 // Code to handle forward references in instructions
1027 //===----------------------------------------------------------------------===//
1029 // This code handles the late binding needed with statements that reference
1030 // values not defined yet... for example, a forward branch, or the PHI node for
1033 // This keeps a table (CurFun.LateResolveValues) of all such forward references
1034 // and back patchs after we are done.
1037 // ResolveDefinitions - If we could not resolve some defs at parsing
1038 // time (forward branches, phi functions for loops, etc...) resolve the
1042 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1043 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1044 while (!LateResolvers.empty()) {
1045 Value *V = LateResolvers.back();
1046 LateResolvers.pop_back();
1048 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1049 CurModule.PlaceHolderInfo.find(V);
1050 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1052 ValID &DID = PHI->second.first;
1054 Value *TheRealValue = getExistingVal(V->getType(), DID);
1058 V->replaceAllUsesWith(TheRealValue);
1060 CurModule.PlaceHolderInfo.erase(PHI);
1061 } else if (FutureLateResolvers) {
1062 // Functions have their unresolved items forwarded to the module late
1064 InsertValue(V, *FutureLateResolvers);
1066 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1067 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1068 "' of type '" + V->getType()->getDescription() + "'",
1069 PHI->second.second);
1072 GenerateError("Reference to an invalid definition: #" +
1073 itostr(DID.Num) + " of type '" +
1074 V->getType()->getDescription() + "'",
1075 PHI->second.second);
1080 LateResolvers.clear();
1083 // ResolveTypeTo - A brand new type was just declared. This means that (if
1084 // name is not null) things referencing Name can be resolved. Otherwise, things
1085 // refering to the number can be resolved. Do this now.
1087 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1090 D = ValID::createLocalName(*Name);
1092 D = ValID::createLocalID(CurModule.Types.size());
1094 std::map<ValID, PATypeHolder>::iterator I =
1095 CurModule.LateResolveTypes.find(D);
1096 if (I != CurModule.LateResolveTypes.end()) {
1097 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1098 CurModule.LateResolveTypes.erase(I);
1102 // setValueName - Set the specified value to the name given. The name may be
1103 // null potentially, in which case this is a noop. The string passed in is
1104 // assumed to be a malloc'd string buffer, and is free'd by this function.
1106 static void setValueName(Value *V, std::string *NameStr) {
1107 if (!NameStr) return;
1108 std::string Name(*NameStr); // Copy string
1109 delete NameStr; // Free old string
1111 if (V->getType() == Type::VoidTy) {
1112 GenerateError("Can't assign name '" + Name+"' to value with void type");
1116 assert(inFunctionScope() && "Must be in function scope!");
1117 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1118 if (ST.lookup(Name)) {
1119 GenerateError("Redefinition of value '" + Name + "' of type '" +
1120 V->getType()->getDescription() + "'");
1128 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1129 /// this is a declaration, otherwise it is a definition.
1130 static GlobalVariable *
1131 ParseGlobalVariable(std::string *NameStr,
1132 GlobalValue::LinkageTypes Linkage,
1133 GlobalValue::VisibilityTypes Visibility,
1134 bool isConstantGlobal, const Type *Ty,
1135 Constant *Initializer, bool IsThreadLocal,
1136 unsigned AddressSpace = 0) {
1137 if (isa<FunctionType>(Ty)) {
1138 GenerateError("Cannot declare global vars of function type");
1141 if (Ty == Type::LabelTy) {
1142 GenerateError("Cannot declare global vars of label type");
1146 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1150 Name = *NameStr; // Copy string
1151 delete NameStr; // Free old string
1154 // See if this global value was forward referenced. If so, recycle the
1157 if (!Name.empty()) {
1158 ID = ValID::createGlobalName(Name);
1160 ID = ValID::createGlobalID(CurModule.Values.size());
1163 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1164 // Move the global to the end of the list, from whereever it was
1165 // previously inserted.
1166 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1167 CurModule.CurrentModule->getGlobalList().remove(GV);
1168 CurModule.CurrentModule->getGlobalList().push_back(GV);
1169 GV->setInitializer(Initializer);
1170 GV->setLinkage(Linkage);
1171 GV->setVisibility(Visibility);
1172 GV->setConstant(isConstantGlobal);
1173 GV->setThreadLocal(IsThreadLocal);
1174 InsertValue(GV, CurModule.Values);
1178 // If this global has a name
1179 if (!Name.empty()) {
1180 // if the global we're parsing has an initializer (is a definition) and
1181 // has external linkage.
1182 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1183 // If there is already a global with external linkage with this name
1184 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1185 // If we allow this GVar to get created, it will be renamed in the
1186 // symbol table because it conflicts with an existing GVar. We can't
1187 // allow redefinition of GVars whose linking indicates that their name
1188 // must stay the same. Issue the error.
1189 GenerateError("Redefinition of global variable named '" + Name +
1190 "' of type '" + Ty->getDescription() + "'");
1195 // Otherwise there is no existing GV to use, create one now.
1196 GlobalVariable *GV =
1197 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1198 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1199 GV->setVisibility(Visibility);
1200 InsertValue(GV, CurModule.Values);
1204 // setTypeName - Set the specified type to the name given. The name may be
1205 // null potentially, in which case this is a noop. The string passed in is
1206 // assumed to be a malloc'd string buffer, and is freed by this function.
1208 // This function returns true if the type has already been defined, but is
1209 // allowed to be redefined in the specified context. If the name is a new name
1210 // for the type plane, it is inserted and false is returned.
1211 static bool setTypeName(const Type *T, std::string *NameStr) {
1212 assert(!inFunctionScope() && "Can't give types function-local names!");
1213 if (NameStr == 0) return false;
1215 std::string Name(*NameStr); // Copy string
1216 delete NameStr; // Free old string
1218 // We don't allow assigning names to void type
1219 if (T == Type::VoidTy) {
1220 GenerateError("Can't assign name '" + Name + "' to the void type");
1224 // Set the type name, checking for conflicts as we do so.
1225 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1227 if (AlreadyExists) { // Inserting a name that is already defined???
1228 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1229 assert(Existing && "Conflict but no matching type?!");
1231 // There is only one case where this is allowed: when we are refining an
1232 // opaque type. In this case, Existing will be an opaque type.
1233 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1234 // We ARE replacing an opaque type!
1235 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1239 // Otherwise, this is an attempt to redefine a type. That's okay if
1240 // the redefinition is identical to the original. This will be so if
1241 // Existing and T point to the same Type object. In this one case we
1242 // allow the equivalent redefinition.
1243 if (Existing == T) return true; // Yes, it's equal.
1245 // Any other kind of (non-equivalent) redefinition is an error.
1246 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1247 T->getDescription() + "'");
1253 //===----------------------------------------------------------------------===//
1254 // Code for handling upreferences in type names...
1257 // TypeContains - Returns true if Ty directly contains E in it.
1259 static bool TypeContains(const Type *Ty, const Type *E) {
1260 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1261 E) != Ty->subtype_end();
1265 struct UpRefRecord {
1266 // NestingLevel - The number of nesting levels that need to be popped before
1267 // this type is resolved.
1268 unsigned NestingLevel;
1270 // LastContainedTy - This is the type at the current binding level for the
1271 // type. Every time we reduce the nesting level, this gets updated.
1272 const Type *LastContainedTy;
1274 // UpRefTy - This is the actual opaque type that the upreference is
1275 // represented with.
1276 OpaqueType *UpRefTy;
1278 UpRefRecord(unsigned NL, OpaqueType *URTy)
1279 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1283 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1284 static std::vector<UpRefRecord> UpRefs;
1286 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1287 /// called. It loops through the UpRefs vector, which is a list of the
1288 /// currently active types. For each type, if the up reference is contained in
1289 /// the newly completed type, we decrement the level count. When the level
1290 /// count reaches zero, the upreferenced type is the type that is passed in:
1291 /// thus we can complete the cycle.
1293 static PATypeHolder HandleUpRefs(const Type *ty) {
1294 // If Ty isn't abstract, or if there are no up-references in it, then there is
1295 // nothing to resolve here.
1296 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1298 PATypeHolder Ty(ty);
1299 UR_OUT("Type '" << Ty->getDescription() <<
1300 "' newly formed. Resolving upreferences.\n" <<
1301 UpRefs.size() << " upreferences active!\n");
1303 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1304 // to zero), we resolve them all together before we resolve them to Ty. At
1305 // the end of the loop, if there is anything to resolve to Ty, it will be in
1307 OpaqueType *TypeToResolve = 0;
1309 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1310 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1311 << UpRefs[i].second->getDescription() << ") = "
1312 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1313 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1314 // Decrement level of upreference
1315 unsigned Level = --UpRefs[i].NestingLevel;
1316 UpRefs[i].LastContainedTy = Ty;
1317 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1318 if (Level == 0) { // Upreference should be resolved!
1319 if (!TypeToResolve) {
1320 TypeToResolve = UpRefs[i].UpRefTy;
1322 UR_OUT(" * Resolving upreference for "
1323 << UpRefs[i].second->getDescription() << "\n";
1324 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1325 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1326 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1327 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1329 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1330 --i; // Do not skip the next element...
1335 if (TypeToResolve) {
1336 UR_OUT(" * Resolving upreference for "
1337 << UpRefs[i].second->getDescription() << "\n";
1338 std::string OldName = TypeToResolve->getDescription());
1339 TypeToResolve->refineAbstractTypeTo(Ty);
1345 //===----------------------------------------------------------------------===//
1346 // RunVMAsmParser - Define an interface to this parser
1347 //===----------------------------------------------------------------------===//
1349 static Module* RunParser(Module * M);
1351 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1353 Module *M = RunParser(new Module(LLLgetFilename()));
1360 /* Enabling traces. */
1365 /* Enabling verbose error messages. */
1366 #ifdef YYERROR_VERBOSE
1367 # undef YYERROR_VERBOSE
1368 # define YYERROR_VERBOSE 1
1370 # define YYERROR_VERBOSE 0
1373 /* Enabling the token table. */
1374 #ifndef YYTOKEN_TABLE
1375 # define YYTOKEN_TABLE 0
1378 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1379 typedef union YYSTYPE
1380 #line 970 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
1382 llvm::Module *ModuleVal;
1383 llvm::Function *FunctionVal;
1384 llvm::BasicBlock *BasicBlockVal;
1385 llvm::TerminatorInst *TermInstVal;
1386 llvm::Instruction *InstVal;
1387 llvm::Constant *ConstVal;
1389 const llvm::Type *PrimType;
1390 std::list<llvm::PATypeHolder> *TypeList;
1391 llvm::PATypeHolder *TypeVal;
1392 llvm::Value *ValueVal;
1393 std::vector<llvm::Value*> *ValueList;
1394 std::vector<unsigned> *ConstantList;
1395 llvm::ArgListType *ArgList;
1396 llvm::TypeWithAttrs TypeWithAttrs;
1397 llvm::TypeWithAttrsList *TypeWithAttrsList;
1398 llvm::ParamList *ParamList;
1400 // Represent the RHS of PHI node
1401 std::list<std::pair<llvm::Value*,
1402 llvm::BasicBlock*> > *PHIList;
1403 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1404 std::vector<llvm::Constant*> *ConstVector;
1406 llvm::GlobalValue::LinkageTypes Linkage;
1407 llvm::GlobalValue::VisibilityTypes Visibility;
1408 llvm::ParameterAttributes ParamAttrs;
1409 llvm::FunctionNotes FunctionNotes;
1410 llvm::APInt *APIntVal;
1415 llvm::APFloat *FPVal;
1418 std::string *StrVal; // This memory must be deleted
1419 llvm::ValID ValIDVal;
1421 llvm::Instruction::BinaryOps BinaryOpVal;
1422 llvm::Instruction::TermOps TermOpVal;
1423 llvm::Instruction::MemoryOps MemOpVal;
1424 llvm::Instruction::CastOps CastOpVal;
1425 llvm::Instruction::OtherOps OtherOpVal;
1426 llvm::ICmpInst::Predicate IPredicate;
1427 llvm::FCmpInst::Predicate FPredicate;
1429 /* Line 193 of yacc.c. */
1430 #line 1431 "llvmAsmParser.tab.c"
1432 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1433 # define YYSTYPE_IS_DECLARED 1
1434 # define YYSTYPE_IS_TRIVIAL 1
1439 /* Copy the second part of user declarations. */
1442 /* Line 216 of yacc.c. */
1443 #line 1444 "llvmAsmParser.tab.c"
1450 typedef YYTYPE_UINT8 yytype_uint8;
1452 typedef unsigned char yytype_uint8;
1456 typedef YYTYPE_INT8 yytype_int8;
1457 #elif (defined __STDC__ || defined __C99__FUNC__ \
1458 || defined __cplusplus || defined _MSC_VER)
1459 typedef signed char yytype_int8;
1461 typedef short int yytype_int8;
1464 #ifdef YYTYPE_UINT16
1465 typedef YYTYPE_UINT16 yytype_uint16;
1467 typedef unsigned short int yytype_uint16;
1471 typedef YYTYPE_INT16 yytype_int16;
1473 typedef short int yytype_int16;
1477 # ifdef __SIZE_TYPE__
1478 # define YYSIZE_T __SIZE_TYPE__
1479 # elif defined size_t
1480 # define YYSIZE_T size_t
1481 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1482 || defined __cplusplus || defined _MSC_VER)
1483 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1484 # define YYSIZE_T size_t
1486 # define YYSIZE_T unsigned int
1490 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1493 # if defined YYENABLE_NLS && YYENABLE_NLS
1495 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1496 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1500 # define YY_(msgid) msgid
1504 /* Suppress unused-variable warnings by "using" E. */
1505 #if ! defined lint || defined __GNUC__
1506 # define YYUSE(e) ((void) (e))
1508 # define YYUSE(e) /* empty */
1511 /* Identity function, used to suppress warnings about constant conditions. */
1513 # define YYID(n) (n)
1515 #if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1529 #if ! defined yyoverflow || YYERROR_VERBOSE
1531 /* The parser invokes alloca or malloc; define the necessary symbols. */
1533 # ifdef YYSTACK_USE_ALLOCA
1534 # if YYSTACK_USE_ALLOCA
1536 # define YYSTACK_ALLOC __builtin_alloca
1537 # elif defined __BUILTIN_VA_ARG_INCR
1538 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1540 # define YYSTACK_ALLOC __alloca
1541 # elif defined _MSC_VER
1542 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1543 # define alloca _alloca
1545 # define YYSTACK_ALLOC alloca
1546 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1547 || defined __cplusplus || defined _MSC_VER)
1548 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1550 # define _STDLIB_H 1
1557 # ifdef YYSTACK_ALLOC
1558 /* Pacify GCC's `empty if-body' warning. */
1559 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1560 # ifndef YYSTACK_ALLOC_MAXIMUM
1561 /* The OS might guarantee only one guard page at the bottom of the stack,
1562 and a page size can be as small as 4096 bytes. So we cannot safely
1563 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1564 to allow for a few compiler-allocated temporary stack slots. */
1565 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1568 # define YYSTACK_ALLOC YYMALLOC
1569 # define YYSTACK_FREE YYFREE
1570 # ifndef YYSTACK_ALLOC_MAXIMUM
1571 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1573 # if (defined __cplusplus && ! defined _STDLIB_H \
1574 && ! ((defined YYMALLOC || defined malloc) \
1575 && (defined YYFREE || defined free)))
1576 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1578 # define _STDLIB_H 1
1582 # define YYMALLOC malloc
1583 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1584 || defined __cplusplus || defined _MSC_VER)
1585 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1589 # define YYFREE free
1590 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1591 || defined __cplusplus || defined _MSC_VER)
1592 void free (void *); /* INFRINGES ON USER NAME SPACE */
1596 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1599 #if (! defined yyoverflow \
1600 && (! defined __cplusplus \
1601 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1603 /* A type that is properly aligned for any stack member. */
1610 /* The size of the maximum gap between one aligned stack and the next. */
1611 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1613 /* The size of an array large to enough to hold all stacks, each with
1615 # define YYSTACK_BYTES(N) \
1616 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1617 + YYSTACK_GAP_MAXIMUM)
1619 /* Copy COUNT objects from FROM to TO. The source and destination do
1622 # if defined __GNUC__ && 1 < __GNUC__
1623 # define YYCOPY(To, From, Count) \
1624 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1626 # define YYCOPY(To, From, Count) \
1630 for (yyi = 0; yyi < (Count); yyi++) \
1631 (To)[yyi] = (From)[yyi]; \
1637 /* Relocate STACK from its old location to the new one. The
1638 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1639 elements in the stack, and YYPTR gives the new location of the
1640 stack. Advance YYPTR to a properly aligned location for the next
1642 # define YYSTACK_RELOCATE(Stack) \
1645 YYSIZE_T yynewbytes; \
1646 YYCOPY (&yyptr->Stack, Stack, yysize); \
1647 Stack = &yyptr->Stack; \
1648 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1649 yyptr += yynewbytes / sizeof (*yyptr); \
1655 /* YYFINAL -- State number of the termination state. */
1657 /* YYLAST -- Last index in YYTABLE. */
1660 /* YYNTOKENS -- Number of terminals. */
1661 #define YYNTOKENS 176
1662 /* YYNNTS -- Number of nonterminals. */
1664 /* YYNRULES -- Number of rules. */
1665 #define YYNRULES 353
1666 /* YYNRULES -- Number of states. */
1667 #define YYNSTATES 720
1669 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1670 #define YYUNDEFTOK 2
1671 #define YYMAXUTOK 416
1673 #define YYTRANSLATE(YYX) \
1674 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1676 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1677 static const yytype_uint8 yytranslate[] =
1679 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1683 162, 163, 166, 2, 165, 2, 2, 2, 2, 2,
1684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1685 171, 164, 172, 2, 2, 2, 2, 2, 2, 2,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1688 2, 168, 167, 170, 2, 2, 2, 2, 2, 175,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1691 169, 2, 2, 173, 2, 174, 2, 2, 2, 2,
1692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1704 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1705 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1706 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1707 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1708 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1709 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1710 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1711 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1712 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1713 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1714 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1715 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1716 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1717 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1718 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1719 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1720 155, 156, 157, 158, 159, 160, 161
1724 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1726 static const yytype_uint16 yyprhs[] =
1728 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1729 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1730 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1731 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1732 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1733 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1734 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1735 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1736 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1737 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
1738 197, 198, 200, 202, 204, 206, 208, 210, 213, 215,
1739 217, 219, 221, 223, 225, 227, 229, 231, 234, 235,
1740 238, 240, 242, 244, 246, 248, 250, 251, 254, 256,
1741 260, 264, 268, 270, 271, 276, 277, 280, 281, 284,
1742 285, 289, 292, 293, 295, 296, 300, 302, 305, 307,
1743 309, 311, 313, 315, 317, 319, 321, 323, 327, 329,
1744 332, 338, 344, 350, 356, 360, 363, 369, 374, 377,
1745 379, 381, 383, 387, 389, 393, 395, 396, 398, 402,
1746 407, 411, 415, 420, 425, 429, 436, 442, 445, 448,
1747 451, 454, 457, 460, 463, 466, 469, 472, 475, 478,
1748 485, 491, 500, 507, 514, 522, 530, 538, 546, 553,
1749 562, 571, 577, 585, 589, 591, 593, 595, 597, 598,
1750 601, 608, 610, 611, 613, 616, 617, 621, 622, 626,
1751 630, 634, 638, 639, 648, 649, 659, 660, 670, 676,
1752 679, 683, 685, 689, 693, 697, 701, 703, 704, 710,
1753 714, 716, 720, 722, 723, 735, 737, 739, 744, 746,
1754 748, 751, 755, 756, 758, 760, 762, 764, 766, 768,
1755 770, 772, 774, 776, 778, 782, 786, 789, 792, 796,
1756 799, 805, 810, 812, 818, 820, 822, 824, 826, 828,
1757 830, 833, 835, 839, 842, 845, 849, 853, 856, 857,
1758 859, 862, 865, 869, 879, 889, 898, 913, 915, 917,
1759 924, 930, 933, 936, 943, 951, 956, 961, 968, 975,
1760 976, 977, 981, 984, 988, 991, 993, 999, 1005, 1012,
1761 1019, 1026, 1033, 1038, 1045, 1050, 1055, 1062, 1069, 1072,
1762 1081, 1083, 1085, 1086, 1090, 1097, 1101, 1108, 1111, 1117,
1763 1125, 1131, 1136, 1141
1766 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1767 static const yytype_int16 yyrhs[] =
1769 226, 0, -1, 76, -1, 77, -1, 78, -1, 79,
1770 -1, 80, -1, 81, -1, 82, -1, 83, -1, 84,
1771 -1, 88, -1, 89, -1, 90, -1, 85, -1, 86,
1772 -1, 87, -1, 121, -1, 122, -1, 123, -1, 124,
1773 -1, 125, -1, 126, -1, 127, -1, 128, -1, 129,
1774 -1, 130, -1, 131, -1, 132, -1, 95, -1, 96,
1775 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1776 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1777 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1778 -1, 112, -1, 113, -1, 114, -1, 101, -1, 102,
1779 -1, 103, -1, 104, -1, 26, -1, 27, -1, 11,
1780 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1781 -1, 19, -1, 22, -1, 24, -1, 184, -1, -1,
1782 55, 162, 4, 163, -1, -1, 184, 164, -1, -1,
1783 7, 164, -1, 20, -1, 23, -1, 191, -1, -1,
1784 189, 164, -1, 42, -1, 44, -1, 43, -1, 45,
1785 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
1786 -1, -1, 159, -1, 160, -1, 161, -1, -1, 46,
1787 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1788 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
1789 64, -1, 65, -1, 66, -1, 67, -1, 68, -1,
1790 62, 4, -1, 143, -1, 122, -1, 142, -1, 123,
1791 -1, 145, -1, 146, -1, 148, -1, 149, -1, 150,
1792 -1, 54, 4, -1, -1, 200, 199, -1, 144, -1,
1793 147, -1, 143, -1, 142, -1, 151, -1, 152, -1,
1794 -1, 202, 201, -1, 204, -1, 203, 165, 204, -1,
1795 155, 164, 157, -1, 155, 164, 156, -1, 158, -1,
1796 -1, 154, 162, 203, 163, -1, -1, 153, 22, -1,
1797 -1, 54, 4, -1, -1, 165, 54, 4, -1, 34,
1798 22, -1, -1, 209, -1, -1, 165, 212, 211, -1,
1799 209, -1, 54, 4, -1, 11, -1, 12, -1, 13,
1800 -1, 16, -1, 15, -1, 14, -1, 17, -1, 50,
1801 -1, 213, -1, 214, 186, 166, -1, 248, -1, 167,
1802 4, -1, 214, 162, 218, 163, 202, -1, 10, 162,
1803 218, 163, 202, -1, 168, 4, 169, 214, 170, -1,
1804 171, 4, 169, 214, 172, -1, 173, 219, 174, -1,
1805 173, 174, -1, 171, 173, 219, 174, 172, -1, 171,
1806 173, 174, 172, -1, 214, 200, -1, 214, -1, 10,
1807 -1, 215, -1, 217, 165, 215, -1, 217, -1, 217,
1808 165, 39, -1, 39, -1, -1, 214, -1, 219, 165,
1809 214, -1, 214, 168, 222, 170, -1, 214, 168, 170,
1810 -1, 214, 175, 22, -1, 214, 171, 222, 172, -1,
1811 214, 173, 222, 174, -1, 214, 173, 174, -1, 214,
1812 171, 173, 222, 174, 172, -1, 214, 171, 173, 174,
1813 172, -1, 214, 40, -1, 214, 41, -1, 214, 248,
1814 -1, 214, 221, -1, 214, 25, -1, 182, 3, -1,
1815 182, 5, -1, 182, 4, -1, 182, 6, -1, 11,
1816 26, -1, 11, 27, -1, 183, 9, -1, 179, 162,
1817 220, 38, 214, 163, -1, 120, 162, 220, 260, 163,
1818 -1, 134, 162, 220, 165, 220, 165, 220, 163, -1,
1819 177, 162, 220, 165, 220, 163, -1, 178, 162, 220,
1820 165, 220, 163, -1, 91, 180, 162, 220, 165, 220,
1821 163, -1, 92, 181, 162, 220, 165, 220, 163, -1,
1822 93, 180, 162, 220, 165, 220, 163, -1, 94, 181,
1823 162, 220, 165, 220, 163, -1, 136, 162, 220, 165,
1824 220, 163, -1, 137, 162, 220, 165, 220, 165, 220,
1825 163, -1, 138, 162, 220, 165, 220, 165, 220, 163,
1826 -1, 140, 162, 220, 261, 163, -1, 141, 162, 220,
1827 165, 220, 261, 163, -1, 222, 165, 220, -1, 220,
1828 -1, 32, -1, 33, -1, 37, -1, -1, 216, 248,
1829 -1, 126, 162, 225, 38, 214, 163, -1, 227, -1,
1830 -1, 228, -1, 227, 228, -1, -1, 31, 229, 244,
1831 -1, -1, 30, 230, 245, -1, 60, 59, 234, -1,
1832 187, 18, 214, -1, 187, 18, 10, -1, -1, 190,
1833 194, 224, 223, 220, 186, 231, 211, -1, -1, 190,
1834 192, 194, 224, 223, 220, 186, 232, 211, -1, -1,
1835 190, 193, 194, 224, 223, 214, 186, 233, 211, -1,
1836 190, 194, 35, 197, 225, -1, 52, 235, -1, 56,
1837 164, 236, -1, 22, -1, 53, 164, 22, -1, 69,
1838 164, 22, -1, 168, 237, 170, -1, 237, 165, 22,
1839 -1, 22, -1, -1, 238, 165, 214, 200, 185, -1,
1840 214, 200, 185, -1, 238, -1, 238, 165, 39, -1,
1841 39, -1, -1, 198, 216, 189, 162, 239, 163, 202,
1842 210, 207, 206, 205, -1, 28, -1, 173, -1, 196,
1843 194, 240, 241, -1, 29, -1, 174, -1, 252, 243,
1844 -1, 195, 194, 240, -1, -1, 61, -1, 3, -1,
1845 4, -1, 5, -1, 6, -1, 9, -1, 26, -1,
1846 27, -1, 40, -1, 41, -1, 25, -1, 171, 222,
1847 172, -1, 168, 222, 170, -1, 168, 170, -1, 175,
1848 22, -1, 173, 222, 174, -1, 173, 174, -1, 171,
1849 173, 222, 174, 172, -1, 171, 173, 174, 172, -1,
1850 221, -1, 59, 246, 22, 165, 22, -1, 7, -1,
1851 8, -1, 184, -1, 189, -1, 248, -1, 247, -1,
1852 214, 249, -1, 250, -1, 251, 165, 250, -1, 252,
1853 253, -1, 242, 253, -1, 254, 187, 255, -1, 254,
1854 188, 255, -1, 254, 257, -1, -1, 21, -1, 70,
1855 251, -1, 70, 10, -1, 71, 17, 249, -1, 71,
1856 11, 249, 165, 17, 249, 165, 17, 249, -1, 72,
1857 182, 249, 165, 17, 249, 168, 256, 170, -1, 72,
1858 182, 249, 165, 17, 249, 168, 170, -1, 73, 198,
1859 216, 249, 162, 259, 163, 202, 38, 17, 249, 74,
1860 17, 249, -1, 74, -1, 75, -1, 256, 182, 247,
1861 165, 17, 249, -1, 182, 247, 165, 17, 249, -1,
1862 187, 263, -1, 188, 263, -1, 214, 168, 249, 165,
1863 249, 170, -1, 258, 165, 168, 249, 165, 249, 170,
1864 -1, 214, 200, 249, 200, -1, 17, 200, 249, 200,
1865 -1, 259, 165, 214, 200, 249, 200, -1, 259, 165,
1866 17, 200, 249, 200, -1, -1, -1, 260, 165, 250,
1867 -1, 165, 4, -1, 261, 165, 4, -1, 58, 57,
1868 -1, 57, -1, 177, 214, 249, 165, 249, -1, 178,
1869 214, 249, 165, 249, -1, 91, 180, 214, 249, 165,
1870 249, -1, 92, 181, 214, 249, 165, 249, -1, 93,
1871 180, 214, 249, 165, 249, -1, 94, 181, 214, 249,
1872 165, 249, -1, 179, 250, 38, 214, -1, 134, 250,
1873 165, 250, 165, 250, -1, 135, 250, 165, 214, -1,
1874 136, 250, 165, 250, -1, 137, 250, 165, 250, 165,
1875 250, -1, 138, 250, 165, 250, 165, 250, -1, 133,
1876 258, -1, 262, 198, 216, 249, 162, 259, 163, 202,
1877 -1, 265, -1, 36, -1, -1, 115, 214, 208, -1,
1878 115, 214, 165, 11, 249, 208, -1, 116, 214, 208,
1879 -1, 116, 214, 165, 11, 249, 208, -1, 117, 250,
1880 -1, 264, 118, 214, 249, 208, -1, 264, 119, 250,
1881 165, 214, 249, 208, -1, 139, 214, 249, 165, 4,
1882 -1, 120, 214, 249, 260, -1, 140, 214, 249, 261,
1883 -1, 141, 214, 249, 165, 214, 249, 261, -1
1886 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1887 static const yytype_uint16 yyrline[] =
1889 0, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
1890 1142, 1143, 1143, 1143, 1143, 1143, 1143, 1144, 1144, 1144,
1891 1144, 1144, 1144, 1145, 1145, 1145, 1145, 1145, 1145, 1148,
1892 1148, 1149, 1149, 1150, 1150, 1151, 1151, 1152, 1152, 1156,
1893 1156, 1157, 1157, 1158, 1158, 1159, 1159, 1160, 1160, 1161,
1894 1161, 1162, 1162, 1163, 1164, 1169, 1170, 1170, 1170, 1170,
1895 1170, 1172, 1172, 1172, 1173, 1173, 1175, 1176, 1180, 1184,
1896 1189, 1195, 1195, 1197, 1198, 1203, 1209, 1210, 1211, 1212,
1897 1213, 1214, 1218, 1219, 1220, 1224, 1225, 1226, 1227, 1231,
1898 1232, 1233, 1237, 1238, 1239, 1240, 1241, 1245, 1246, 1247,
1899 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1264, 1265,
1900 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1277, 1278,
1901 1283, 1284, 1285, 1286, 1287, 1288, 1291, 1292, 1297, 1298,
1902 1309, 1310, 1311, 1314, 1315, 1320, 1321, 1328, 1329, 1335,
1903 1336, 1345, 1353, 1354, 1359, 1360, 1361, 1366, 1379, 1379,
1904 1379, 1379, 1379, 1379, 1379, 1382, 1386, 1390, 1397, 1402,
1905 1410, 1439, 1464, 1469, 1479, 1489, 1493, 1503, 1510, 1519,
1906 1526, 1531, 1536, 1543, 1544, 1551, 1558, 1566, 1572, 1584,
1907 1612, 1628, 1655, 1683, 1709, 1729, 1755, 1775, 1787, 1794,
1908 1860, 1870, 1880, 1886, 1896, 1902, 1912, 1918, 1924, 1937,
1909 1949, 1970, 1978, 1984, 1995, 2000, 2005, 2010, 2015, 2021,
1910 2027, 2033, 2041, 2052, 2056, 2064, 2064, 2067, 2067, 2070,
1911 2082, 2103, 2108, 2116, 2117, 2121, 2121, 2125, 2125, 2128,
1912 2131, 2155, 2167, 2166, 2178, 2177, 2187, 2186, 2197, 2237,
1913 2240, 2246, 2256, 2260, 2265, 2267, 2272, 2277, 2286, 2296,
1914 2307, 2311, 2320, 2329, 2334, 2466, 2466, 2468, 2477, 2477,
1915 2479, 2484, 2496, 2500, 2505, 2509, 2513, 2518, 2523, 2527,
1916 2531, 2535, 2539, 2543, 2547, 2569, 2591, 2597, 2610, 2622,
1917 2627, 2639, 2645, 2649, 2659, 2663, 2667, 2672, 2679, 2679,
1918 2685, 2694, 2699, 2704, 2708, 2717, 2726, 2739, 2748, 2752,
1919 2760, 2780, 2784, 2789, 2800, 2819, 2828, 2914, 2918, 2925,
1920 2936, 2949, 2958, 2971, 2982, 2992, 3003, 3011, 3021, 3028,
1921 3031, 3032, 3040, 3046, 3055, 3059, 3064, 3080, 3097, 3109,
1922 3121, 3135, 3149, 3161, 3182, 3189, 3195, 3201, 3207, 3222,
1923 3312, 3317, 3321, 3328, 3335, 3345, 3352, 3362, 3370, 3384,
1924 3401, 3415, 3430, 3445
1928 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1929 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1930 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1931 static const char *const yytname[] =
1933 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1934 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1935 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1936 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1937 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1938 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1939 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1940 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1941 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
1942 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1943 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1944 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1945 "X86_SSECALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1946 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1947 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1948 "ICMP", "FCMP", "VICMP", "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1949 "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE",
1950 "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1951 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1952 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1953 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1954 "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT",
1955 "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL",
1956 "NEST", "READNONE", "READONLY", "GC", "FNNOTE", "INLINE", "ALWAYS",
1957 "NEVER", "OPTIMIZEFORSIZE", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1958 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1959 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1960 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1961 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "LocalNumber",
1962 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1963 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1964 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1965 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "FuncNoteList", "FuncNote",
1966 "OptFuncNotes", "OptGC", "OptAlign", "OptCAlign", "SectionString",
1967 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1968 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1969 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1970 "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition",
1971 "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition",
1972 "LibrariesDefinition", "LibList", "ArgListH", "ArgList",
1973 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1974 "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef",
1975 "ValueRef", "ResolvedVal", "ReturnedVal", "BasicBlockList", "BasicBlock",
1976 "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1977 "ParamList", "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
1978 "OptVolatile", "MemoryInst", 0
1983 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1985 static const yytype_uint16 yytoknum[] =
1987 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1988 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1989 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1990 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1991 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1992 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1993 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1994 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1995 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1996 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1997 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1998 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1999 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2000 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2001 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
2002 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
2003 415, 416, 40, 41, 61, 44, 42, 92, 91, 120,
2004 93, 60, 62, 123, 125, 99
2008 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2009 static const yytype_uint16 yyr1[] =
2011 0, 176, 177, 177, 177, 177, 177, 177, 177, 177,
2012 177, 178, 178, 178, 178, 178, 178, 179, 179, 179,
2013 179, 179, 179, 179, 179, 179, 179, 179, 179, 180,
2014 180, 180, 180, 180, 180, 180, 180, 180, 180, 181,
2015 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
2016 181, 181, 181, 181, 181, 182, 183, 183, 183, 183,
2017 183, 184, 184, 184, 185, 185, 186, 186, 187, 187,
2018 188, 189, 189, 190, 190, 191, 192, 192, 192, 192,
2019 192, 192, 193, 193, 193, 194, 194, 194, 194, 195,
2020 195, 195, 196, 196, 196, 196, 196, 197, 197, 197,
2021 198, 198, 198, 198, 198, 198, 198, 198, 199, 199,
2022 199, 199, 199, 199, 199, 199, 199, 199, 200, 200,
2023 201, 201, 201, 201, 201, 201, 202, 202, 203, 203,
2024 204, 204, 204, 205, 205, 206, 206, 207, 207, 208,
2025 208, 209, 210, 210, 211, 211, 212, 212, 213, 213,
2026 213, 213, 213, 213, 213, 214, 214, 214, 214, 214,
2027 214, 214, 214, 214, 214, 214, 214, 214, 215, 216,
2028 216, 217, 217, 218, 218, 218, 218, 219, 219, 220,
2029 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
2030 220, 220, 220, 220, 220, 220, 220, 220, 220, 221,
2031 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
2032 221, 221, 221, 222, 222, 223, 223, 224, 224, 225,
2033 225, 226, 226, 227, 227, 229, 228, 230, 228, 228,
2034 228, 228, 231, 228, 232, 228, 233, 228, 228, 228,
2035 228, 234, 235, 235, 236, 237, 237, 237, 238, 238,
2036 239, 239, 239, 239, 240, 241, 241, 242, 243, 243,
2037 244, 245, 246, 246, 247, 247, 247, 247, 247, 247,
2038 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
2039 247, 247, 247, 247, 248, 248, 248, 248, 249, 249,
2040 250, 251, 251, 252, 252, 253, 253, 254, 254, 254,
2041 255, 255, 255, 255, 255, 255, 255, 255, 255, 256,
2042 256, 257, 257, 258, 258, 259, 259, 259, 259, 259,
2043 260, 260, 261, 261, 262, 262, 263, 263, 263, 263,
2044 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
2045 263, 264, 264, 265, 265, 265, 265, 265, 265, 265,
2049 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2050 static const yytype_uint8 yyr2[] =
2052 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2059 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2060 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2061 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
2062 0, 1, 1, 1, 1, 1, 1, 2, 1, 1,
2063 1, 1, 1, 1, 1, 1, 1, 2, 0, 2,
2064 1, 1, 1, 1, 1, 1, 0, 2, 1, 3,
2065 3, 3, 1, 0, 4, 0, 2, 0, 2, 0,
2066 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
2067 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
2068 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2069 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2070 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2071 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2072 5, 8, 6, 6, 7, 7, 7, 7, 6, 8,
2073 8, 5, 7, 3, 1, 1, 1, 1, 0, 2,
2074 6, 1, 0, 1, 2, 0, 3, 0, 3, 3,
2075 3, 3, 0, 8, 0, 9, 0, 9, 5, 2,
2076 3, 1, 3, 3, 3, 3, 1, 0, 5, 3,
2077 1, 3, 1, 0, 11, 1, 1, 4, 1, 1,
2078 2, 3, 0, 1, 1, 1, 1, 1, 1, 1,
2079 1, 1, 1, 1, 3, 3, 2, 2, 3, 2,
2080 5, 4, 1, 5, 1, 1, 1, 1, 1, 1,
2081 2, 1, 3, 2, 2, 3, 3, 2, 0, 1,
2082 2, 2, 3, 9, 9, 8, 14, 1, 1, 6,
2083 5, 2, 2, 6, 7, 4, 4, 6, 6, 0,
2084 0, 3, 2, 3, 2, 1, 5, 5, 6, 6,
2085 6, 6, 4, 6, 4, 4, 6, 6, 2, 8,
2086 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
2090 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2091 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2092 means the default is an error. */
2093 static const yytype_uint16 yydefact[] =
2095 74, 61, 71, 62, 72, 63, 227, 225, 0, 0,
2096 0, 0, 0, 0, 85, 73, 0, 74, 223, 89,
2097 92, 0, 0, 239, 0, 0, 68, 0, 75, 76,
2098 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
2099 88, 85, 85, 218, 1, 224, 90, 91, 85, 228,
2100 93, 94, 95, 96, 85, 298, 226, 298, 0, 0,
2101 247, 240, 241, 229, 284, 285, 231, 148, 149, 150,
2102 153, 152, 151, 154, 155, 0, 0, 0, 0, 286,
2103 287, 156, 230, 158, 218, 218, 97, 217, 0, 100,
2104 100, 299, 294, 69, 258, 259, 260, 293, 242, 243,
2105 246, 0, 176, 159, 0, 0, 0, 0, 165, 177,
2106 0, 0, 176, 0, 0, 0, 99, 98, 0, 215,
2107 216, 0, 0, 101, 102, 103, 104, 105, 106, 0,
2108 261, 0, 0, 342, 342, 297, 0, 244, 175, 118,
2109 171, 173, 0, 0, 0, 0, 0, 0, 164, 0,
2110 0, 157, 0, 0, 170, 0, 169, 0, 238, 148,
2111 149, 150, 153, 152, 151, 0, 0, 67, 67, 107,
2112 0, 255, 256, 257, 70, 341, 325, 0, 0, 0,
2113 0, 100, 307, 308, 2, 3, 4, 5, 6, 7,
2114 8, 9, 10, 14, 15, 16, 11, 12, 13, 0,
2115 0, 0, 0, 0, 0, 0, 0, 17, 18, 19,
2116 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 0, 295, 100, 311, 0, 340, 296, 312, 245, 168,
2119 0, 126, 67, 67, 167, 0, 178, 0, 126, 67,
2120 67, 0, 219, 196, 197, 192, 194, 193, 195, 198,
2121 191, 187, 188, 0, 0, 0, 0, 0, 0, 0,
2122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2123 0, 190, 189, 232, 0, 324, 301, 67, 291, 300,
2124 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
2125 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
2126 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
2127 47, 48, 0, 0, 0, 139, 139, 347, 67, 67,
2128 338, 0, 0, 0, 0, 0, 67, 67, 67, 67,
2129 67, 0, 0, 0, 0, 0, 109, 111, 110, 108,
2130 112, 113, 114, 115, 116, 119, 174, 172, 161, 162,
2131 163, 166, 66, 160, 234, 236, 0, 0, 0, 0,
2132 0, 0, 0, 0, 0, 0, 0, 0, 180, 214,
2133 0, 0, 0, 184, 0, 181, 0, 0, 0, 144,
2134 253, 264, 265, 266, 267, 268, 273, 269, 270, 271,
2135 272, 262, 0, 0, 0, 0, 282, 289, 288, 290,
2136 0, 0, 302, 0, 0, 67, 67, 67, 67, 0,
2137 343, 0, 345, 320, 0, 0, 0, 0, 0, 0,
2138 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
2139 117, 123, 122, 120, 121, 124, 125, 127, 144, 144,
2140 0, 0, 0, 0, 0, 320, 0, 0, 0, 0,
2141 0, 0, 0, 179, 165, 177, 0, 182, 183, 0,
2142 0, 0, 0, 233, 252, 118, 250, 0, 263, 0,
2143 276, 0, 0, 0, 279, 0, 277, 292, 0, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 351, 0,
2145 0, 0, 334, 335, 0, 0, 0, 0, 352, 0,
2146 0, 0, 332, 0, 139, 0, 235, 237, 67, 0,
2147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2148 213, 186, 0, 0, 0, 0, 0, 0, 146, 144,
2149 65, 0, 126, 0, 275, 165, 0, 274, 278, 0,
2150 0, 319, 0, 0, 0, 0, 139, 140, 139, 0,
2151 0, 0, 0, 0, 0, 350, 322, 0, 67, 326,
2152 327, 319, 0, 348, 67, 220, 0, 0, 0, 0,
2153 200, 0, 0, 0, 0, 211, 0, 185, 0, 0,
2154 67, 141, 147, 145, 64, 249, 251, 118, 142, 0,
2155 281, 0, 0, 0, 118, 118, 0, 328, 329, 330,
2156 331, 344, 346, 321, 0, 0, 333, 336, 337, 323,
2157 0, 0, 139, 0, 0, 0, 0, 0, 208, 0,
2158 0, 0, 202, 203, 199, 65, 143, 137, 283, 280,
2159 0, 0, 0, 0, 126, 0, 313, 0, 353, 126,
2160 349, 204, 205, 206, 207, 0, 0, 0, 212, 248,
2161 0, 135, 0, 305, 0, 0, 109, 111, 118, 118,
2162 0, 118, 118, 314, 339, 201, 209, 210, 138, 0,
2163 133, 303, 0, 304, 0, 316, 315, 0, 0, 0,
2164 136, 0, 254, 0, 0, 0, 118, 118, 0, 0,
2165 0, 0, 318, 317, 0, 132, 0, 128, 310, 0,
2166 0, 0, 134, 0, 309, 0, 131, 130, 129, 306
2169 /* YYDEFGOTO[NTERM-NUM]. */
2170 static const yytype_int16 yydefgoto[] =
2172 -1, 278, 279, 280, 305, 322, 165, 166, 79, 595,
2173 113, 12, 134, 80, 14, 15, 41, 42, 43, 48,
2174 54, 118, 129, 355, 239, 447, 358, 706, 707, 692,
2175 680, 661, 420, 538, 637, 473, 539, 81, 167, 140,
2176 157, 141, 142, 110, 379, 406, 380, 121, 88, 158,
2177 16, 17, 18, 20, 19, 389, 448, 449, 63, 23,
2178 61, 101, 476, 477, 130, 173, 55, 96, 56, 49,
2179 479, 407, 83, 409, 288, 289, 57, 92, 93, 231,
2180 665, 135, 330, 606, 498, 508, 232, 233, 234, 235
2183 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2185 #define YYPACT_NINF -630
2186 static const yytype_int16 yypact[] =
2188 247, -630, -630, -630, -630, -630, -630, -630, 30, -108,
2189 28, -66, 102, -40, -1, -630, 128, 668, -630, 29,
2190 248, 21, 44, -630, -28, 143, -630, 1914, -630, -630,
2191 -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,
2192 -630, 191, 191, 170, -630, -630, -630, -630, 191, -630,
2193 -630, -630, -630, -630, 191, 167, -630, -7, 190, 210,
2194 221, -630, -630, -630, -630, -630, 114, -630, -630, -630,
2195 -630, -630, -630, -630, -630, 289, 315, 3, 50, -630,
2196 -630, -630, -32, -630, 252, 252, 171, -630, 280, 189,
2197 189, -630, -630, 324, -630, -630, -630, -630, -630, -630,
2198 -630, 57, 1662, -630, 153, 165, 313, 114, -630, -32,
2199 -84, 204, 1662, 214, 280, 280, -630, -630, 1614, -630,
2200 -630, 1955, 366, -630, -630, -630, -630, -630, -630, 1996,
2201 -630, -18, 219, 2230, 2230, -630, 354, -630, -630, -32,
2202 -630, 234, 260, 2040, 2040, 256, -80, 2040, -630, 411,
2203 275, -630, 1955, 2040, 114, 278, -32, 222, -630, 282,
2204 438, 439, 440, 441, 442, 158, 443, 1568, 398, -630,
2205 86, -630, -630, -630, -630, -630, -630, 400, 2081, 105,
2206 447, 189, -630, -630, -630, -630, -630, -630, -630, -630,
2207 -630, -630, -630, -630, -630, -630, -630, -630, -630, 480,
2208 284, 480, 284, 2040, 2040, 2040, 2040, -630, -630, -630,
2209 -630, -630, -630, -630, -630, -630, -630, -630, -630, 2040,
2210 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040,
2211 2040, -630, 189, -630, 55, -630, -630, -630, -630, 424,
2212 1703, -630, -19, -36, -630, 287, -32, 297, -630, 398,
2213 13, 1614, -630, -630, -630, -630, -630, -630, -630, -630,
2214 -630, -630, -630, 480, 284, 480, 284, 299, 300, 306,
2215 307, 310, 317, 320, 1744, 2122, 541, 453, 323, 326,
2216 328, -630, -630, -630, 330, -630, 114, 984, -630, 312,
2217 1157, 1157, -630, 1157, 1996, -630, -630, -630, -630, -630,
2218 -630, -630, -630, -630, -630, 2040, -630, -630, -630, -630,
2219 -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,
2220 -630, -630, 2040, 2040, 2040, -17, 24, -630, 984, -39,
2221 336, 337, 341, 342, 343, 345, 984, 984, 984, 984,
2222 984, 457, 1996, 2040, 2040, 509, -630, -630, -630, -630,
2223 -630, -630, -630, -630, -630, -630, -630, -630, 283, -630,
2224 -630, -630, -630, 283, -630, 214, 486, 364, 365, 367,
2225 368, 1955, 1955, 1955, 1955, 1955, 1955, 1955, -630, -630,
2226 63, 650, 54, -630, -70, -630, 1955, 1955, 1955, 363,
2227 1788, -630, -630, -630, -630, -630, -630, -630, -630, -630,
2228 -630, 470, 1829, 2166, 755, 510, -630, -630, -630, -630,
2229 2040, 369, -630, 374, 1157, 984, 984, 984, 984, 42,
2230 -630, 43, -630, -630, 1157, 373, 2040, 2040, 2040, 2040,
2231 2040, 377, 378, 379, 385, 397, 2040, 1157, 984, 403,
2232 -630, -630, -630, -630, -630, -630, -630, -630, 363, 363,
2233 2040, 1955, 1955, 1955, 1955, -630, 406, 420, 423, 425,
2234 378, 427, 1955, -630, 417, 1432, -60, -630, -630, 428,
2235 429, 557, 17, -630, -630, -32, 431, 445, -630, 580,
2236 -630, 177, 1034, 129, -630, -24, -630, -630, 588, 592,
2237 448, 446, 449, 450, 451, 1157, 608, 1157, 452, 460,
2238 1157, 463, -32, -630, 469, 471, 609, 614, 472, 2040,
2239 1157, 1157, -32, 476, 475, 2040, -630, -630, -6, 477,
2240 479, 482, 483, 141, 1955, 1955, 1955, 1955, 202, 1955,
2241 -630, -630, 473, 1955, 1955, 2040, 600, 637, -630, 363,
2242 481, 1870, -630, 484, -630, 474, -21, -630, -630, 1157,
2243 1157, 2207, 1157, 1157, 1157, 1157, 475, -630, 475, 2040,
2244 1157, 485, 2040, 2040, 2040, -630, -630, 647, 984, -630,
2245 -630, 2207, 598, -630, 984, -630, 1955, 1955, 1955, 1955,
2246 -630, 489, 492, 491, 506, -630, 378, -630, 512, 513,
2247 47, -630, -630, -630, -630, -630, -630, -32, -5, 655,
2248 -630, 507, 516, 514, 4, -32, 212, -630, -630, -630,
2249 -630, -630, -630, -630, 515, 1157, -630, -630, -630, -630,
2250 378, 242, 475, 521, 526, 532, 533, 1955, -630, 1955,
2251 1955, 243, -630, -630, -630, 481, -630, 643, -630, -630,
2252 684, 1, 827, 827, -630, 2248, -630, 534, 472, -630,
2253 -630, -630, -630, -630, -630, 539, 540, 542, -630, -630,
2254 702, 554, 1157, -630, 1296, 2, 548, 549, -630, -630,
2255 40, 4, -32, -630, 283, -630, -630, -630, -630, 691,
2256 562, -630, 552, -630, 1296, 424, 424, 701, 827, 827,
2257 -630, 559, -630, 705, 558, 1157, -630, -630, 147, 1157,
2258 708, 645, 424, 424, 563, -630, 266, -630, -630, 1157,
2259 709, 188, -630, 147, -630, 1157, -630, -630, -630, -630
2262 /* YYPGOTO[NTERM-NUM]. */
2263 static const yytype_int16 yypgoto[] =
2265 -630, 220, 223, 285, -181, -175, -174, -630, 0, 94,
2266 -142, 638, -630, 11, -630, -630, -630, -630, 71, -630,
2267 -630, -630, -144, -630, -226, -630, -227, -630, 26, -630,
2268 -630, -630, -308, 132, -630, -424, -630, -630, -26, 494,
2269 -126, -630, 628, 635, -113, -165, -271, 318, 352, 493,
2270 -630, -630, 725, -630, -630, -630, -630, -630, -630, -630,
2271 -630, -630, -630, -630, 656, -630, -630, -630, -630, -630,
2272 -630, -629, -56, 183, -190, -630, -630, 688, -630, 613,
2273 -630, -630, -630, 178, 293, -451, -630, 616, -630, -630
2276 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2277 positive, shift that token. If negative, reduce the rule which
2278 number is the opposite. If zero, do what YYDEFACT says.
2279 If YYTABLE_NINF, syntax error. */
2280 #define YYTABLE_NINF -223
2281 static const yytype_int16 yytable[] =
2283 11, 82, 281, 170, 382, 384, 293, 105, 168, 528,
2284 171, 13, 292, 292, 91, 327, 111, 11, 422, 111,
2285 323, 363, 94, 111, 516, 517, 283, 324, 13, 536,
2286 331, 332, 333, 334, 335, 682, 111, 294, 111, 249,
2287 341, 29, 30, 31, 32, 33, 34, 35, 36, 111,
2288 37, 536, 109, 495, 497, 694, 24, 64, 65, -154,
2289 107, 67, 68, 69, 70, 71, 72, 73, 111, 1,
2290 2, 537, 3, 4, 5, 46, 139, 47, 687, 111,
2291 109, 147, 367, 21, 369, 147, 139, 25, 342, 368,
2292 148, 370, 156, 11, 245, 462, 496, 496, 26, 22,
2293 74, 252, 111, 156, 468, 462, 2, 364, 365, 4,
2294 466, 282, 84, 85, 532, 593, 290, 242, 243, 89,
2295 27, 246, 291, 112, 28, 90, 112, 250, 44, 424,
2296 112, 481, 483, 485, -67, 631, 360, 441, 442, 443,
2297 60, 462, 444, 112, 462, 112, 445, 446, 419, -67,
2298 548, 359, 287, 601, 439, 172, 112, 575, 38, 39,
2299 40, 255, 256, 257, 258, 62, -154, 95, 414, 648,
2300 -154, 663, 683, 343, 344, 112, 106, 325, 326, 287,
2301 328, 284, 441, 442, 443, 58, 112, 444, 91, 421,
2302 -67, 445, 446, 329, 287, 287, 287, 287, 287, 336,
2303 337, 338, 339, 340, 287, 86, 573, 87, 59, 112,
2304 634, 546, 98, 116, 139, 117, 437, 75, 76, 462,
2305 487, 77, 136, 78, 108, 156, 467, 137, 462, 64,
2306 65, 408, 99, 463, 408, 408, 501, 408, 503, 504,
2307 505, 1, 2, 100, 3, 4, 5, -222, 611, 540,
2308 612, 122, 123, 124, 125, 126, 127, 128, 455, 456,
2309 457, 458, 459, 460, 461, -69, 1, 2, 156, 3,
2310 4, 5, 408, 469, 470, 471, 102, 6, 7, 415,
2311 408, 408, 408, 408, 408, -55, -55, -55, -55, 87,
2312 50, 51, 52, 103, 462, 53, 416, 417, 418, 8,
2313 281, 547, 704, 9, 580, 705, 559, 10, 253, 254,
2314 306, 307, 119, 120, 650, 598, 156, 438, 287, 104,
2315 64, 65, 143, 107, 67, 68, 69, 70, 71, 72,
2316 73, 132, 1, 2, 144, 3, 4, 5, 519, 520,
2317 521, 522, 462, 1, 716, 717, 3, 544, 5, 530,
2318 38, 39, 40, 228, 228, 465, 229, 229, 408, 408,
2319 408, 408, 408, 74, 475, 585, 149, 567, 408, 613,
2320 169, 635, 616, 617, 618, 644, 238, 645, 642, 643,
2321 151, 408, 408, 174, 287, 308, 309, 310, 311, 312,
2322 313, 314, 315, 316, 317, 318, 319, 320, 321, 240,
2323 287, 502, 287, 287, 287, 649, 658, 645, 567, 282,
2324 512, 581, 582, 583, 584, 247, 586, 670, 230, 230,
2325 588, 589, 674, 241, 518, 441, 442, 443, 244, 712,
2326 444, 713, 152, 153, 445, 446, 114, 115, 248, 408,
2327 251, 408, 685, 686, 408, 688, 689, -56, -57, -60,
2328 -59, -58, 259, 111, 408, 408, 465, 285, 292, 361,
2329 362, 371, 372, 623, 624, 625, 626, 664, 373, 374,
2330 702, 703, 375, 411, 412, 385, 413, 410, 345, 376,
2331 75, 76, 377, 568, 77, 386, 78, 145, 387, 574,
2332 388, 684, 390, 408, 408, 436, 408, 408, 408, 408,
2333 1, 425, 426, 3, 408, 5, 427, 428, 429, 590,
2334 430, 423, 408, 440, 655, 597, 656, 657, 408, 431,
2335 432, 433, 434, 435, 450, 605, 451, 452, 472, 453,
2336 454, 478, 486, 287, 488, 345, 287, 287, 287, 489,
2337 594, 500, 506, 507, 509, 605, 346, 347, 64, 65,
2338 510, 107, 159, 160, 161, 162, 163, 164, 73, 408,
2339 1, 2, 511, 3, 4, 5, 348, 349, 515, 350,
2340 351, 524, 352, 353, 354, 295, 296, 297, 298, 299,
2341 300, 301, 302, 303, 304, 525, 408, 408, 526, 531,
2342 527, 74, 529, 533, 534, 535, 541, 490, 491, 492,
2343 493, 494, 543, 346, 347, 549, 408, 499, 542, 550,
2344 551, 552, 557, 565, 553, 554, 555, 559, 566, 672,
2345 513, 514, 591, 348, 349, 560, 350, 351, 562, 352,
2346 353, 354, 408, 408, 563, 594, 564, 567, 571, 408,
2347 572, 592, 576, 408, 577, 587, 600, 578, 579, 599,
2348 615, 619, 496, 408, 627, 628, 629, 64, 65, 408,
2349 107, 159, 160, 161, 162, 163, 164, 73, -221, 1,
2350 2, 630, 3, 4, 5, 632, 633, 638, 556, 639,
2351 558, 640, 641, 561, 651, 646, -69, 1, 2, 652,
2352 3, 4, 5, 569, 570, 653, 654, 660, 6, 7,
2353 74, 662, 675, 676, 673, 677, 678, 679, 75, 76,
2354 -18, -19, 77, 690, 78, 383, 691, 693, 695, 710,
2355 8, 698, 699, 700, 9, 709, 715, 711, 10, 659,
2356 636, 133, 602, 603, 357, 607, 608, 609, 610, 718,
2357 150, 146, 45, 614, 366, 97, 131, 236, 523, 621,
2358 237, 620, 0, 0, 0, 0, 0, 622, 0, 0,
2359 0, 0, 64, 65, 0, 107, 159, 160, 161, 162,
2360 163, 164, 73, 0, 1, 2, 0, 3, 4, 5,
2361 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2362 0, 0, 0, 0, 0, 0, 0, 0, 647, 0,
2363 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
2364 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2365 0, 77, 0, 78, 464, 668, 669, 0, 0, 0,
2366 391, 392, 393, 394, 64, 65, 395, 0, 0, 0,
2367 0, 0, 0, 0, 0, 681, 1, 2, 0, 3,
2368 4, 5, 396, 397, 398, 0, 0, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 399, 400, 0,
2370 0, 696, 697, 0, 0, 0, 0, 0, 701, 0,
2371 0, 345, 708, 0, 0, 0, 401, 0, 0, 0,
2372 0, 0, 714, 0, 0, 0, 0, 0, 719, 0,
2373 0, 0, 0, 184, 185, 186, 187, 188, 189, 190,
2374 191, 192, 193, 194, 195, 196, 197, 198, 263, 264,
2375 265, 266, 75, 76, 0, 0, 77, 0, 78, 484,
2376 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2377 0, 0, 0, 0, 0, 0, 0, 267, 207, 666,
2378 667, 210, 211, 212, 213, 214, 215, 216, 217, 218,
2379 0, 268, 0, 269, 270, 271, 0, 272, 273, 348,
2380 349, 0, 350, 351, 0, 352, 353, 354, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 391, 392, 393,
2382 394, 64, 65, 395, 0, 402, 0, 0, 403, 0,
2383 404, 0, 405, 1, 2, 0, 3, 4, 5, 396,
2384 397, 398, 0, 0, 0, 0, 0, 0, 0, 0,
2385 0, 0, 0, 0, 399, 400, 0, 0, 0, 0,
2386 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2387 0, 64, 65, 401, 107, 159, 160, 161, 162, 163,
2388 164, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2389 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2390 194, 195, 196, 197, 198, 263, 264, 265, 266, 0,
2391 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
2392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2393 0, 0, 0, 0, 267, 207, 208, 209, 210, 211,
2394 212, 213, 214, 215, 216, 217, 218, 0, 268, 0,
2395 269, 270, 271, 0, 272, 273, 0, 0, 0, 0,
2396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
2398 0, 0, 402, 0, 0, 403, 0, 404, 0, 405,
2399 391, 392, 393, 394, 64, 65, 395, 0, 0, 0,
2400 0, 0, 0, 0, 0, 0, 1, 2, 0, 3,
2401 4, 5, 396, 397, 398, 0, 0, 0, 0, 0,
2402 0, 0, 0, 0, 0, 0, 0, 399, 400, 0,
2403 0, 75, 76, 0, 0, 77, 0, 78, 545, 0,
2404 0, 0, 0, 0, 0, 0, 401, 0, 0, 0,
2405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2406 0, 0, 0, 184, 185, 186, 187, 188, 189, 190,
2407 191, 192, 193, 194, 195, 196, 197, 198, 263, 264,
2408 265, 266, 0, 0, 0, 0, 0, 0, 0, 0,
2409 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2410 0, 0, 0, 0, 0, 0, 0, 267, 207, 208,
2411 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
2412 0, 268, 0, 269, 270, 271, 0, 272, 273, 391,
2413 392, 393, 394, 0, 0, 395, 0, 0, 0, 0,
2414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2415 0, 396, 397, 398, 0, 402, 0, 0, 403, 0,
2416 404, 0, 405, 0, 0, 0, 399, 400, 0, 0,
2417 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2418 0, 0, 0, 0, 0, 401, 0, 0, 0, 0,
2419 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2420 0, 0, 184, 185, 186, 187, 188, 189, 190, 191,
2421 192, 193, 194, 195, 196, 197, 198, 263, 264, 265,
2422 266, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2423 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2424 0, 0, 0, 0, 0, 0, 267, 207, 208, 209,
2425 210, 211, 212, 213, 214, 215, 216, 217, 218, 0,
2426 268, 0, 269, 270, 271, 0, 272, 273, 0, 64,
2427 65, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2428 0, 1, 2, 0, 3, 4, 5, 260, 0, 0,
2429 0, 0, 0, 0, 402, 0, 0, 403, 0, 404,
2430 0, 405, 261, 262, 0, 0, 0, 0, 0, 0,
2431 0, 0, 0, 0, 0, 0, 0, 111, 0, 0,
2432 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2433 0, 0, 0, 0, 0, 0, 0, 0, 184, 185,
2434 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2435 196, 197, 198, 263, 264, 265, 266, 0, 0, 0,
2436 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2437 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2438 0, 0, 267, 207, 208, 209, 210, 211, 212, 213,
2439 214, 215, 216, 217, 218, 0, 268, 0, 269, 270,
2440 271, 0, 272, 273, 0, 64, 65, 0, 0, 0,
2441 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2442 3, 4, 5, 260, 112, 0, 0, 0, -67, 0,
2443 274, 0, 0, 275, 0, 276, 0, 277, 261, 262,
2444 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2445 0, 64, 65, 111, 154, 67, 68, 69, 70, 71,
2446 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2447 0, 0, 0, 0, 184, 185, 186, 187, 188, 189,
2448 190, 191, 192, 193, 194, 195, 196, 197, 198, 263,
2449 264, 265, 266, 0, 74, 0, 0, 0, 0, 64,
2450 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2451 0, 1, 2, 0, 3, 4, 5, 0, 267, 207,
2452 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
2453 218, 138, 268, 0, 269, 270, 271, 0, 272, 273,
2454 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2455 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2456 112, 0, 0, 0, 0, 0, 274, 0, 0, 275,
2457 155, 276, 356, 277, 0, 0, 0, 0, 0, 0,
2458 0, 64, 65, 74, 107, 159, 160, 161, 162, 163,
2459 164, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2460 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2461 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2462 0, 0, 0, 0, 74, 64, 65, 0, 107, 67,
2463 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2464 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2465 0, 0, 0, 0, 0, 0, 0, 474, 0, 75,
2466 76, 0, 0, 77, 0, 78, 64, 65, 74, 107,
2467 159, 160, 161, 162, 163, 164, 73, 0, 1, 2,
2468 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2469 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2470 75, 76, 0, 0, 77, 0, 78, 64, 65, 74,
2471 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2472 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2473 0, 0, 0, 0, 0, 0, 0, 0, 0, 596,
2474 0, 75, 76, 0, 378, 77, 0, 78, 0, 0,
2475 74, 64, 65, 0, 66, 67, 68, 69, 70, 71,
2476 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2477 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2478 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2479 0, 78, 64, 65, 74, 107, 159, 160, 161, 162,
2480 163, 164, 73, 0, 1, 2, 0, 3, 4, 5,
2481 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2482 0, 0, 0, 0, 0, 0, 75, 76, 0, 480,
2483 77, 0, 78, 64, 65, 74, 154, 67, 68, 69,
2484 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2485 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2486 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2487 0, 77, 0, 78, 0, 0, 74, 64, 65, 0,
2488 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2489 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2490 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2491 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
2492 74, 286, 67, 68, 69, 70, 71, 72, 73, 0,
2493 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2494 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2495 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2496 65, 74, 107, 159, 160, 161, 162, 163, 164, 73,
2497 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2498 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2499 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2500 0, 0, 74, 64, 65, 0, 107, 159, 160, 161,
2501 162, 163, 164, 73, 0, 1, 2, 0, 3, 4,
2502 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2503 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2504 0, 77, 0, 78, 64, 65, 74, 107, 67, 68,
2505 69, 70, 71, 72, 604, 0, 1, 2, 0, 3,
2506 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2507 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2508 0, 0, 77, 0, 78, 64, 65, 74, 107, 67,
2509 68, 69, 70, 71, 72, 671, 175, 1, 2, 0,
2510 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2511 0, 0, 0, 0, 0, 0, 0, 176, 177, 75,
2512 76, 0, 0, 77, 0, 381, 0, 0, 74, 0,
2513 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2514 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
2515 198, 199, 200, 201, 202, 0, 0, 0, 0, 0,
2516 0, 0, 0, 75, 76, 0, 0, 77, 0, 482,
2517 0, 0, 0, 0, 0, 203, 204, 205, 0, 0,
2518 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
2519 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
2520 226, 227, 0, 0, 75, 76, 0, 0, 77, 0,
2521 78, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2522 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2523 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2524 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2528 static const yytype_int16 yycheck[] =
2530 0, 27, 167, 129, 275, 276, 180, 4, 121, 460,
2531 28, 0, 11, 11, 21, 205, 55, 17, 326, 55,
2532 201, 248, 29, 55, 448, 449, 168, 202, 17, 34,
2533 220, 221, 222, 223, 224, 664, 55, 181, 55, 152,
2534 230, 42, 43, 44, 45, 46, 47, 48, 49, 55,
2535 51, 34, 78, 11, 11, 684, 164, 7, 8, 55,
2536 10, 11, 12, 13, 14, 15, 16, 17, 55, 19,
2537 20, 54, 22, 23, 24, 46, 102, 48, 38, 55,
2538 106, 165, 263, 53, 265, 165, 112, 59, 232, 264,
2539 174, 266, 118, 93, 174, 165, 54, 54, 164, 69,
2540 50, 157, 55, 129, 174, 165, 20, 249, 250, 23,
2541 381, 167, 41, 42, 174, 539, 11, 143, 144, 48,
2542 18, 147, 17, 162, 164, 54, 162, 153, 0, 168,
2543 162, 402, 403, 404, 166, 586, 172, 142, 143, 144,
2544 168, 165, 147, 162, 165, 162, 151, 152, 165, 166,
2545 174, 170, 178, 174, 344, 173, 162, 163, 159, 160,
2546 161, 3, 4, 5, 6, 22, 162, 174, 294, 620,
2547 166, 170, 170, 118, 119, 162, 173, 203, 204, 205,
2548 206, 170, 142, 143, 144, 164, 162, 147, 21, 165,
2549 166, 151, 152, 219, 220, 221, 222, 223, 224, 225,
2550 226, 227, 228, 229, 230, 35, 514, 37, 164, 162,
2551 163, 482, 22, 42, 240, 44, 342, 167, 168, 165,
2552 410, 171, 165, 173, 174, 251, 172, 170, 165, 7,
2553 8, 287, 22, 170, 290, 291, 426, 293, 428, 429,
2554 430, 19, 20, 22, 22, 23, 24, 0, 556, 475,
2555 558, 62, 63, 64, 65, 66, 67, 68, 371, 372,
2556 373, 374, 375, 376, 377, 18, 19, 20, 294, 22,
2557 23, 24, 328, 386, 387, 388, 162, 30, 31, 305,
2558 336, 337, 338, 339, 340, 3, 4, 5, 6, 37,
2559 42, 43, 44, 4, 165, 47, 322, 323, 324, 52,
2560 465, 172, 155, 56, 163, 158, 165, 60, 26, 27,
2561 26, 27, 32, 33, 622, 542, 342, 343, 344, 4,
2562 7, 8, 169, 10, 11, 12, 13, 14, 15, 16,
2563 17, 7, 19, 20, 169, 22, 23, 24, 451, 452,
2564 453, 454, 165, 19, 156, 157, 22, 170, 24, 462,
2565 159, 160, 161, 133, 134, 381, 133, 134, 414, 415,
2566 416, 417, 418, 50, 390, 163, 162, 165, 424, 559,
2567 4, 597, 562, 563, 564, 163, 22, 165, 604, 605,
2568 166, 437, 438, 164, 410, 101, 102, 103, 104, 105,
2569 106, 107, 108, 109, 110, 111, 112, 113, 114, 165,
2570 426, 427, 428, 429, 430, 163, 163, 165, 165, 465,
2571 436, 524, 525, 526, 527, 4, 529, 644, 133, 134,
2572 533, 534, 649, 163, 450, 142, 143, 144, 172, 163,
2573 147, 165, 114, 115, 151, 152, 84, 85, 163, 495,
2574 162, 497, 668, 669, 500, 671, 672, 9, 9, 9,
2575 9, 9, 9, 55, 510, 511, 482, 57, 11, 172,
2576 163, 162, 162, 576, 577, 578, 579, 641, 162, 162,
2577 696, 697, 162, 290, 291, 22, 293, 165, 54, 162,
2578 167, 168, 162, 509, 171, 162, 173, 174, 162, 515,
2579 162, 665, 162, 549, 550, 38, 552, 553, 554, 555,
2580 19, 165, 165, 22, 560, 24, 165, 165, 165, 535,
2581 165, 328, 568, 4, 627, 541, 629, 630, 574, 336,
2582 337, 338, 339, 340, 38, 551, 162, 162, 165, 162,
2583 162, 61, 22, 559, 165, 54, 562, 563, 564, 165,
2584 540, 168, 165, 165, 165, 571, 122, 123, 7, 8,
2585 165, 10, 11, 12, 13, 14, 15, 16, 17, 615,
2586 19, 20, 165, 22, 23, 24, 142, 143, 165, 145,
2587 146, 165, 148, 149, 150, 95, 96, 97, 98, 99,
2588 100, 101, 102, 103, 104, 165, 642, 643, 165, 172,
2589 165, 50, 165, 165, 165, 38, 165, 414, 415, 416,
2590 417, 418, 22, 122, 123, 17, 662, 424, 163, 17,
2591 162, 165, 4, 4, 165, 165, 165, 165, 4, 645,
2592 437, 438, 22, 142, 143, 165, 145, 146, 165, 148,
2593 149, 150, 688, 689, 165, 635, 165, 165, 162, 695,
2594 165, 4, 165, 699, 165, 172, 172, 165, 165, 165,
2595 165, 4, 54, 709, 165, 163, 165, 7, 8, 715,
2596 10, 11, 12, 13, 14, 15, 16, 17, 0, 19,
2597 20, 165, 22, 23, 24, 163, 163, 22, 495, 172,
2598 497, 165, 168, 500, 163, 170, 18, 19, 20, 163,
2599 22, 23, 24, 510, 511, 163, 163, 54, 30, 31,
2600 50, 17, 163, 163, 170, 163, 4, 153, 167, 168,
2601 162, 162, 171, 22, 173, 174, 154, 165, 17, 74,
2602 52, 162, 17, 165, 56, 17, 17, 164, 60, 635,
2603 598, 93, 549, 550, 240, 552, 553, 554, 555, 713,
2604 112, 106, 17, 560, 251, 57, 90, 134, 455, 571,
2605 134, 568, -1, -1, -1, -1, -1, 574, -1, -1,
2606 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2607 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2608 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2609 -1, -1, -1, -1, -1, -1, -1, -1, 615, -1,
2610 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
2611 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2612 -1, 171, -1, 173, 174, 642, 643, -1, -1, -1,
2613 3, 4, 5, 6, 7, 8, 9, -1, -1, -1,
2614 -1, -1, -1, -1, -1, 662, 19, 20, -1, 22,
2615 23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
2616 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2617 -1, 688, 689, -1, -1, -1, -1, -1, 695, -1,
2618 -1, 54, 699, -1, -1, -1, 59, -1, -1, -1,
2619 -1, -1, 709, -1, -1, -1, -1, -1, 715, -1,
2620 -1, -1, -1, 76, 77, 78, 79, 80, 81, 82,
2621 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2622 93, 94, 167, 168, -1, -1, 171, -1, 173, 174,
2623 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2624 -1, -1, -1, -1, -1, -1, -1, 120, 121, 122,
2625 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2626 -1, 134, -1, 136, 137, 138, -1, 140, 141, 142,
2627 143, -1, 145, 146, -1, 148, 149, 150, -1, -1,
2628 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
2629 6, 7, 8, 9, -1, 168, -1, -1, 171, -1,
2630 173, -1, 175, 19, 20, -1, 22, 23, 24, 25,
2631 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
2632 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2633 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
2634 -1, 7, 8, 59, 10, 11, 12, 13, 14, 15,
2635 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2636 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2637 86, 87, 88, 89, 90, 91, 92, 93, 94, -1,
2638 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
2639 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2640 -1, -1, -1, -1, 120, 121, 122, 123, 124, 125,
2641 126, 127, 128, 129, 130, 131, 132, -1, 134, -1,
2642 136, 137, 138, -1, 140, 141, -1, -1, -1, -1,
2643 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2644 -1, -1, -1, -1, -1, -1, 162, -1, -1, -1,
2645 -1, -1, 168, -1, -1, 171, -1, 173, -1, 175,
2646 3, 4, 5, 6, 7, 8, 9, -1, -1, -1,
2647 -1, -1, -1, -1, -1, -1, 19, 20, -1, 22,
2648 23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
2649 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2650 -1, 167, 168, -1, -1, 171, -1, 173, 174, -1,
2651 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2652 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2653 -1, -1, -1, 76, 77, 78, 79, 80, 81, 82,
2654 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2655 93, 94, -1, -1, -1, -1, -1, -1, -1, -1,
2656 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2657 -1, -1, -1, -1, -1, -1, -1, 120, 121, 122,
2658 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2659 -1, 134, -1, 136, 137, 138, -1, 140, 141, 3,
2660 4, 5, 6, -1, -1, 9, -1, -1, -1, -1,
2661 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2662 -1, 25, 26, 27, -1, 168, -1, -1, 171, -1,
2663 173, -1, 175, -1, -1, -1, 40, 41, -1, -1,
2664 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2665 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
2666 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2667 -1, -1, 76, 77, 78, 79, 80, 81, 82, 83,
2668 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2669 94, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2670 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2671 -1, -1, -1, -1, -1, -1, 120, 121, 122, 123,
2672 124, 125, 126, 127, 128, 129, 130, 131, 132, -1,
2673 134, -1, 136, 137, 138, -1, 140, 141, -1, 7,
2674 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2675 -1, 19, 20, -1, 22, 23, 24, 25, -1, -1,
2676 -1, -1, -1, -1, 168, -1, -1, 171, -1, 173,
2677 -1, 175, 40, 41, -1, -1, -1, -1, -1, -1,
2678 -1, -1, -1, -1, -1, -1, -1, 55, -1, -1,
2679 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2680 -1, -1, -1, -1, -1, -1, -1, -1, 76, 77,
2681 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2682 88, 89, 90, 91, 92, 93, 94, -1, -1, -1,
2683 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2684 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2685 -1, -1, 120, 121, 122, 123, 124, 125, 126, 127,
2686 128, 129, 130, 131, 132, -1, 134, -1, 136, 137,
2687 138, -1, 140, 141, -1, 7, 8, -1, -1, -1,
2688 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
2689 22, 23, 24, 25, 162, -1, -1, -1, 166, -1,
2690 168, -1, -1, 171, -1, 173, -1, 175, 40, 41,
2691 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 -1, 7, 8, 55, 10, 11, 12, 13, 14, 15,
2693 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2694 -1, -1, -1, -1, 76, 77, 78, 79, 80, 81,
2695 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2696 92, 93, 94, -1, 50, -1, -1, -1, -1, 7,
2697 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2698 -1, 19, 20, -1, 22, 23, 24, -1, 120, 121,
2699 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2700 132, 39, 134, -1, 136, 137, 138, -1, 140, 141,
2701 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2702 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2703 162, -1, -1, -1, -1, -1, 168, -1, -1, 171,
2704 126, 173, 39, 175, -1, -1, -1, -1, -1, -1,
2705 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
2706 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2707 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2708 -1, 167, 168, -1, -1, 171, -1, 173, -1, -1,
2709 -1, -1, -1, -1, 50, 7, 8, -1, 10, 11,
2710 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2711 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2712 -1, -1, -1, -1, -1, -1, -1, 39, -1, 167,
2713 168, -1, -1, 171, -1, 173, 7, 8, 50, 10,
2714 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2715 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2716 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2717 167, 168, -1, -1, 171, -1, 173, 7, 8, 50,
2718 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2719 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2720 -1, -1, -1, -1, -1, -1, -1, -1, -1, 39,
2721 -1, 167, 168, -1, 170, 171, -1, 173, -1, -1,
2722 50, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2723 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2724 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2725 -1, -1, -1, -1, -1, 167, 168, -1, -1, 171,
2726 -1, 173, 7, 8, 50, 10, 11, 12, 13, 14,
2727 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2728 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2729 -1, -1, -1, -1, -1, -1, 167, 168, -1, 170,
2730 171, -1, 173, 7, 8, 50, 10, 11, 12, 13,
2731 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2732 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2733 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2734 -1, 171, -1, 173, -1, -1, 50, 7, 8, -1,
2735 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2736 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2737 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2738 -1, 167, 168, -1, -1, 171, -1, 173, 7, 8,
2739 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2740 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2741 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2742 -1, -1, 167, 168, -1, -1, 171, -1, 173, 7,
2743 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2744 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2745 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2746 -1, -1, -1, 167, 168, -1, -1, 171, -1, 173,
2747 -1, -1, 50, 7, 8, -1, 10, 11, 12, 13,
2748 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2749 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2750 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2751 -1, 171, -1, 173, 7, 8, 50, 10, 11, 12,
2752 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2753 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2754 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
2755 -1, -1, 171, -1, 173, 7, 8, 50, 10, 11,
2756 12, 13, 14, 15, 16, 17, 36, 19, 20, -1,
2757 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2758 -1, -1, -1, -1, -1, -1, -1, 57, 58, 167,
2759 168, -1, -1, 171, -1, 173, -1, -1, 50, -1,
2760 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2761 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2762 90, 91, 92, 93, 94, -1, -1, -1, -1, -1,
2763 -1, -1, -1, 167, 168, -1, -1, 171, -1, 173,
2764 -1, -1, -1, -1, -1, 115, 116, 117, -1, -1,
2765 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2766 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
2767 140, 141, -1, -1, 167, 168, -1, -1, 171, -1,
2768 173, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2769 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2770 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2771 -1, -1, -1, -1, -1, 167, 168, -1, -1, 171,
2775 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2776 symbol of state STATE-NUM. */
2777 static const yytype_uint16 yystos[] =
2779 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
2780 60, 184, 187, 189, 190, 191, 226, 227, 228, 230,
2781 229, 53, 69, 235, 164, 59, 164, 18, 164, 42,
2782 43, 44, 45, 46, 47, 48, 49, 51, 159, 160,
2783 161, 192, 193, 194, 0, 228, 46, 48, 195, 245,
2784 42, 43, 44, 47, 196, 242, 244, 252, 164, 164,
2785 168, 236, 22, 234, 7, 8, 10, 11, 12, 13,
2786 14, 15, 16, 17, 50, 167, 168, 171, 173, 184,
2787 189, 213, 214, 248, 194, 194, 35, 37, 224, 194,
2788 194, 21, 253, 254, 29, 174, 243, 253, 22, 22,
2789 22, 237, 162, 4, 4, 4, 173, 10, 174, 214,
2790 219, 55, 162, 186, 224, 224, 42, 44, 197, 32,
2791 33, 223, 62, 63, 64, 65, 66, 67, 68, 198,
2792 240, 240, 7, 187, 188, 257, 165, 170, 39, 214,
2793 215, 217, 218, 169, 169, 174, 219, 165, 174, 162,
2794 218, 166, 223, 223, 10, 126, 214, 216, 225, 11,
2795 12, 13, 14, 15, 16, 182, 183, 214, 220, 4,
2796 216, 28, 173, 241, 164, 36, 57, 58, 70, 71,
2797 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2798 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2799 92, 93, 94, 115, 116, 117, 120, 121, 122, 123,
2800 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
2801 134, 135, 136, 137, 138, 139, 140, 141, 177, 178,
2802 179, 255, 262, 263, 264, 265, 255, 263, 22, 200,
2803 165, 163, 214, 214, 172, 174, 214, 4, 163, 220,
2804 214, 162, 248, 26, 27, 3, 4, 5, 6, 9,
2805 25, 40, 41, 91, 92, 93, 94, 120, 134, 136,
2806 137, 138, 140, 141, 168, 171, 173, 175, 177, 178,
2807 179, 221, 248, 186, 189, 57, 10, 214, 250, 251,
2808 11, 17, 11, 182, 198, 95, 96, 97, 98, 99,
2809 100, 101, 102, 103, 104, 180, 26, 27, 101, 102,
2810 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
2811 113, 114, 181, 180, 181, 214, 214, 250, 214, 214,
2812 258, 250, 250, 250, 250, 250, 214, 214, 214, 214,
2813 214, 250, 198, 118, 119, 54, 122, 123, 142, 143,
2814 145, 146, 148, 149, 150, 199, 39, 215, 202, 170,
2815 172, 172, 163, 202, 186, 186, 225, 180, 181, 180,
2816 181, 162, 162, 162, 162, 162, 162, 162, 170, 220,
2817 222, 173, 222, 174, 222, 22, 162, 162, 162, 231,
2818 162, 3, 4, 5, 6, 9, 25, 26, 27, 40,
2819 41, 59, 168, 171, 173, 175, 221, 247, 248, 249,
2820 165, 249, 249, 249, 216, 214, 214, 214, 214, 165,
2821 208, 165, 208, 249, 168, 165, 165, 165, 165, 165,
2822 165, 249, 249, 249, 249, 249, 38, 216, 214, 250,
2823 4, 142, 143, 144, 147, 151, 152, 201, 232, 233,
2824 38, 162, 162, 162, 162, 220, 220, 220, 220, 220,
2825 220, 220, 165, 170, 174, 214, 222, 172, 174, 220,
2826 220, 220, 165, 211, 39, 214, 238, 239, 61, 246,
2827 170, 222, 173, 222, 174, 222, 22, 250, 165, 165,
2828 249, 249, 249, 249, 249, 11, 54, 11, 260, 249,
2829 168, 250, 214, 250, 250, 250, 165, 165, 261, 165,
2830 165, 165, 214, 249, 249, 165, 211, 211, 214, 220,
2831 220, 220, 220, 260, 165, 165, 165, 165, 261, 165,
2832 220, 172, 174, 165, 165, 38, 34, 54, 209, 212,
2833 200, 165, 163, 22, 170, 174, 222, 172, 174, 17,
2834 17, 162, 165, 165, 165, 165, 249, 4, 249, 165,
2835 165, 249, 165, 165, 165, 4, 4, 165, 214, 249,
2836 249, 162, 165, 208, 214, 163, 165, 165, 165, 165,
2837 163, 220, 220, 220, 220, 163, 220, 172, 220, 220,
2838 214, 22, 4, 211, 184, 185, 39, 214, 202, 165,
2839 172, 174, 249, 249, 17, 214, 259, 249, 249, 249,
2840 249, 208, 208, 250, 249, 165, 250, 250, 250, 4,
2841 249, 259, 249, 220, 220, 220, 220, 165, 163, 165,
2842 165, 261, 163, 163, 163, 200, 209, 210, 22, 172,
2843 165, 168, 200, 200, 163, 165, 170, 249, 261, 163,
2844 208, 163, 163, 163, 163, 220, 220, 220, 163, 185,
2845 54, 207, 17, 170, 182, 256, 122, 123, 249, 249,
2846 202, 17, 214, 170, 202, 163, 163, 163, 4, 153,
2847 206, 249, 247, 170, 182, 200, 200, 38, 200, 200,
2848 22, 154, 205, 165, 247, 17, 249, 249, 162, 17,
2849 165, 249, 200, 200, 155, 158, 203, 204, 249, 17,
2850 74, 164, 163, 165, 249, 17, 156, 157, 204, 249
2853 #define yyerrok (yyerrstatus = 0)
2854 #define yyclearin (yychar = YYEMPTY)
2855 #define YYEMPTY (-2)
2858 #define YYACCEPT goto yyacceptlab
2859 #define YYABORT goto yyabortlab
2860 #define YYERROR goto yyerrorlab
2863 /* Like YYERROR except do call yyerror. This remains here temporarily
2864 to ease the transition to the new meaning of YYERROR, for GCC.
2865 Once GCC version 2 has supplanted version 1, this can go. */
2867 #define YYFAIL goto yyerrlab
2869 #define YYRECOVERING() (!!yyerrstatus)
2871 #define YYBACKUP(Token, Value) \
2873 if (yychar == YYEMPTY && yylen == 1) \
2877 yytoken = YYTRANSLATE (yychar); \
2883 yyerror (YY_("syntax error: cannot back up")); \
2890 #define YYERRCODE 256
2893 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2894 If N is 0, then set CURRENT to the empty location which ends
2895 the previous symbol: RHS[0] (always defined). */
2897 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2898 #ifndef YYLLOC_DEFAULT
2899 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2903 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2904 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2905 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2906 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2910 (Current).first_line = (Current).last_line = \
2911 YYRHSLOC (Rhs, 0).last_line; \
2912 (Current).first_column = (Current).last_column = \
2913 YYRHSLOC (Rhs, 0).last_column; \
2919 /* YY_LOCATION_PRINT -- Print the location on the stream.
2920 This macro was not mandated originally: define only if we know
2921 we won't break user code: when these are the locations we know. */
2923 #ifndef YY_LOCATION_PRINT
2924 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2925 # define YY_LOCATION_PRINT(File, Loc) \
2926 fprintf (File, "%d.%d-%d.%d", \
2927 (Loc).first_line, (Loc).first_column, \
2928 (Loc).last_line, (Loc).last_column)
2930 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2935 /* YYLEX -- calling `yylex' with the right arguments. */
2938 # define YYLEX yylex (YYLEX_PARAM)
2940 # define YYLEX yylex ()
2943 /* Enable debugging if requested. */
2947 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2948 # define YYFPRINTF fprintf
2951 # define YYDPRINTF(Args) \
2957 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2961 YYFPRINTF (stderr, "%s ", Title); \
2962 yy_symbol_print (stderr, \
2964 YYFPRINTF (stderr, "\n"); \
2969 /*--------------------------------.
2970 | Print this symbol on YYOUTPUT. |
2971 `--------------------------------*/
2974 #if (defined __STDC__ || defined __C99__FUNC__ \
2975 || defined __cplusplus || defined _MSC_VER)
2977 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2980 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2983 YYSTYPE const * const yyvaluep;
2989 if (yytype < YYNTOKENS)
2990 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
3002 /*--------------------------------.
3003 | Print this symbol on YYOUTPUT. |
3004 `--------------------------------*/
3006 #if (defined __STDC__ || defined __C99__FUNC__ \
3007 || defined __cplusplus || defined _MSC_VER)
3009 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3012 yy_symbol_print (yyoutput, yytype, yyvaluep)
3015 YYSTYPE const * const yyvaluep;
3018 if (yytype < YYNTOKENS)
3019 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3021 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
3023 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3024 YYFPRINTF (yyoutput, ")");
3027 /*------------------------------------------------------------------.
3028 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
3030 `------------------------------------------------------------------*/
3032 #if (defined __STDC__ || defined __C99__FUNC__ \
3033 || defined __cplusplus || defined _MSC_VER)
3035 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3038 yy_stack_print (bottom, top)
3039 yytype_int16 *bottom;
3043 YYFPRINTF (stderr, "Stack now");
3044 for (; bottom <= top; ++bottom)
3045 YYFPRINTF (stderr, " %d", *bottom);
3046 YYFPRINTF (stderr, "\n");
3049 # define YY_STACK_PRINT(Bottom, Top) \
3052 yy_stack_print ((Bottom), (Top)); \
3056 /*------------------------------------------------.
3057 | Report that the YYRULE is going to be reduced. |
3058 `------------------------------------------------*/
3060 #if (defined __STDC__ || defined __C99__FUNC__ \
3061 || defined __cplusplus || defined _MSC_VER)
3063 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3066 yy_reduce_print (yyvsp, yyrule)
3071 int yynrhs = yyr2[yyrule];
3073 unsigned long int yylno = yyrline[yyrule];
3074 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3076 /* The symbols being reduced. */
3077 for (yyi = 0; yyi < yynrhs; yyi++)
3079 fprintf (stderr, " $%d = ", yyi + 1);
3080 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3081 &(yyvsp[(yyi + 1) - (yynrhs)])
3083 fprintf (stderr, "\n");
3087 # define YY_REDUCE_PRINT(Rule) \
3090 yy_reduce_print (yyvsp, Rule); \
3093 /* Nonzero means print parse trace. It is left uninitialized so that
3094 multiple parsers can coexist. */
3096 #else /* !YYDEBUG */
3097 # define YYDPRINTF(Args)
3098 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3099 # define YY_STACK_PRINT(Bottom, Top)
3100 # define YY_REDUCE_PRINT(Rule)
3101 #endif /* !YYDEBUG */
3104 /* YYINITDEPTH -- initial size of the parser's stacks. */
3106 # define YYINITDEPTH 200
3109 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3110 if the built-in stack extension method is used).
3112 Do not make this value too large; the results are undefined if
3113 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3114 evaluated with infinite-precision integer arithmetic. */
3117 # define YYMAXDEPTH 10000
3125 # if defined __GLIBC__ && defined _STRING_H
3126 # define yystrlen strlen
3128 /* Return the length of YYSTR. */
3129 #if (defined __STDC__ || defined __C99__FUNC__ \
3130 || defined __cplusplus || defined _MSC_VER)
3132 yystrlen (const char *yystr)
3140 for (yylen = 0; yystr[yylen]; yylen++)
3148 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3149 # define yystpcpy stpcpy
3151 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3153 #if (defined __STDC__ || defined __C99__FUNC__ \
3154 || defined __cplusplus || defined _MSC_VER)
3156 yystpcpy (char *yydest, const char *yysrc)
3159 yystpcpy (yydest, yysrc)
3165 const char *yys = yysrc;
3167 while ((*yyd++ = *yys++) != '\0')
3176 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3177 quotes and backslashes, so that it's suitable for yyerror. The
3178 heuristic is that double-quoting is unnecessary unless the string
3179 contains an apostrophe, a comma, or backslash (other than
3180 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3181 null, do not copy; instead, return the length of what the result
3184 yytnamerr (char *yyres, const char *yystr)
3189 char const *yyp = yystr;
3196 goto do_not_strip_quotes;
3200 goto do_not_strip_quotes;
3213 do_not_strip_quotes: ;
3217 return yystrlen (yystr);
3219 return yystpcpy (yyres, yystr) - yyres;
3223 /* Copy into YYRESULT an error message about the unexpected token
3224 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3225 including the terminating null byte. If YYRESULT is null, do not
3226 copy anything; just return the number of bytes that would be
3227 copied. As a special case, return 0 if an ordinary "syntax error"
3228 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3229 size calculation. */
3231 yysyntax_error (char *yyresult, int yystate, int yychar)
3233 int yyn = yypact[yystate];
3235 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3239 int yytype = YYTRANSLATE (yychar);
3240 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3241 YYSIZE_T yysize = yysize0;
3243 int yysize_overflow = 0;
3244 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3245 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3249 /* This is so xgettext sees the translatable formats that are
3250 constructed on the fly. */
3251 YY_("syntax error, unexpected %s");
3252 YY_("syntax error, unexpected %s, expecting %s");
3253 YY_("syntax error, unexpected %s, expecting %s or %s");
3254 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3255 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3259 static char const yyunexpected[] = "syntax error, unexpected %s";
3260 static char const yyexpecting[] = ", expecting %s";
3261 static char const yyor[] = " or %s";
3262 char yyformat[sizeof yyunexpected
3263 + sizeof yyexpecting - 1
3264 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3265 * (sizeof yyor - 1))];
3266 char const *yyprefix = yyexpecting;
3268 /* Start YYX at -YYN if negative to avoid negative indexes in
3270 int yyxbegin = yyn < 0 ? -yyn : 0;
3272 /* Stay within bounds of both yycheck and yytname. */
3273 int yychecklim = YYLAST - yyn + 1;
3274 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3277 yyarg[0] = yytname[yytype];
3278 yyfmt = yystpcpy (yyformat, yyunexpected);
3280 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3281 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3283 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3287 yyformat[sizeof yyunexpected - 1] = '\0';
3290 yyarg[yycount++] = yytname[yyx];
3291 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3292 yysize_overflow |= (yysize1 < yysize);
3294 yyfmt = yystpcpy (yyfmt, yyprefix);
3298 yyf = YY_(yyformat);
3299 yysize1 = yysize + yystrlen (yyf);
3300 yysize_overflow |= (yysize1 < yysize);
3303 if (yysize_overflow)
3304 return YYSIZE_MAXIMUM;
3308 /* Avoid sprintf, as that infringes on the user's name space.
3309 Don't have undefined behavior even if the translation
3310 produced a string with the wrong number of "%s"s. */
3311 char *yyp = yyresult;
3313 while ((*yyp = *yyf) != '\0')
3315 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3317 yyp += yytnamerr (yyp, yyarg[yyi++]);
3330 #endif /* YYERROR_VERBOSE */
3333 /*-----------------------------------------------.
3334 | Release the memory associated to this symbol. |
3335 `-----------------------------------------------*/
3338 #if (defined __STDC__ || defined __C99__FUNC__ \
3339 || defined __cplusplus || defined _MSC_VER)
3341 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3344 yydestruct (yymsg, yytype, yyvaluep)
3354 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3365 /* Prevent warnings from -Wmissing-prototypes. */
3367 #ifdef YYPARSE_PARAM
3368 #if defined __STDC__ || defined __cplusplus
3369 int yyparse (void *YYPARSE_PARAM);
3373 #else /* ! YYPARSE_PARAM */
3374 #if defined __STDC__ || defined __cplusplus
3379 #endif /* ! YYPARSE_PARAM */
3383 /* The look-ahead symbol. */
3386 /* The semantic value of the look-ahead symbol. */
3389 /* Number of syntax errors so far. */
3398 #ifdef YYPARSE_PARAM
3399 #if (defined __STDC__ || defined __C99__FUNC__ \
3400 || defined __cplusplus || defined _MSC_VER)
3402 yyparse (void *YYPARSE_PARAM)
3405 yyparse (YYPARSE_PARAM)
3406 void *YYPARSE_PARAM;
3408 #else /* ! YYPARSE_PARAM */
3409 #if (defined __STDC__ || defined __C99__FUNC__ \
3410 || defined __cplusplus || defined _MSC_VER)
3424 /* Number of tokens to shift before error messages enabled. */
3426 /* Look-ahead token as an internal (translated) token number. */
3429 /* Buffer for error messages, and its allocated size. */
3431 char *yymsg = yymsgbuf;
3432 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3435 /* Three stacks and their tools:
3436 `yyss': related to states,
3437 `yyvs': related to semantic values,
3438 `yyls': related to locations.
3440 Refer to the stacks thru separate pointers, to allow yyoverflow
3441 to reallocate them elsewhere. */
3443 /* The state stack. */
3444 yytype_int16 yyssa[YYINITDEPTH];
3445 yytype_int16 *yyss = yyssa;
3446 yytype_int16 *yyssp;
3448 /* The semantic value stack. */
3449 YYSTYPE yyvsa[YYINITDEPTH];
3450 YYSTYPE *yyvs = yyvsa;
3455 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3457 YYSIZE_T yystacksize = YYINITDEPTH;
3459 /* The variables used to return semantic value and location from the
3464 /* The number of symbols on the RHS of the reduced rule.
3465 Keep to zero when no symbol should be popped. */
3468 YYDPRINTF ((stderr, "Starting parse\n"));
3473 yychar = YYEMPTY; /* Cause a token to be read. */
3475 /* Initialize stack pointers.
3476 Waste one element of value and location stack
3477 so that they stay on the same level as the state stack.
3478 The wasted elements are never initialized. */
3485 /*------------------------------------------------------------.
3486 | yynewstate -- Push a new state, which is found in yystate. |
3487 `------------------------------------------------------------*/
3489 /* In all cases, when you get here, the value and location stacks
3490 have just been pushed. So pushing a state here evens the stacks. */
3496 if (yyss + yystacksize - 1 <= yyssp)
3498 /* Get the current used size of the three stacks, in elements. */
3499 YYSIZE_T yysize = yyssp - yyss + 1;
3503 /* Give user a chance to reallocate the stack. Use copies of
3504 these so that the &'s don't force the real ones into
3506 YYSTYPE *yyvs1 = yyvs;
3507 yytype_int16 *yyss1 = yyss;
3510 /* Each stack pointer address is followed by the size of the
3511 data in use in that stack, in bytes. This used to be a
3512 conditional around just the two extra args, but that might
3513 be undefined if yyoverflow is a macro. */
3514 yyoverflow (YY_("memory exhausted"),
3515 &yyss1, yysize * sizeof (*yyssp),
3516 &yyvs1, yysize * sizeof (*yyvsp),
3523 #else /* no yyoverflow */
3524 # ifndef YYSTACK_RELOCATE
3525 goto yyexhaustedlab;
3527 /* Extend the stack our own way. */
3528 if (YYMAXDEPTH <= yystacksize)
3529 goto yyexhaustedlab;
3531 if (YYMAXDEPTH < yystacksize)
3532 yystacksize = YYMAXDEPTH;
3535 yytype_int16 *yyss1 = yyss;
3536 union yyalloc *yyptr =
3537 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3539 goto yyexhaustedlab;
3540 YYSTACK_RELOCATE (yyss);
3541 YYSTACK_RELOCATE (yyvs);
3543 # undef YYSTACK_RELOCATE
3545 YYSTACK_FREE (yyss1);
3548 #endif /* no yyoverflow */
3550 yyssp = yyss + yysize - 1;
3551 yyvsp = yyvs + yysize - 1;
3554 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3555 (unsigned long int) yystacksize));
3557 if (yyss + yystacksize - 1 <= yyssp)
3561 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3570 /* Do appropriate processing given the current state. Read a
3571 look-ahead token if we need one and don't already have one. */
3573 /* First try to decide what to do without reference to look-ahead token. */
3574 yyn = yypact[yystate];
3575 if (yyn == YYPACT_NINF)
3578 /* Not known => get a look-ahead token if don't already have one. */
3580 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3581 if (yychar == YYEMPTY)
3583 YYDPRINTF ((stderr, "Reading a token: "));
3587 if (yychar <= YYEOF)
3589 yychar = yytoken = YYEOF;
3590 YYDPRINTF ((stderr, "Now at end of input.\n"));
3594 yytoken = YYTRANSLATE (yychar);
3595 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3598 /* If the proper action on seeing token YYTOKEN is to reduce or to
3599 detect an error, take that action. */
3601 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3606 if (yyn == 0 || yyn == YYTABLE_NINF)
3615 /* Count tokens shifted since error; after three, turn off error
3620 /* Shift the look-ahead token. */
3621 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3623 /* Discard the shifted token unless it is eof. */
3624 if (yychar != YYEOF)
3633 /*-----------------------------------------------------------.
3634 | yydefault -- do the default action for the current state. |
3635 `-----------------------------------------------------------*/
3637 yyn = yydefact[yystate];
3643 /*-----------------------------.
3644 | yyreduce -- Do a reduction. |
3645 `-----------------------------*/
3647 /* yyn is the number of a rule to reduce with. */
3650 /* If YYLEN is nonzero, implement the default value of the action:
3653 Otherwise, the following line sets YYVAL to garbage.
3654 This behavior is undocumented and Bison
3655 users should not rely upon it. Assigning to YYVAL
3656 unconditionally makes the parser a bit smaller, and it avoids a
3657 GCC warning that YYVAL may be used uninitialized. */
3658 yyval = yyvsp[1-yylen];
3661 YY_REDUCE_PRINT (yyn);
3665 #line 1148 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3666 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3670 #line 1148 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3671 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3675 #line 1149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3676 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3680 #line 1149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3681 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3685 #line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3686 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3690 #line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3691 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3695 #line 1151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3696 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3700 #line 1151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3701 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3705 #line 1152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3706 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3710 #line 1152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3711 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3715 #line 1156 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3716 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3720 #line 1156 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3721 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3725 #line 1157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3726 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3730 #line 1157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3731 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3735 #line 1158 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3736 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3740 #line 1158 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3741 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3745 #line 1159 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3746 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3750 #line 1159 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3751 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3755 #line 1160 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3756 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3760 #line 1160 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3761 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3765 #line 1161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3766 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3770 #line 1161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3771 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3775 #line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3776 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3780 #line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3781 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3785 #line 1163 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3786 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3790 #line 1164 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3791 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3795 #line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3796 { (yyval.StrVal) = 0; ;}
3800 #line 1175 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3801 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3805 #line 1176 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3806 { (yyval.UIntVal)=0; ;}
3810 #line 1180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3812 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3818 #line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3826 #line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3828 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3834 #line 1198 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3842 #line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3844 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3850 #line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3851 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3855 #line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3856 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3860 #line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3861 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3865 #line 1212 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3866 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3870 #line 1213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3871 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3875 #line 1214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3876 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
3880 #line 1218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3881 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3885 #line 1219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3886 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3890 #line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3891 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3895 #line 1224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3896 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3900 #line 1225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3901 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3905 #line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3906 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3910 #line 1227 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3911 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3915 #line 1231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3916 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3920 #line 1232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3921 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3925 #line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3926 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3930 #line 1237 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3931 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3935 #line 1238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3936 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3940 #line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3941 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3945 #line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3946 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3950 #line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3951 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3955 #line 1245 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3956 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3960 #line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3961 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3965 #line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3966 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3970 #line 1250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3971 { (yyval.UIntVal) = CallingConv::C; ;}
3975 #line 1251 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3976 { (yyval.UIntVal) = CallingConv::C; ;}
3980 #line 1252 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3981 { (yyval.UIntVal) = CallingConv::Fast; ;}
3985 #line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3986 { (yyval.UIntVal) = CallingConv::Cold; ;}
3990 #line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3991 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3995 #line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3996 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
4000 #line 1256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4001 { (yyval.UIntVal) = CallingConv::X86_SSECall; ;}
4005 #line 1257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4007 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
4008 GEN_ERROR("Calling conv too large");
4009 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4015 #line 1264 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4016 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4020 #line 1265 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4021 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4025 #line 1266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4026 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4030 #line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4031 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4035 #line 1268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4036 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
4040 #line 1269 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4041 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
4045 #line 1270 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4046 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
4050 #line 1271 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4051 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
4055 #line 1272 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4056 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
4060 #line 1273 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4061 { (yyval.ParamAttrs) =
4062 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4066 #line 1277 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4067 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4071 #line 1278 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4073 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4078 #line 1283 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4079 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4083 #line 1284 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4084 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4088 #line 1285 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4089 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4093 #line 1286 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4094 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4098 #line 1287 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4099 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
4103 #line 1288 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4104 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
4108 #line 1291 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4109 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4113 #line 1292 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4115 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4120 #line 1297 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4121 { (yyval.FunctionNotes) = (yyvsp[(1) - (1)].FunctionNotes); ;}
4125 #line 1298 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4127 FunctionNotes tmp = (yyvsp[(1) - (3)].FunctionNotes) | (yyvsp[(3) - (3)].FunctionNotes);
4128 if ((yyvsp[(3) - (3)].FunctionNotes) == FN_NOTE_NoInline && ((yyvsp[(1) - (3)].FunctionNotes) & FN_NOTE_AlwaysInline))
4129 GEN_ERROR("Function Notes may include only one inline notes!")
4130 if ((yyvsp[(3) - (3)].FunctionNotes) == FN_NOTE_AlwaysInline && ((yyvsp[(1) - (3)].FunctionNotes) & FN_NOTE_NoInline))
4131 GEN_ERROR("Function Notes may include only one inline notes!")
4132 (yyval.FunctionNotes) = tmp;
4138 #line 1309 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4139 { (yyval.FunctionNotes) = FN_NOTE_NoInline; ;}
4143 #line 1310 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4144 { (yyval.FunctionNotes) = FN_NOTE_AlwaysInline; ;}
4148 #line 1311 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4149 { (yyval.FunctionNotes) = FN_NOTE_OptimizeForSize; ;}
4153 #line 1314 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4154 { (yyval.FunctionNotes) = FN_NOTE_None; ;}
4158 #line 1315 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4160 (yyval.FunctionNotes) = (yyvsp[(3) - (4)].FunctionNotes);
4165 #line 1320 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4166 { (yyval.StrVal) = 0; ;}
4170 #line 1321 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4172 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4177 #line 1328 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4178 { (yyval.UIntVal) = 0; ;}
4182 #line 1329 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4184 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4185 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4186 GEN_ERROR("Alignment must be a power of two");
4192 #line 1335 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4193 { (yyval.UIntVal) = 0; ;}
4197 #line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4199 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4200 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4201 GEN_ERROR("Alignment must be a power of two");
4207 #line 1345 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4209 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4210 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
4211 GEN_ERROR("Invalid character in section name");
4212 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4218 #line 1353 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4219 { (yyval.StrVal) = 0; ;}
4223 #line 1354 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4224 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4228 #line 1359 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4233 #line 1360 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4238 #line 1361 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4240 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4241 delete (yyvsp[(1) - (1)].StrVal);
4247 #line 1366 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4249 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4250 GEN_ERROR("Alignment must be a power of two");
4251 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4257 #line 1382 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4259 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4265 #line 1386 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4267 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4273 #line 1390 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4275 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4276 GEN_ERROR("Cannot form a pointer to a basic block");
4277 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4278 delete (yyvsp[(1) - (3)].TypeVal);
4284 #line 1397 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4285 { // Named types are also simple types...
4286 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4288 (yyval.TypeVal) = new PATypeHolder(tmp);
4293 #line 1402 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4294 { // Type UpReference
4295 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4296 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4297 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4298 (yyval.TypeVal) = new PATypeHolder(OT);
4299 UR_OUT("New Upreference!\n");
4305 #line 1410 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4307 // Allow but ignore attributes on function types; this permits auto-upgrade.
4308 // FIXME: remove in LLVM 3.0.
4309 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4310 if (!FunctionType::isValidReturnType(RetTy))
4311 GEN_ERROR("Invalid result type for LLVM function");
4313 std::vector<const Type*> Params;
4314 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4315 for (; I != E; ++I ) {
4316 const Type *Ty = I->Ty->get();
4317 Params.push_back(Ty);
4320 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4321 if (isVarArg) Params.pop_back();
4323 for (unsigned i = 0; i != Params.size(); ++i)
4324 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4325 GEN_ERROR("Function arguments must be value types!");
4329 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4330 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4331 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4332 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4338 #line 1439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4340 // Allow but ignore attributes on function types; this permits auto-upgrade.
4341 // FIXME: remove in LLVM 3.0.
4342 std::vector<const Type*> Params;
4343 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4344 for ( ; I != E; ++I ) {
4345 const Type* Ty = I->Ty->get();
4346 Params.push_back(Ty);
4349 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4350 if (isVarArg) Params.pop_back();
4352 for (unsigned i = 0; i != Params.size(); ++i)
4353 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4354 GEN_ERROR("Function arguments must be value types!");
4358 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4359 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4360 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4366 #line 1464 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4367 { // Sized array type?
4368 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
4369 delete (yyvsp[(4) - (5)].TypeVal);
4375 #line 1469 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4377 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4378 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4379 GEN_ERROR("Unsigned result not equal to signed result");
4380 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4381 GEN_ERROR("Element type of a VectorType must be primitive");
4382 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4383 delete (yyvsp[(4) - (5)].TypeVal);
4389 #line 1479 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4390 { // Structure type?
4391 std::vector<const Type*> Elements;
4392 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4393 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4394 Elements.push_back(*I);
4396 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4397 delete (yyvsp[(2) - (3)].TypeList);
4403 #line 1489 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4404 { // Empty structure type?
4405 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4411 #line 1493 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4413 std::vector<const Type*> Elements;
4414 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4415 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4416 Elements.push_back(*I);
4418 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4419 delete (yyvsp[(3) - (5)].TypeList);
4425 #line 1503 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4426 { // Empty structure type?
4427 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4433 #line 1510 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4435 // Allow but ignore attributes on function types; this permits auto-upgrade.
4436 // FIXME: remove in LLVM 3.0.
4437 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4438 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4443 #line 1519 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4445 if (!UpRefs.empty())
4446 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4447 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4448 GEN_ERROR("LLVM functions cannot return aggregate types");
4449 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4454 #line 1526 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4456 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4461 #line 1531 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4463 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4464 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4470 #line 1536 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4472 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4478 #line 1544 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4480 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4481 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4482 TWA.Ty = new PATypeHolder(Type::VoidTy);
4483 (yyval.TypeWithAttrsList)->push_back(TWA);
4489 #line 1551 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4491 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4492 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4493 TWA.Ty = new PATypeHolder(Type::VoidTy);
4494 (yyval.TypeWithAttrsList)->push_back(TWA);
4500 #line 1558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4502 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4508 #line 1566 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4510 (yyval.TypeList) = new std::list<PATypeHolder>();
4511 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4512 delete (yyvsp[(1) - (1)].TypeVal);
4518 #line 1572 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4520 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4521 delete (yyvsp[(3) - (3)].TypeVal);
4527 #line 1584 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4528 { // Nonempty unsized arr
4529 if (!UpRefs.empty())
4530 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4531 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4533 GEN_ERROR("Cannot make array constant with type: '" +
4534 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4535 const Type *ETy = ATy->getElementType();
4536 uint64_t NumElements = ATy->getNumElements();
4538 // Verify that we have the correct size...
4539 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
4540 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4541 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4542 utostr(NumElements) + "");
4544 // Verify all elements are correct type!
4545 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4546 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4547 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4548 ETy->getDescription() +"' as required!\nIt is of type '"+
4549 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4552 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4553 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4559 #line 1612 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4561 if (!UpRefs.empty())
4562 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4563 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4565 GEN_ERROR("Cannot make array constant with type: '" +
4566 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4568 uint64_t NumElements = ATy->getNumElements();
4569 if (NumElements != uint64_t(-1) && NumElements != 0)
4570 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4571 " arguments, but has size of " + utostr(NumElements) +"");
4572 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4573 delete (yyvsp[(1) - (3)].TypeVal);
4579 #line 1628 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4581 if (!UpRefs.empty())
4582 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4583 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4585 GEN_ERROR("Cannot make array constant with type: '" +
4586 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4588 uint64_t NumElements = ATy->getNumElements();
4589 const Type *ETy = ATy->getElementType();
4590 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
4591 GEN_ERROR("Can't build string constant of size " +
4592 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4593 " when array has size " + utostr(NumElements) + "");
4594 std::vector<Constant*> Vals;
4595 if (ETy == Type::Int8Ty) {
4596 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4597 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4599 delete (yyvsp[(3) - (3)].StrVal);
4600 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4602 delete (yyvsp[(3) - (3)].StrVal);
4603 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4604 delete (yyvsp[(1) - (3)].TypeVal);
4610 #line 1655 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4611 { // Nonempty unsized arr
4612 if (!UpRefs.empty())
4613 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4614 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4616 GEN_ERROR("Cannot make packed constant with type: '" +
4617 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4618 const Type *ETy = PTy->getElementType();
4619 unsigned NumElements = PTy->getNumElements();
4621 // Verify that we have the correct size...
4622 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
4623 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4624 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4625 utostr(NumElements) + "");
4627 // Verify all elements are correct type!
4628 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4629 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4630 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4631 ETy->getDescription() +"' as required!\nIt is of type '"+
4632 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4635 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4636 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4642 #line 1683 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4644 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4646 GEN_ERROR("Cannot make struct constant with type: '" +
4647 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4649 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4650 GEN_ERROR("Illegal number of initializers for structure type");
4652 // Check to ensure that constants are compatible with the type initializer!
4653 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4654 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4655 GEN_ERROR("Expected type '" +
4656 STy->getElementType(i)->getDescription() +
4657 "' for element #" + utostr(i) +
4658 " of structure initializer");
4660 // Check to ensure that Type is not packed
4661 if (STy->isPacked())
4662 GEN_ERROR("Unpacked Initializer to vector type '" +
4663 STy->getDescription() + "'");
4665 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4666 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4672 #line 1709 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4674 if (!UpRefs.empty())
4675 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4676 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4678 GEN_ERROR("Cannot make struct constant with type: '" +
4679 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4681 if (STy->getNumContainedTypes() != 0)
4682 GEN_ERROR("Illegal number of initializers for structure type");
4684 // Check to ensure that Type is not packed
4685 if (STy->isPacked())
4686 GEN_ERROR("Unpacked Initializer to vector type '" +
4687 STy->getDescription() + "'");
4689 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4690 delete (yyvsp[(1) - (3)].TypeVal);
4696 #line 1729 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4698 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4700 GEN_ERROR("Cannot make struct constant with type: '" +
4701 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4703 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4704 GEN_ERROR("Illegal number of initializers for structure type");
4706 // Check to ensure that constants are compatible with the type initializer!
4707 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4708 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4709 GEN_ERROR("Expected type '" +
4710 STy->getElementType(i)->getDescription() +
4711 "' for element #" + utostr(i) +
4712 " of structure initializer");
4714 // Check to ensure that Type is packed
4715 if (!STy->isPacked())
4716 GEN_ERROR("Vector initializer to non-vector type '" +
4717 STy->getDescription() + "'");
4719 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4720 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4726 #line 1755 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4728 if (!UpRefs.empty())
4729 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4730 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4732 GEN_ERROR("Cannot make struct constant with type: '" +
4733 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4735 if (STy->getNumContainedTypes() != 0)
4736 GEN_ERROR("Illegal number of initializers for structure type");
4738 // Check to ensure that Type is packed
4739 if (!STy->isPacked())
4740 GEN_ERROR("Vector initializer to non-vector type '" +
4741 STy->getDescription() + "'");
4743 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4744 delete (yyvsp[(1) - (5)].TypeVal);
4750 #line 1775 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4752 if (!UpRefs.empty())
4753 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4754 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4756 GEN_ERROR("Cannot make null pointer constant with type: '" +
4757 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4759 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4760 delete (yyvsp[(1) - (2)].TypeVal);
4766 #line 1787 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4768 if (!UpRefs.empty())
4769 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4770 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4771 delete (yyvsp[(1) - (2)].TypeVal);
4777 #line 1794 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4779 if (!UpRefs.empty())
4780 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4781 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4783 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4785 // ConstExprs can exist in the body of a function, thus creating
4786 // GlobalValues whenever they refer to a variable. Because we are in
4787 // the context of a function, getExistingVal will search the functions
4788 // symbol table instead of the module symbol table for the global symbol,
4789 // which throws things all off. To get around this, we just tell
4790 // getExistingVal that we are at global scope here.
4792 Function *SavedCurFn = CurFun.CurrentFunction;
4793 CurFun.CurrentFunction = 0;
4795 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4798 CurFun.CurrentFunction = SavedCurFn;
4800 // If this is an initializer for a constant pointer, which is referencing a
4801 // (currently) undefined variable, create a stub now that shall be replaced
4802 // in the future with the right type of variable.
4805 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4806 const PointerType *PT = cast<PointerType>(Ty);
4808 // First check to see if the forward references value is already created!
4809 PerModuleInfo::GlobalRefsType::iterator I =
4810 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4812 if (I != CurModule.GlobalRefs.end()) {
4813 V = I->second; // Placeholder already exists, use it...
4814 (yyvsp[(2) - (2)].ValIDVal).destroy();
4817 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4818 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4819 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4820 GEN_ERROR("Invalid reference to global");
4822 // Create the forward referenced global.
4824 if (const FunctionType *FTy =
4825 dyn_cast<FunctionType>(PT->getElementType())) {
4826 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4827 CurModule.CurrentModule);
4829 GV = new GlobalVariable(PT->getElementType(), false,
4830 GlobalValue::ExternalWeakLinkage, 0,
4831 Name, CurModule.CurrentModule);
4834 // Keep track of the fact that we have a forward ref to recycle it
4835 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4840 (yyval.ConstVal) = cast<GlobalValue>(V);
4841 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4847 #line 1860 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4849 if (!UpRefs.empty())
4850 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4851 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4852 GEN_ERROR("Mismatched types for constant expression: " +
4853 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4854 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4855 delete (yyvsp[(1) - (2)].TypeVal);
4861 #line 1870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4863 if (!UpRefs.empty())
4864 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4865 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4866 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4867 GEN_ERROR("Cannot create a null initialized value of this type");
4868 (yyval.ConstVal) = Constant::getNullValue(Ty);
4869 delete (yyvsp[(1) - (2)].TypeVal);
4875 #line 1880 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4876 { // integral constants
4877 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4878 GEN_ERROR("Constant value doesn't fit in type");
4879 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4885 #line 1886 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4886 { // arbitrary precision integer constants
4887 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4888 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4889 GEN_ERROR("Constant value does not fit in type");
4891 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4892 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4893 delete (yyvsp[(2) - (2)].APIntVal);
4899 #line 1896 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4900 { // integral constants
4901 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4902 GEN_ERROR("Constant value doesn't fit in type");
4903 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4909 #line 1902 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4910 { // arbitrary precision integer constants
4911 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4912 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4913 GEN_ERROR("Constant value does not fit in type");
4915 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4916 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4917 delete (yyvsp[(2) - (2)].APIntVal);
4923 #line 1912 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4924 { // Boolean constants
4925 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4926 GEN_ERROR("Constant true must have type i1");
4927 (yyval.ConstVal) = ConstantInt::getTrue();
4933 #line 1918 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4934 { // Boolean constants
4935 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4936 GEN_ERROR("Constant false must have type i1");
4937 (yyval.ConstVal) = ConstantInt::getFalse();
4943 #line 1924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4944 { // Floating point constants
4945 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4946 GEN_ERROR("Floating point constant invalid for type");
4947 // Lexer has no type info, so builds all float and double FP constants
4948 // as double. Fix this here. Long double is done right.
4949 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4950 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4951 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4952 delete (yyvsp[(2) - (2)].FPVal);
4958 #line 1937 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4960 if (!UpRefs.empty())
4961 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4962 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4963 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4964 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4965 GEN_ERROR("invalid cast opcode for cast from '" +
4966 Val->getType()->getDescription() + "' to '" +
4967 DestTy->getDescription() + "'");
4968 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4969 delete (yyvsp[(5) - (6)].TypeVal);
4974 #line 1949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4976 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4977 GEN_ERROR("GetElementPtr requires a pointer operand");
4980 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4982 GEN_ERROR("Index list invalid for constant getelementptr");
4984 SmallVector<Constant*, 8> IdxVec;
4985 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4986 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4987 IdxVec.push_back(C);
4989 GEN_ERROR("Indices to constant getelementptr must be constants");
4991 delete (yyvsp[(4) - (5)].ValueList);
4993 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4999 #line 1970 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5001 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
5002 GEN_ERROR("Select condition must be of boolean type");
5003 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
5004 GEN_ERROR("Select operand types must match");
5005 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5011 #line 1978 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5013 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
5014 GEN_ERROR("Binary operator types must match");
5016 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5021 #line 1984 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5023 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
5024 GEN_ERROR("Logical operator types must match");
5025 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
5026 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
5027 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
5028 GEN_ERROR("Logical operator requires integral operands");
5030 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5036 #line 1995 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5038 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5039 GEN_ERROR("icmp operand types must match");
5040 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5045 #line 2000 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5047 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5048 GEN_ERROR("fcmp operand types must match");
5049 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5054 #line 2005 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5056 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5057 GEN_ERROR("vicmp operand types must match");
5058 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5063 #line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5065 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5066 GEN_ERROR("vfcmp operand types must match");
5067 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5072 #line 2015 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5074 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
5075 GEN_ERROR("Invalid extractelement operands");
5076 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5082 #line 2021 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5084 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
5085 GEN_ERROR("Invalid insertelement operands");
5086 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5092 #line 2027 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5094 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
5095 GEN_ERROR("Invalid shufflevector operands");
5096 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5102 #line 2033 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5104 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5105 GEN_ERROR("ExtractValue requires an aggregate operand");
5107 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5108 delete (yyvsp[(4) - (5)].ConstantList);
5114 #line 2041 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5116 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5117 GEN_ERROR("InsertValue requires an aggregate operand");
5119 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5120 delete (yyvsp[(6) - (7)].ConstantList);
5126 #line 2052 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5128 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
5134 #line 2056 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5136 (yyval.ConstVector) = new std::vector<Constant*>();
5137 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
5143 #line 2064 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5144 { (yyval.BoolVal) = false; ;}
5148 #line 2064 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5149 { (yyval.BoolVal) = true; ;}
5153 #line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5154 { (yyval.BoolVal) = true; ;}
5158 #line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5159 { (yyval.BoolVal) = false; ;}
5163 #line 2070 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5165 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5166 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
5168 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5170 GEN_ERROR("Aliases can be created only to global values");
5172 (yyval.ConstVal) = Aliasee;
5174 delete (yyvsp[(1) - (2)].TypeVal);
5179 #line 2082 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5181 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5182 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5183 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
5184 GEN_ERROR("invalid cast opcode for cast from '" +
5185 Val->getType()->getDescription() + "' to '" +
5186 DestTy->getDescription() + "'");
5188 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5190 delete (yyvsp[(5) - (6)].TypeVal);
5195 #line 2103 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5197 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5198 CurModule.ModuleDone();
5204 #line 2108 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5206 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5207 CurModule.ModuleDone();
5213 #line 2121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5214 { CurFun.isDeclare = false; ;}
5218 #line 2121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5220 CurFun.FunctionDone();
5226 #line 2125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5227 { CurFun.isDeclare = true; ;}
5231 #line 2125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5238 #line 2128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5245 #line 2131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5247 if (!UpRefs.empty())
5248 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
5249 // Eagerly resolve types. This is not an optimization, this is a
5250 // requirement that is due to the fact that we could have this:
5252 // %list = type { %list * }
5253 // %list = type { %list * } ; repeated type decl
5255 // If types are not resolved eagerly, then the two types will not be
5256 // determined to be the same type!
5258 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
5260 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5262 // If this is a named type that is not a redefinition, add it to the slot
5264 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
5267 delete (yyvsp[(3) - (3)].TypeVal);
5273 #line 2155 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5275 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5277 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5279 // If this is a named type that is not a redefinition, add it to the slot
5281 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5288 #line 2167 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5290 /* "Externally Visible" Linkage */
5291 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5292 GEN_ERROR("Global value initializer is not a constant");
5293 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5294 (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal));
5300 #line 2174 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5307 #line 2178 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5309 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5310 GEN_ERROR("Global value initializer is not a constant");
5311 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5317 #line 2183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5324 #line 2187 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5326 if (!UpRefs.empty())
5327 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5328 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5330 delete (yyvsp[(6) - (7)].TypeVal);
5335 #line 2193 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5343 #line 2197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5346 if ((yyvsp[(1) - (5)].StrVal)) {
5347 Name = *(yyvsp[(1) - (5)].StrVal);
5348 delete (yyvsp[(1) - (5)].StrVal);
5351 GEN_ERROR("Alias name cannot be empty");
5353 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5355 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5357 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5358 CurModule.CurrentModule);
5359 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5360 InsertValue(GA, CurModule.Values);
5363 // If there was a forward reference of this alias, resolve it now.
5367 ID = ValID::createGlobalName(Name);
5369 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5371 if (GlobalValue *FWGV =
5372 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5373 // Replace uses of the fwdref with the actual alias.
5374 FWGV->replaceAllUsesWith(GA);
5375 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5376 GV->eraseFromParent();
5378 cast<Function>(FWGV)->eraseFromParent();
5387 #line 2237 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5394 #line 2240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5401 #line 2246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5403 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5404 if (AsmSoFar.empty())
5405 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5407 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5408 delete (yyvsp[(1) - (1)].StrVal);
5414 #line 2256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5416 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5417 delete (yyvsp[(3) - (3)].StrVal);
5422 #line 2260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5424 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5425 delete (yyvsp[(3) - (3)].StrVal);
5430 #line 2267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5432 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5433 delete (yyvsp[(3) - (3)].StrVal);
5439 #line 2272 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5441 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5442 delete (yyvsp[(1) - (1)].StrVal);
5448 #line 2277 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5455 #line 2286 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5457 if (!UpRefs.empty())
5458 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5459 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5460 GEN_ERROR("Argument types must be first-class");
5461 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5462 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5463 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5469 #line 2296 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5471 if (!UpRefs.empty())
5472 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5473 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5474 GEN_ERROR("Argument types must be first-class");
5475 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5476 (yyval.ArgList) = new ArgListType;
5477 (yyval.ArgList)->push_back(E);
5483 #line 2307 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5485 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5491 #line 2311 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5493 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5494 struct ArgListEntry E;
5495 E.Ty = new PATypeHolder(Type::VoidTy);
5497 E.Attrs = ParamAttr::None;
5498 (yyval.ArgList)->push_back(E);
5504 #line 2320 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5506 (yyval.ArgList) = new ArgListType;
5507 struct ArgListEntry E;
5508 E.Ty = new PATypeHolder(Type::VoidTy);
5510 E.Attrs = ParamAttr::None;
5511 (yyval.ArgList)->push_back(E);
5517 #line 2329 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5519 (yyval.ArgList) = 0;
5525 #line 2335 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5527 std::string FunctionName(*(yyvsp[(3) - (11)].StrVal));
5528 delete (yyvsp[(3) - (11)].StrVal); // Free strdup'd memory!
5530 // Check the function result for abstractness if this is a define. We should
5531 // have no abstract types at this point
5532 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (11)].TypeVal)))
5533 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (11)].TypeVal)->get()->getDescription());
5535 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (11)].TypeVal)))
5536 GEN_ERROR("Invalid result type for LLVM function");
5538 std::vector<const Type*> ParamTypeList;
5539 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5540 if ((yyvsp[(7) - (11)].ParamAttrs) != ParamAttr::None)
5541 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (11)].ParamAttrs)));
5542 if ((yyvsp[(5) - (11)].ArgList)) { // If there are arguments...
5544 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin(); I != (yyvsp[(5) - (11)].ArgList)->end(); ++I, ++index) {
5545 const Type* Ty = I->Ty->get();
5546 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5547 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5548 ParamTypeList.push_back(Ty);
5549 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5550 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
5554 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5555 if (isVarArg) ParamTypeList.pop_back();
5559 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5561 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (11)].TypeVal), ParamTypeList, isVarArg);
5562 const PointerType *PFT = PointerType::getUnqual(FT);
5563 delete (yyvsp[(2) - (11)].TypeVal);
5566 if (!FunctionName.empty()) {
5567 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5569 ID = ValID::createGlobalID(CurModule.Values.size());
5573 // See if this function was forward referenced. If so, recycle the object.
5574 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5575 // Move the function to the end of the list, from whereever it was
5576 // previously inserted.
5577 Fn = cast<Function>(FWRef);
5578 assert(Fn->getParamAttrs().isEmpty() &&
5579 "Forward reference has parameter attributes!");
5580 CurModule.CurrentModule->getFunctionList().remove(Fn);
5581 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5582 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5583 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5584 if (Fn->getFunctionType() != FT ) {
5585 // The existing function doesn't have the same type. This is an overload
5587 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5588 } else if (Fn->getParamAttrs() != PAL) {
5589 // The existing function doesn't have the same parameter attributes.
5590 // This is an overload error.
5591 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5592 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5593 // Neither the existing or the current function is a declaration and they
5594 // have the same name and same type. Clearly this is a redefinition.
5595 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5596 } else if (Fn->isDeclaration()) {
5597 // Make sure to strip off any argument names so we can't get conflicts.
5598 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5602 } else { // Not already defined?
5603 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5604 CurModule.CurrentModule);
5605 InsertValue(Fn, CurModule.Values);
5608 CurFun.FunctionStart(Fn);
5610 if (CurFun.isDeclare) {
5611 // If we have declaration, always overwrite linkage. This will allow us to
5612 // correctly handle cases, when pointer to function is passed as argument to
5613 // another function.
5614 Fn->setLinkage(CurFun.Linkage);
5615 Fn->setVisibility(CurFun.Visibility);
5617 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
5618 Fn->setParamAttrs(PAL);
5619 Fn->setAlignment((yyvsp[(9) - (11)].UIntVal));
5620 if ((yyvsp[(8) - (11)].StrVal)) {
5621 Fn->setSection(*(yyvsp[(8) - (11)].StrVal));
5622 delete (yyvsp[(8) - (11)].StrVal);
5624 if ((yyvsp[(10) - (11)].StrVal)) {
5625 Fn->setGC((yyvsp[(10) - (11)].StrVal)->c_str());
5626 delete (yyvsp[(10) - (11)].StrVal);
5628 if ((yyvsp[(11) - (11)].FunctionNotes)) {
5629 Fn->setNotes((yyvsp[(11) - (11)].FunctionNotes));
5632 // Add all of the arguments we parsed to the function...
5633 if ((yyvsp[(5) - (11)].ArgList)) { // Is null if empty...
5634 if (isVarArg) { // Nuke the last entry
5635 assert((yyvsp[(5) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (11)].ArgList)->back().Name == 0 &&
5636 "Not a varargs marker!");
5637 delete (yyvsp[(5) - (11)].ArgList)->back().Ty;
5638 (yyvsp[(5) - (11)].ArgList)->pop_back(); // Delete the last entry
5640 Function::arg_iterator ArgIt = Fn->arg_begin();
5641 Function::arg_iterator ArgEnd = Fn->arg_end();
5643 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin();
5644 I != (yyvsp[(5) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5645 delete I->Ty; // Delete the typeholder...
5646 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5652 delete (yyvsp[(5) - (11)].ArgList); // We're now done with the argument list
5659 #line 2468 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5661 (yyval.FunctionVal) = CurFun.CurrentFunction;
5663 // Make sure that we keep track of the linkage type even if there was a
5664 // previous "declare".
5665 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5666 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5671 #line 2479 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5673 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5679 #line 2484 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5681 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5682 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5683 (yyval.FunctionVal) = CurFun.CurrentFunction;
5684 CurFun.FunctionDone();
5690 #line 2496 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5692 (yyval.BoolVal) = false;
5698 #line 2500 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5700 (yyval.BoolVal) = true;
5706 #line 2505 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5707 { // A reference to a direct constant
5708 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5714 #line 2509 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5716 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5722 #line 2513 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5723 { // arbitrary precision integer constants
5724 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5725 delete (yyvsp[(1) - (1)].APIntVal);
5731 #line 2518 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5732 { // arbitrary precision integer constants
5733 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5734 delete (yyvsp[(1) - (1)].APIntVal);
5740 #line 2523 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5741 { // Perhaps it's an FP constant?
5742 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5748 #line 2527 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5750 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5756 #line 2531 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5758 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5764 #line 2535 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5766 (yyval.ValIDVal) = ValID::createNull();
5772 #line 2539 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5774 (yyval.ValIDVal) = ValID::createUndef();
5780 #line 2543 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5781 { // A vector zero constant.
5782 (yyval.ValIDVal) = ValID::createZeroInit();
5788 #line 2547 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5789 { // Nonempty unsized packed vector
5790 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5791 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5793 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5794 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
5796 VectorType* pt = VectorType::get(ETy, NumElements);
5797 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
5799 // Verify all elements are correct type!
5800 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5801 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5802 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5803 ETy->getDescription() +"' as required!\nIt is of type '" +
5804 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5807 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5808 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5814 #line 2569 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5815 { // Nonempty unsized arr
5816 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5817 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5819 if (!ETy->isFirstClassType())
5820 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5822 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5823 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5825 // Verify all elements are correct type!
5826 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5827 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5828 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5829 ETy->getDescription() +"' as required!\nIt is of type '"+
5830 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5833 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5834 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5840 #line 2591 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5842 // Use undef instead of an array because it's inconvenient to determine
5843 // the element type at this point, there being no elements to examine.
5844 (yyval.ValIDVal) = ValID::createUndef();
5850 #line 2597 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5852 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
5853 const Type *ETy = Type::Int8Ty;
5855 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5857 std::vector<Constant*> Vals;
5858 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5859 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5860 delete (yyvsp[(2) - (2)].StrVal);
5861 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5867 #line 2610 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5869 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5870 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5871 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5873 const StructType *STy = StructType::get(Elements);
5874 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5876 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5877 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5883 #line 2622 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5885 const StructType *STy = StructType::get(std::vector<const Type*>());
5886 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5892 #line 2627 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5894 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5895 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5896 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5898 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5899 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5901 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5902 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5908 #line 2639 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5910 const StructType *STy = StructType::get(std::vector<const Type*>(),
5912 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5918 #line 2645 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5920 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5926 #line 2649 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5928 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5929 delete (yyvsp[(3) - (5)].StrVal);
5930 delete (yyvsp[(5) - (5)].StrVal);
5936 #line 2659 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5937 { // Is it an integer reference...?
5938 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5944 #line 2663 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5946 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5952 #line 2667 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5953 { // Is it a named reference...?
5954 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5955 delete (yyvsp[(1) - (1)].StrVal);
5961 #line 2672 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5962 { // Is it a named reference...?
5963 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5964 delete (yyvsp[(1) - (1)].StrVal);
5970 #line 2685 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5972 if (!UpRefs.empty())
5973 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5974 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5975 delete (yyvsp[(1) - (2)].TypeVal);
5981 #line 2694 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5983 (yyval.ValueList) = new std::vector<Value *>();
5984 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5990 #line 2699 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5992 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
5998 #line 2704 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6000 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
6006 #line 2708 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6007 { // Do not allow functions with 0 basic blocks
6008 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
6014 #line 2717 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6016 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
6018 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6019 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6020 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6026 #line 2726 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6029 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6030 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6031 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6032 " is incorrect, expected %" + utostr((unsigned)ValNum));
6034 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6035 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6041 #line 2739 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6043 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
6044 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6045 if (CI2->getParent() == 0)
6046 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6047 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6048 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
6054 #line 2748 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6055 { // Empty space between instruction lists
6056 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
6062 #line 2752 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6063 { // Labelled (named) basic block
6064 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6065 delete (yyvsp[(1) - (1)].StrVal);
6072 #line 2760 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6073 { // Return with a result...
6074 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6075 assert(!VL.empty() && "Invalid ret operands!");
6076 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6077 if (VL.size() > 1 ||
6078 (isa<StructType>(ReturnType) &&
6079 (VL.empty() || VL[0]->getType() != ReturnType))) {
6080 Value *RV = UndefValue::get(ReturnType);
6081 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6082 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6083 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6086 (yyval.TermInstVal) = ReturnInst::Create(RV);
6088 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6090 delete (yyvsp[(2) - (2)].ValueList);
6096 #line 2780 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6097 { // Return with no result...
6098 (yyval.TermInstVal) = ReturnInst::Create();
6104 #line 2784 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6105 { // Unconditional Branch...
6106 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6108 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6113 #line 2789 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6115 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6116 GEN_ERROR("Branch condition must have type i1");
6117 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6119 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6121 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6123 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6128 #line 2800 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6130 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6132 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6134 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6135 (yyval.TermInstVal) = S;
6137 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6138 E = (yyvsp[(8) - (9)].JumpTable)->end();
6139 for (; I != E; ++I) {
6140 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6141 S->addCase(CI, I->second);
6143 GEN_ERROR("Switch case is constant, but not a simple integer");
6145 delete (yyvsp[(8) - (9)].JumpTable);
6151 #line 2819 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6153 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
6155 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
6157 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
6158 (yyval.TermInstVal) = S;
6164 #line 2829 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6167 // Handle the short syntax
6168 const PointerType *PFTy = 0;
6169 const FunctionType *Ty = 0;
6170 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
6171 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6172 // Pull out the types of all of the arguments...
6173 std::vector<const Type*> ParamTypes;
6174 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
6175 for (; I != E; ++I) {
6176 const Type *Ty = I->Val->getType();
6177 if (Ty == Type::VoidTy)
6178 GEN_ERROR("Short call syntax cannot be used with varargs");
6179 ParamTypes.push_back(Ty);
6182 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6183 GEN_ERROR("Invalid result type for LLVM function");
6185 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
6186 PFTy = PointerType::getUnqual(Ty);
6189 delete (yyvsp[(3) - (14)].TypeVal);
6191 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
6193 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
6195 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
6198 SmallVector<ParamAttrsWithIndex, 8> Attrs;
6199 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6200 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
6202 // Check the arguments
6204 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
6205 // Make sure no arguments is a good thing!
6206 if (Ty->getNumParams() != 0)
6207 GEN_ERROR("No arguments passed to a function that "
6208 "expects arguments");
6209 } else { // Has arguments?
6210 // Loop through FunctionType's arguments and ensure they are specified
6212 FunctionType::param_iterator I = Ty->param_begin();
6213 FunctionType::param_iterator E = Ty->param_end();
6214 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
6217 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6218 if (ArgI->Val->getType() != *I)
6219 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6220 (*I)->getDescription() + "'");
6221 Args.push_back(ArgI->Val);
6222 if (ArgI->Attrs != ParamAttr::None)
6223 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6226 if (Ty->isVarArg()) {
6228 for (; ArgI != ArgE; ++ArgI, ++index) {
6229 Args.push_back(ArgI->Val); // push the remaining varargs
6230 if (ArgI->Attrs != ParamAttr::None)
6231 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6233 } else if (I != E || ArgI != ArgE)
6234 GEN_ERROR("Invalid number of parameters detected");
6239 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6241 // Create the InvokeInst
6242 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6243 Args.begin(), Args.end());
6244 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
6245 II->setParamAttrs(PAL);
6246 (yyval.TermInstVal) = II;
6247 delete (yyvsp[(6) - (14)].ParamList);
6253 #line 2914 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6255 (yyval.TermInstVal) = new UnwindInst();
6261 #line 2918 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6263 (yyval.TermInstVal) = new UnreachableInst();
6269 #line 2925 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6271 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6272 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
6275 GEN_ERROR("May only switch on a constant pool value");
6277 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
6279 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6284 #line 2936 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6286 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6287 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
6291 GEN_ERROR("May only switch on a constant pool value");
6293 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
6295 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6300 #line 2949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6302 // Is this definition named?? if so, assign the name...
6303 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
6305 InsertValue((yyvsp[(2) - (2)].InstVal));
6306 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6312 #line 2958 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6315 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
6317 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6318 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6319 " is incorrect, expected %" + utostr((unsigned)ValNum));
6321 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6327 #line 2971 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6328 { // Used for PHI nodes
6329 if (!UpRefs.empty())
6330 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6331 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6332 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
6334 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6336 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6337 delete (yyvsp[(1) - (6)].TypeVal);
6342 #line 2982 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6344 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6345 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
6347 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
6349 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6354 #line 2992 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6356 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6357 if (!UpRefs.empty())
6358 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
6359 // Used for call and invoke instructions
6360 (yyval.ParamList) = new ParamList();
6361 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6362 (yyval.ParamList)->push_back(E);
6363 delete (yyvsp[(1) - (4)].TypeVal);
6369 #line 3003 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6371 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6372 // Labels are only valid in ASMs
6373 (yyval.ParamList) = new ParamList();
6374 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6375 (yyval.ParamList)->push_back(E);
6381 #line 3011 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6383 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6384 if (!UpRefs.empty())
6385 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6386 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6387 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6388 (yyval.ParamList)->push_back(E);
6389 delete (yyvsp[(3) - (6)].TypeVal);
6395 #line 3021 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6397 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6398 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6399 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6400 (yyval.ParamList)->push_back(E);
6406 #line 3028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6407 { (yyval.ParamList) = new ParamList(); ;}
6411 #line 3031 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6412 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6416 #line 3032 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6418 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6419 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6425 #line 3040 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6427 (yyval.ConstantList) = new std::vector<unsigned>();
6428 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6429 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6430 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6435 #line 3046 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6437 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6438 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6439 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6440 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6446 #line 3055 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6448 (yyval.BoolVal) = true;
6454 #line 3059 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6456 (yyval.BoolVal) = false;
6462 #line 3064 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6464 if (!UpRefs.empty())
6465 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6466 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6467 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6469 "Arithmetic operator requires integer, FP, or packed operands");
6470 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6472 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6474 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6475 if ((yyval.InstVal) == 0)
6476 GEN_ERROR("binary operator returned null");
6477 delete (yyvsp[(2) - (5)].TypeVal);
6482 #line 3080 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6484 if (!UpRefs.empty())
6485 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6486 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6487 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6488 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6489 GEN_ERROR("Logical operator requires integral operands");
6491 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6493 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6495 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6496 if ((yyval.InstVal) == 0)
6497 GEN_ERROR("binary operator returned null");
6498 delete (yyvsp[(2) - (5)].TypeVal);
6503 #line 3097 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6505 if (!UpRefs.empty())
6506 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6507 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6509 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6511 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6512 if ((yyval.InstVal) == 0)
6513 GEN_ERROR("icmp operator returned null");
6514 delete (yyvsp[(3) - (6)].TypeVal);
6519 #line 3109 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6521 if (!UpRefs.empty())
6522 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6523 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6525 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6527 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6528 if ((yyval.InstVal) == 0)
6529 GEN_ERROR("fcmp operator returned null");
6530 delete (yyvsp[(3) - (6)].TypeVal);
6535 #line 3121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6537 if (!UpRefs.empty())
6538 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6539 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6540 GEN_ERROR("Scalar types not supported by vicmp instruction");
6541 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6543 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6545 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6546 if ((yyval.InstVal) == 0)
6547 GEN_ERROR("vicmp operator returned null");
6548 delete (yyvsp[(3) - (6)].TypeVal);
6553 #line 3135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6555 if (!UpRefs.empty())
6556 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6557 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6558 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6559 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6561 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6563 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6564 if ((yyval.InstVal) == 0)
6565 GEN_ERROR("vfcmp operator returned null");
6566 delete (yyvsp[(3) - (6)].TypeVal);
6571 #line 3149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6573 if (!UpRefs.empty())
6574 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6575 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6576 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6577 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6578 GEN_ERROR("invalid cast opcode for cast from '" +
6579 Val->getType()->getDescription() + "' to '" +
6580 DestTy->getDescription() + "'");
6581 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6582 delete (yyvsp[(4) - (4)].TypeVal);
6587 #line 3161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6589 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6591 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6592 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6593 GEN_ERROR("vector select value types must be vector types");
6594 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6595 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6596 if (cond_type->getElementType() != Type::Int1Ty)
6597 GEN_ERROR("vector select condition element type must be boolean");
6598 if (cond_type->getNumElements() != select_type->getNumElements())
6599 GEN_ERROR("vector select number of elements must be the same");
6601 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6602 GEN_ERROR("select condition must be boolean");
6604 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6605 GEN_ERROR("select value types must match");
6606 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6612 #line 3182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6614 if (!UpRefs.empty())
6615 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6616 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6617 delete (yyvsp[(4) - (4)].TypeVal);
6623 #line 3189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6625 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6626 GEN_ERROR("Invalid extractelement operands");
6627 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6633 #line 3195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6635 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6636 GEN_ERROR("Invalid insertelement operands");
6637 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6643 #line 3201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6645 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6646 GEN_ERROR("Invalid shufflevector operands");
6647 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6653 #line 3207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6655 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6656 if (!Ty->isFirstClassType())
6657 GEN_ERROR("PHI node operands must be of first class type");
6658 (yyval.InstVal) = PHINode::Create(Ty);
6659 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6660 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6661 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6662 GEN_ERROR("All elements of a PHI node must be of the same type");
6663 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6664 (yyvsp[(2) - (2)].PHIList)->pop_front();
6666 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6672 #line 3223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6675 // Handle the short syntax
6676 const PointerType *PFTy = 0;
6677 const FunctionType *Ty = 0;
6678 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6679 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6680 // Pull out the types of all of the arguments...
6681 std::vector<const Type*> ParamTypes;
6682 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6683 for (; I != E; ++I) {
6684 const Type *Ty = I->Val->getType();
6685 if (Ty == Type::VoidTy)
6686 GEN_ERROR("Short call syntax cannot be used with varargs");
6687 ParamTypes.push_back(Ty);
6690 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6691 GEN_ERROR("Invalid result type for LLVM function");
6693 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6694 PFTy = PointerType::getUnqual(Ty);
6697 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6700 // Check for call to invalid intrinsic to avoid crashing later.
6701 if (Function *theF = dyn_cast<Function>(V)) {
6702 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6703 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6704 !theF->getIntrinsicID(true))
6705 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6706 theF->getName() + "'");
6709 // Set up the ParamAttrs for the function
6710 SmallVector<ParamAttrsWithIndex, 8> Attrs;
6711 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6712 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
6713 // Check the arguments
6715 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6716 // Make sure no arguments is a good thing!
6717 if (Ty->getNumParams() != 0)
6718 GEN_ERROR("No arguments passed to a function that "
6719 "expects arguments");
6720 } else { // Has arguments?
6721 // Loop through FunctionType's arguments and ensure they are specified
6722 // correctly. Also, gather any parameter attributes.
6723 FunctionType::param_iterator I = Ty->param_begin();
6724 FunctionType::param_iterator E = Ty->param_end();
6725 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6728 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6729 if (ArgI->Val->getType() != *I)
6730 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6731 (*I)->getDescription() + "'");
6732 Args.push_back(ArgI->Val);
6733 if (ArgI->Attrs != ParamAttr::None)
6734 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6736 if (Ty->isVarArg()) {
6738 for (; ArgI != ArgE; ++ArgI, ++index) {
6739 Args.push_back(ArgI->Val); // push the remaining varargs
6740 if (ArgI->Attrs != ParamAttr::None)
6741 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6743 } else if (I != E || ArgI != ArgE)
6744 GEN_ERROR("Invalid number of parameters detected");
6747 // Finish off the ParamAttrs and check them
6750 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6752 // Create the call node
6753 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6754 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6755 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6756 CI->setParamAttrs(PAL);
6757 (yyval.InstVal) = CI;
6758 delete (yyvsp[(6) - (8)].ParamList);
6759 delete (yyvsp[(3) - (8)].TypeVal);
6765 #line 3312 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6767 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6773 #line 3317 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6775 (yyval.BoolVal) = true;
6781 #line 3321 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6783 (yyval.BoolVal) = false;
6789 #line 3328 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6791 if (!UpRefs.empty())
6792 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6793 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6794 delete (yyvsp[(2) - (3)].TypeVal);
6800 #line 3335 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6802 if (!UpRefs.empty())
6803 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6804 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6805 GEN_ERROR("Malloc array size is not a 32-bit integer!");
6806 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6808 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6809 delete (yyvsp[(2) - (6)].TypeVal);
6814 #line 3345 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6816 if (!UpRefs.empty())
6817 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6818 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6819 delete (yyvsp[(2) - (3)].TypeVal);
6825 #line 3352 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6827 if (!UpRefs.empty())
6828 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6829 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6830 GEN_ERROR("Alloca array size is not a 32-bit integer!");
6831 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6833 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6834 delete (yyvsp[(2) - (6)].TypeVal);
6839 #line 3362 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6841 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6842 GEN_ERROR("Trying to free nonpointer type " +
6843 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6844 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6850 #line 3370 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6852 if (!UpRefs.empty())
6853 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6854 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6855 GEN_ERROR("Can't load from nonpointer type: " +
6856 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6857 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6858 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6859 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6860 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6862 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6863 delete (yyvsp[(3) - (5)].TypeVal);
6868 #line 3384 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6870 if (!UpRefs.empty())
6871 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6872 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6874 GEN_ERROR("Can't store to a nonpointer type: " +
6875 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6876 const Type *ElTy = PT->getElementType();
6877 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6878 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6879 "' into space of type '" + ElTy->getDescription() + "'");
6881 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6883 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6884 delete (yyvsp[(5) - (7)].TypeVal);
6889 #line 3401 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6891 if (!UpRefs.empty())
6892 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6893 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6894 GEN_ERROR("getresult insn requires an aggregate operand");
6895 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6896 GEN_ERROR("Invalid getresult index for type '" +
6897 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6899 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6901 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6902 delete (yyvsp[(2) - (5)].TypeVal);
6907 #line 3415 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6909 if (!UpRefs.empty())
6910 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6911 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6912 GEN_ERROR("getelementptr insn requires pointer operand");
6914 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6915 GEN_ERROR("Invalid getelementptr indices for type '" +
6916 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6917 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6919 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6920 delete (yyvsp[(2) - (4)].TypeVal);
6921 delete (yyvsp[(4) - (4)].ValueList);
6926 #line 3430 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6928 if (!UpRefs.empty())
6929 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6930 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6931 GEN_ERROR("extractvalue insn requires an aggregate operand");
6933 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
6934 GEN_ERROR("Invalid extractvalue indices for type '" +
6935 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6936 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6938 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
6939 delete (yyvsp[(2) - (4)].TypeVal);
6940 delete (yyvsp[(4) - (4)].ConstantList);
6945 #line 3445 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6947 if (!UpRefs.empty())
6948 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6949 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6950 GEN_ERROR("extractvalue insn requires an aggregate operand");
6952 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
6953 GEN_ERROR("Invalid insertvalue indices for type '" +
6954 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6955 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6956 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6958 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
6959 delete (yyvsp[(2) - (7)].TypeVal);
6960 delete (yyvsp[(5) - (7)].TypeVal);
6961 delete (yyvsp[(7) - (7)].ConstantList);
6966 /* Line 1267 of yacc.c. */
6967 #line 6968 "llvmAsmParser.tab.c"
6970 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6974 YY_STACK_PRINT (yyss, yyssp);
6979 /* Now `shift' the result of the reduction. Determine what state
6980 that goes to, based on the state we popped back to and the rule
6981 number reduced by. */
6985 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6986 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6987 yystate = yytable[yystate];
6989 yystate = yydefgoto[yyn - YYNTOKENS];
6994 /*------------------------------------.
6995 | yyerrlab -- here on detecting error |
6996 `------------------------------------*/
6998 /* If not already recovering from an error, report this error. */
7002 #if ! YYERROR_VERBOSE
7003 yyerror (YY_("syntax error"));
7006 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7007 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7009 YYSIZE_T yyalloc = 2 * yysize;
7010 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7011 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7012 if (yymsg != yymsgbuf)
7013 YYSTACK_FREE (yymsg);
7014 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7016 yymsg_alloc = yyalloc;
7020 yymsg_alloc = sizeof yymsgbuf;
7024 if (0 < yysize && yysize <= yymsg_alloc)
7026 (void) yysyntax_error (yymsg, yystate, yychar);
7031 yyerror (YY_("syntax error"));
7033 goto yyexhaustedlab;
7041 if (yyerrstatus == 3)
7043 /* If just tried and failed to reuse look-ahead token after an
7044 error, discard it. */
7046 if (yychar <= YYEOF)
7048 /* Return failure if at end of input. */
7049 if (yychar == YYEOF)
7054 yydestruct ("Error: discarding",
7060 /* Else will try to reuse look-ahead token after shifting the error
7065 /*---------------------------------------------------.
7066 | yyerrorlab -- error raised explicitly by YYERROR. |
7067 `---------------------------------------------------*/
7070 /* Pacify compilers like GCC when the user code never invokes
7071 YYERROR and the label yyerrorlab therefore never appears in user
7073 if (/*CONSTCOND*/ 0)
7076 /* Do not reclaim the symbols of the rule which action triggered
7080 YY_STACK_PRINT (yyss, yyssp);
7085 /*-------------------------------------------------------------.
7086 | yyerrlab1 -- common code for both syntax error and YYERROR. |
7087 `-------------------------------------------------------------*/
7089 yyerrstatus = 3; /* Each real token shifted decrements this. */
7093 yyn = yypact[yystate];
7094 if (yyn != YYPACT_NINF)
7097 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7105 /* Pop the current state because it cannot handle the error token. */
7110 yydestruct ("Error: popping",
7111 yystos[yystate], yyvsp);
7114 YY_STACK_PRINT (yyss, yyssp);
7123 /* Shift the error token. */
7124 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
7130 /*-------------------------------------.
7131 | yyacceptlab -- YYACCEPT comes here. |
7132 `-------------------------------------*/
7137 /*-----------------------------------.
7138 | yyabortlab -- YYABORT comes here. |
7139 `-----------------------------------*/
7145 /*-------------------------------------------------.
7146 | yyexhaustedlab -- memory exhaustion comes here. |
7147 `-------------------------------------------------*/
7149 yyerror (YY_("memory exhausted"));
7155 if (yychar != YYEOF && yychar != YYEMPTY)
7156 yydestruct ("Cleanup: discarding lookahead",
7158 /* Do not reclaim the symbols of the rule which action triggered
7159 this YYABORT or YYACCEPT. */
7161 YY_STACK_PRINT (yyss, yyssp);
7162 while (yyssp != yyss)
7164 yydestruct ("Cleanup: popping",
7165 yystos[*yyssp], yyvsp);
7170 YYSTACK_FREE (yyss);
7173 if (yymsg != yymsgbuf)
7174 YYSTACK_FREE (yymsg);
7176 /* Make sure YYID is used. */
7177 return YYID (yyresult);
7181 #line 3464 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
7184 // common code from the two 'RunVMAsmParser' functions
7185 static Module* RunParser(Module * M) {
7186 CurModule.CurrentModule = M;
7187 // Check to make sure the parser succeeded
7190 delete ParserResult;
7194 // Emit an error if there are any unresolved types left.
7195 if (!CurModule.LateResolveTypes.empty()) {
7196 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7197 if (DID.Type == ValID::LocalName) {
7198 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7200 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7203 delete ParserResult;
7207 // Emit an error if there are any unresolved values left.
7208 if (!CurModule.LateResolveValues.empty()) {
7209 Value *V = CurModule.LateResolveValues.back();
7210 std::map<Value*, std::pair<ValID, int> >::iterator I =
7211 CurModule.PlaceHolderInfo.find(V);
7213 if (I != CurModule.PlaceHolderInfo.end()) {
7214 ValID &DID = I->second.first;
7215 if (DID.Type == ValID::LocalName) {
7216 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7218 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7221 delete ParserResult;
7226 // Check to make sure that parsing produced a result
7230 // Reset ParserResult variable while saving its value for the result.
7231 Module *Result = ParserResult;
7237 void llvm::GenerateError(const std::string &message, int LineNo) {
7238 if (LineNo == -1) LineNo = LLLgetLineNo();
7239 // TODO: column number in exception
7241 TheParseError->setError(LLLgetFilename(), message, LineNo);
7245 int yyerror(const char *ErrorMsg) {
7246 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
7247 std::string errMsg = where + "error: " + std::string(ErrorMsg);
7248 if (yychar != YYEMPTY && yychar != 0) {
7249 errMsg += " while reading token: '";
7250 errMsg += std::string(LLLgetTokenStart(),
7251 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7253 GenerateError(errMsg);