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,
209 EXTRACTELEMENT = 390,
233 #define ESINT64VAL 258
234 #define EUINT64VAL 259
235 #define ESAPINTVAL 260
236 #define EUAPINTVAL 261
237 #define LOCALVAL_ID 262
238 #define GLOBALVAL_ID 263
246 #define PPC_FP128 271
250 #define GLOBALVAR 275
252 #define STRINGCONSTANT 277
253 #define ATSTRINGCONSTANT 278
254 #define PCTSTRINGCONSTANT 279
255 #define ZEROINITIALIZER 280
267 #define THREAD_LOCAL 292
269 #define DOTDOTDOT 294
275 #define APPENDING 300
276 #define DLLIMPORT 301
277 #define DLLEXPORT 302
278 #define EXTERN_WEAK 303
285 #define ADDRSPACE 310
291 #define SIDEEFFECT 316
294 #define FASTCC_TOK 319
295 #define COLDCC_TOK 320
296 #define X86_STDCALLCC_TOK 321
297 #define X86_FASTCALLCC_TOK 322
298 #define DATALAYOUT 323
304 #define UNREACHABLE 329
349 #define GETELEMENTPTR 374
365 #define EXTRACTELEMENT 390
366 #define INSERTELEMENT 391
367 #define SHUFFLEVECTOR 392
368 #define GETRESULT 393
369 #define EXTRACTVALUE 394
370 #define INSERTVALUE 395
385 #define PROTECTED 410
390 /* Copy the first part of user declarations. */
391 #line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
393 #include "ParserInternals.h"
394 #include "llvm/CallingConv.h"
395 #include "llvm/InlineAsm.h"
396 #include "llvm/Instructions.h"
397 #include "llvm/Module.h"
398 #include "llvm/ValueSymbolTable.h"
399 #include "llvm/AutoUpgrade.h"
400 #include "llvm/Support/GetElementPtrTypeIterator.h"
401 #include "llvm/Support/CommandLine.h"
402 #include "llvm/ADT/SmallVector.h"
403 #include "llvm/ADT/STLExtras.h"
404 #include "llvm/Support/MathExtras.h"
405 #include "llvm/Support/Streams.h"
411 // The following is a gross hack. In order to rid the libAsmParser library of
412 // exceptions, we have to have a way of getting the yyparse function to go into
413 // an error situation. So, whenever we want an error to occur, the GenerateError
414 // function (see bottom of file) sets TriggerError. Then, at the end of each
415 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
416 // (a goto) to put YACC in error state. Furthermore, several calls to
417 // GenerateError are made from inside productions and they must simulate the
418 // previous exception behavior by exiting the production immediately. We have
419 // replaced these with the GEN_ERROR macro which calls GeneratError and then
420 // immediately invokes YYERROR. This would be so much cleaner if it was a
421 // recursive descent parser.
422 static bool TriggerError = false;
423 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
424 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
426 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
427 int yylex(); // declaration" of xxx warnings.
429 using namespace llvm;
431 static Module *ParserResult;
433 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
434 // relating to upreferences in the input stream.
436 //#define DEBUG_UPREFS 1
438 #define UR_OUT(X) cerr << X
443 #define YYERROR_VERBOSE 1
445 static GlobalVariable *CurGV;
448 // This contains info used when building the body of a function. It is
449 // destroyed when the function is completed.
451 typedef std::vector<Value *> ValueList; // Numbered defs
454 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
456 static struct PerModuleInfo {
457 Module *CurrentModule;
458 ValueList Values; // Module level numbered definitions
459 ValueList LateResolveValues;
460 std::vector<PATypeHolder> Types;
461 std::map<ValID, PATypeHolder> LateResolveTypes;
463 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
464 /// how they were referenced and on which line of the input they came from so
465 /// that we can resolve them later and print error messages as appropriate.
466 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
468 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
469 // references to global values. Global values may be referenced before they
470 // are defined, and if so, the temporary object that they represent is held
471 // here. This is used for forward references of GlobalValues.
473 typedef std::map<std::pair<const PointerType *,
474 ValID>, GlobalValue*> GlobalRefsType;
475 GlobalRefsType GlobalRefs;
478 // If we could not resolve some functions at function compilation time
479 // (calls to functions before they are defined), resolve them now... Types
480 // are resolved when the constant pool has been completely parsed.
482 ResolveDefinitions(LateResolveValues);
486 // Check to make sure that all global value forward references have been
489 if (!GlobalRefs.empty()) {
490 std::string UndefinedReferences = "Unresolved global references exist:\n";
492 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
494 UndefinedReferences += " " + I->first.first->getDescription() + " " +
495 I->first.second.getName() + "\n";
497 GenerateError(UndefinedReferences);
501 // Look for intrinsic functions and CallInst that need to be upgraded
502 for (Module::iterator FI = CurrentModule->begin(),
503 FE = CurrentModule->end(); FI != FE; )
504 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
506 Values.clear(); // Clear out function local definitions
511 // GetForwardRefForGlobal - Check to see if there is a forward reference
512 // for this global. If so, remove it from the GlobalRefs map and return it.
513 // If not, just return null.
514 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
515 // Check to see if there is a forward reference to this global variable...
516 // if there is, eliminate it and patch the reference to use the new def'n.
517 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
518 GlobalValue *Ret = 0;
519 if (I != GlobalRefs.end()) {
526 bool TypeIsUnresolved(PATypeHolder* PATy) {
527 // If it isn't abstract, its resolved
528 const Type* Ty = PATy->get();
529 if (!Ty->isAbstract())
531 // Traverse the type looking for abstract types. If it isn't abstract then
532 // we don't need to traverse that leg of the type.
533 std::vector<const Type*> WorkList, SeenList;
534 WorkList.push_back(Ty);
535 while (!WorkList.empty()) {
536 const Type* Ty = WorkList.back();
537 SeenList.push_back(Ty);
539 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
540 // Check to see if this is an unresolved type
541 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
542 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
543 for ( ; I != E; ++I) {
544 if (I->second.get() == OpTy)
547 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
548 const Type* TheTy = SeqTy->getElementType();
549 if (TheTy->isAbstract() && TheTy != Ty) {
550 std::vector<const Type*>::iterator I = SeenList.begin(),
556 WorkList.push_back(TheTy);
558 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
559 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
560 const Type* TheTy = StrTy->getElementType(i);
561 if (TheTy->isAbstract() && TheTy != Ty) {
562 std::vector<const Type*>::iterator I = SeenList.begin(),
568 WorkList.push_back(TheTy);
577 static struct PerFunctionInfo {
578 Function *CurrentFunction; // Pointer to current function being created
580 ValueList Values; // Keep track of #'d definitions
582 ValueList LateResolveValues;
583 bool isDeclare; // Is this function a forward declararation?
584 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
585 GlobalValue::VisibilityTypes Visibility;
587 /// BBForwardRefs - When we see forward references to basic blocks, keep
588 /// track of them here.
589 std::map<ValID, BasicBlock*> BBForwardRefs;
591 inline PerFunctionInfo() {
594 Linkage = GlobalValue::ExternalLinkage;
595 Visibility = GlobalValue::DefaultVisibility;
598 inline void FunctionStart(Function *M) {
603 void FunctionDone() {
604 // Any forward referenced blocks left?
605 if (!BBForwardRefs.empty()) {
606 GenerateError("Undefined reference to label " +
607 BBForwardRefs.begin()->second->getName());
611 // Resolve all forward references now.
612 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
614 Values.clear(); // Clear out function local definitions
615 BBForwardRefs.clear();
618 Linkage = GlobalValue::ExternalLinkage;
619 Visibility = GlobalValue::DefaultVisibility;
621 } CurFun; // Info for the current function...
623 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
626 //===----------------------------------------------------------------------===//
627 // Code to handle definitions of all the types
628 //===----------------------------------------------------------------------===//
630 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
631 // Things that have names or are void typed don't get slot numbers
632 if (V->hasName() || (V->getType() == Type::VoidTy))
635 // In the case of function values, we have to allow for the forward reference
636 // of basic blocks, which are included in the numbering. Consequently, we keep
637 // track of the next insertion location with NextValNum. When a BB gets
638 // inserted, it could change the size of the CurFun.Values vector.
639 if (&ValueTab == &CurFun.Values) {
640 if (ValueTab.size() <= CurFun.NextValNum)
641 ValueTab.resize(CurFun.NextValNum+1);
642 ValueTab[CurFun.NextValNum++] = V;
645 // For all other lists, its okay to just tack it on the back of the vector.
646 ValueTab.push_back(V);
649 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
651 case ValID::LocalID: // Is it a numbered definition?
652 // Module constants occupy the lowest numbered slots...
653 if (D.Num < CurModule.Types.size())
654 return CurModule.Types[D.Num];
656 case ValID::LocalName: // Is it a named definition?
657 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
658 D.destroy(); // Free old strdup'd memory...
663 GenerateError("Internal parser error: Invalid symbol type reference");
667 // If we reached here, we referenced either a symbol that we don't know about
668 // or an id number that hasn't been read yet. We may be referencing something
669 // forward, so just create an entry to be resolved later and get to it...
671 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
674 if (inFunctionScope()) {
675 if (D.Type == ValID::LocalName) {
676 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
679 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
684 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
685 if (I != CurModule.LateResolveTypes.end())
688 Type *Typ = OpaqueType::get();
689 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
693 // getExistingVal - Look up the value specified by the provided type and
694 // the provided ValID. If the value exists and has already been defined, return
695 // it. Otherwise return null.
697 static Value *getExistingVal(const Type *Ty, const ValID &D) {
698 if (isa<FunctionType>(Ty)) {
699 GenerateError("Functions are not values and "
700 "must be referenced as pointers");
705 case ValID::LocalID: { // Is it a numbered definition?
706 // Check that the number is within bounds.
707 if (D.Num >= CurFun.Values.size())
709 Value *Result = CurFun.Values[D.Num];
710 if (Ty != Result->getType()) {
711 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
712 Result->getType()->getDescription() + "' does not match "
713 "expected type, '" + Ty->getDescription() + "'");
718 case ValID::GlobalID: { // Is it a numbered definition?
719 if (D.Num >= CurModule.Values.size())
721 Value *Result = CurModule.Values[D.Num];
722 if (Ty != Result->getType()) {
723 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
724 Result->getType()->getDescription() + "' does not match "
725 "expected type, '" + Ty->getDescription() + "'");
731 case ValID::LocalName: { // Is it a named definition?
732 if (!inFunctionScope())
734 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
735 Value *N = SymTab.lookup(D.getName());
738 if (N->getType() != Ty)
741 D.destroy(); // Free old strdup'd memory...
744 case ValID::GlobalName: { // Is it a named definition?
745 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
746 Value *N = SymTab.lookup(D.getName());
749 if (N->getType() != Ty)
752 D.destroy(); // Free old strdup'd memory...
756 // Check to make sure that "Ty" is an integral type, and that our
757 // value will fit into the specified type...
758 case ValID::ConstSIntVal: // Is it a constant pool reference??
759 if (!isa<IntegerType>(Ty) ||
760 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
761 GenerateError("Signed integral constant '" +
762 itostr(D.ConstPool64) + "' is invalid for type '" +
763 Ty->getDescription() + "'");
766 return ConstantInt::get(Ty, D.ConstPool64, true);
768 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
769 if (isa<IntegerType>(Ty) &&
770 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
771 return ConstantInt::get(Ty, D.UConstPool64);
773 if (!isa<IntegerType>(Ty) ||
774 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
775 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
776 "' is invalid or out of range for type '" +
777 Ty->getDescription() + "'");
780 // This is really a signed reference. Transmogrify.
781 return ConstantInt::get(Ty, D.ConstPool64, true);
783 case ValID::ConstFPVal: // Is it a floating point const pool reference?
784 if (!Ty->isFloatingPoint() ||
785 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
786 GenerateError("FP constant invalid for type");
789 // Lexer has no type info, so builds all float and double FP constants
790 // as double. Fix this here. Long double does not need this.
791 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
793 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
794 return ConstantFP::get(*D.ConstPoolFP);
796 case ValID::ConstNullVal: // Is it a null value?
797 if (!isa<PointerType>(Ty)) {
798 GenerateError("Cannot create a a non pointer null");
801 return ConstantPointerNull::get(cast<PointerType>(Ty));
803 case ValID::ConstUndefVal: // Is it an undef value?
804 return UndefValue::get(Ty);
806 case ValID::ConstZeroVal: // Is it a zero value?
807 return Constant::getNullValue(Ty);
809 case ValID::ConstantVal: // Fully resolved constant?
810 if (D.ConstantValue->getType() != Ty) {
811 GenerateError("Constant expression type different from required type");
814 return D.ConstantValue;
816 case ValID::InlineAsmVal: { // Inline asm expression
817 const PointerType *PTy = dyn_cast<PointerType>(Ty);
818 const FunctionType *FTy =
819 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
820 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
821 GenerateError("Invalid type for asm constraint string");
824 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
825 D.IAD->HasSideEffects);
826 D.destroy(); // Free InlineAsmDescriptor.
830 assert(0 && "Unhandled case!");
834 assert(0 && "Unhandled case!");
838 // getVal - This function is identical to getExistingVal, except that if a
839 // value is not already defined, it "improvises" by creating a placeholder var
840 // that looks and acts just like the requested variable. When the value is
841 // defined later, all uses of the placeholder variable are replaced with the
844 static Value *getVal(const Type *Ty, const ValID &ID) {
845 if (Ty == Type::LabelTy) {
846 GenerateError("Cannot use a basic block here");
850 // See if the value has already been defined.
851 Value *V = getExistingVal(Ty, ID);
853 if (TriggerError) return 0;
855 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
856 GenerateError("Invalid use of a non-first-class type");
860 // If we reached here, we referenced either a symbol that we don't know about
861 // or an id number that hasn't been read yet. We may be referencing something
862 // forward, so just create an entry to be resolved later and get to it...
865 case ValID::GlobalName:
866 case ValID::GlobalID: {
867 const PointerType *PTy = dyn_cast<PointerType>(Ty);
869 GenerateError("Invalid type for reference to global" );
872 const Type* ElTy = PTy->getElementType();
873 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
874 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
876 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
877 (Module*)0, false, PTy->getAddressSpace());
881 V = new Argument(Ty);
884 // Remember where this forward reference came from. FIXME, shouldn't we try
885 // to recycle these things??
886 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
889 if (inFunctionScope())
890 InsertValue(V, CurFun.LateResolveValues);
892 InsertValue(V, CurModule.LateResolveValues);
896 /// defineBBVal - This is a definition of a new basic block with the specified
897 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
898 static BasicBlock *defineBBVal(const ValID &ID) {
899 assert(inFunctionScope() && "Can't get basic block at global scope!");
903 // First, see if this was forward referenced
905 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
906 if (BBI != CurFun.BBForwardRefs.end()) {
908 // The forward declaration could have been inserted anywhere in the
909 // function: insert it into the correct place now.
910 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
911 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
913 // We're about to erase the entry, save the key so we can clean it up.
914 ValID Tmp = BBI->first;
916 // Erase the forward ref from the map as its no longer "forward"
917 CurFun.BBForwardRefs.erase(ID);
919 // The key has been removed from the map but so we don't want to leave
920 // strdup'd memory around so destroy it too.
923 // If its a numbered definition, bump the number and set the BB value.
924 if (ID.Type == ValID::LocalID) {
925 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
929 // We haven't seen this BB before and its first mention is a definition.
930 // Just create it and return it.
931 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
932 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
933 if (ID.Type == ValID::LocalID) {
934 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
943 /// getBBVal - get an existing BB value or create a forward reference for it.
945 static BasicBlock *getBBVal(const ValID &ID) {
946 assert(inFunctionScope() && "Can't get basic block at global scope!");
950 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
951 if (BBI != CurFun.BBForwardRefs.end()) {
953 } if (ID.Type == ValID::LocalName) {
954 std::string Name = ID.getName();
955 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
957 if (N->getType()->getTypeID() == Type::LabelTyID)
958 BB = cast<BasicBlock>(N);
960 GenerateError("Reference to label '" + Name + "' is actually of type '"+
961 N->getType()->getDescription() + "'");
963 } else if (ID.Type == ValID::LocalID) {
964 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
965 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
966 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
968 GenerateError("Reference to label '%" + utostr(ID.Num) +
969 "' is actually of type '"+
970 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
973 GenerateError("Illegal label reference " + ID.getName());
977 // If its already been defined, return it now.
979 ID.destroy(); // Free strdup'd memory.
983 // Otherwise, this block has not been seen before, create it.
985 if (ID.Type == ValID::LocalName)
987 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
989 // Insert it in the forward refs map.
990 CurFun.BBForwardRefs[ID] = BB;
996 //===----------------------------------------------------------------------===//
997 // Code to handle forward references in instructions
998 //===----------------------------------------------------------------------===//
1000 // This code handles the late binding needed with statements that reference
1001 // values not defined yet... for example, a forward branch, or the PHI node for
1004 // This keeps a table (CurFun.LateResolveValues) of all such forward references
1005 // and back patchs after we are done.
1008 // ResolveDefinitions - If we could not resolve some defs at parsing
1009 // time (forward branches, phi functions for loops, etc...) resolve the
1013 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1014 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1015 while (!LateResolvers.empty()) {
1016 Value *V = LateResolvers.back();
1017 LateResolvers.pop_back();
1019 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1020 CurModule.PlaceHolderInfo.find(V);
1021 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1023 ValID &DID = PHI->second.first;
1025 Value *TheRealValue = getExistingVal(V->getType(), DID);
1029 V->replaceAllUsesWith(TheRealValue);
1031 CurModule.PlaceHolderInfo.erase(PHI);
1032 } else if (FutureLateResolvers) {
1033 // Functions have their unresolved items forwarded to the module late
1035 InsertValue(V, *FutureLateResolvers);
1037 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1038 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1039 "' of type '" + V->getType()->getDescription() + "'",
1040 PHI->second.second);
1043 GenerateError("Reference to an invalid definition: #" +
1044 itostr(DID.Num) + " of type '" +
1045 V->getType()->getDescription() + "'",
1046 PHI->second.second);
1051 LateResolvers.clear();
1054 // ResolveTypeTo - A brand new type was just declared. This means that (if
1055 // name is not null) things referencing Name can be resolved. Otherwise, things
1056 // refering to the number can be resolved. Do this now.
1058 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1061 D = ValID::createLocalName(*Name);
1063 D = ValID::createLocalID(CurModule.Types.size());
1065 std::map<ValID, PATypeHolder>::iterator I =
1066 CurModule.LateResolveTypes.find(D);
1067 if (I != CurModule.LateResolveTypes.end()) {
1068 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1069 CurModule.LateResolveTypes.erase(I);
1073 // setValueName - Set the specified value to the name given. The name may be
1074 // null potentially, in which case this is a noop. The string passed in is
1075 // assumed to be a malloc'd string buffer, and is free'd by this function.
1077 static void setValueName(Value *V, std::string *NameStr) {
1078 if (!NameStr) return;
1079 std::string Name(*NameStr); // Copy string
1080 delete NameStr; // Free old string
1082 if (V->getType() == Type::VoidTy) {
1083 GenerateError("Can't assign name '" + Name+"' to value with void type");
1087 assert(inFunctionScope() && "Must be in function scope!");
1088 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1089 if (ST.lookup(Name)) {
1090 GenerateError("Redefinition of value '" + Name + "' of type '" +
1091 V->getType()->getDescription() + "'");
1099 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1100 /// this is a declaration, otherwise it is a definition.
1101 static GlobalVariable *
1102 ParseGlobalVariable(std::string *NameStr,
1103 GlobalValue::LinkageTypes Linkage,
1104 GlobalValue::VisibilityTypes Visibility,
1105 bool isConstantGlobal, const Type *Ty,
1106 Constant *Initializer, bool IsThreadLocal,
1107 unsigned AddressSpace = 0) {
1108 if (isa<FunctionType>(Ty)) {
1109 GenerateError("Cannot declare global vars of function type");
1113 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1117 Name = *NameStr; // Copy string
1118 delete NameStr; // Free old string
1121 // See if this global value was forward referenced. If so, recycle the
1124 if (!Name.empty()) {
1125 ID = ValID::createGlobalName(Name);
1127 ID = ValID::createGlobalID(CurModule.Values.size());
1130 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1131 // Move the global to the end of the list, from whereever it was
1132 // previously inserted.
1133 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1134 CurModule.CurrentModule->getGlobalList().remove(GV);
1135 CurModule.CurrentModule->getGlobalList().push_back(GV);
1136 GV->setInitializer(Initializer);
1137 GV->setLinkage(Linkage);
1138 GV->setVisibility(Visibility);
1139 GV->setConstant(isConstantGlobal);
1140 GV->setThreadLocal(IsThreadLocal);
1141 InsertValue(GV, CurModule.Values);
1145 // If this global has a name
1146 if (!Name.empty()) {
1147 // if the global we're parsing has an initializer (is a definition) and
1148 // has external linkage.
1149 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1150 // If there is already a global with external linkage with this name
1151 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1152 // If we allow this GVar to get created, it will be renamed in the
1153 // symbol table because it conflicts with an existing GVar. We can't
1154 // allow redefinition of GVars whose linking indicates that their name
1155 // must stay the same. Issue the error.
1156 GenerateError("Redefinition of global variable named '" + Name +
1157 "' of type '" + Ty->getDescription() + "'");
1162 // Otherwise there is no existing GV to use, create one now.
1163 GlobalVariable *GV =
1164 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1165 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1166 GV->setVisibility(Visibility);
1167 InsertValue(GV, CurModule.Values);
1171 // setTypeName - Set the specified type to the name given. The name may be
1172 // null potentially, in which case this is a noop. The string passed in is
1173 // assumed to be a malloc'd string buffer, and is freed by this function.
1175 // This function returns true if the type has already been defined, but is
1176 // allowed to be redefined in the specified context. If the name is a new name
1177 // for the type plane, it is inserted and false is returned.
1178 static bool setTypeName(const Type *T, std::string *NameStr) {
1179 assert(!inFunctionScope() && "Can't give types function-local names!");
1180 if (NameStr == 0) return false;
1182 std::string Name(*NameStr); // Copy string
1183 delete NameStr; // Free old string
1185 // We don't allow assigning names to void type
1186 if (T == Type::VoidTy) {
1187 GenerateError("Can't assign name '" + Name + "' to the void type");
1191 // Set the type name, checking for conflicts as we do so.
1192 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1194 if (AlreadyExists) { // Inserting a name that is already defined???
1195 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1196 assert(Existing && "Conflict but no matching type?!");
1198 // There is only one case where this is allowed: when we are refining an
1199 // opaque type. In this case, Existing will be an opaque type.
1200 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1201 // We ARE replacing an opaque type!
1202 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1206 // Otherwise, this is an attempt to redefine a type. That's okay if
1207 // the redefinition is identical to the original. This will be so if
1208 // Existing and T point to the same Type object. In this one case we
1209 // allow the equivalent redefinition.
1210 if (Existing == T) return true; // Yes, it's equal.
1212 // Any other kind of (non-equivalent) redefinition is an error.
1213 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1214 T->getDescription() + "'");
1220 //===----------------------------------------------------------------------===//
1221 // Code for handling upreferences in type names...
1224 // TypeContains - Returns true if Ty directly contains E in it.
1226 static bool TypeContains(const Type *Ty, const Type *E) {
1227 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1228 E) != Ty->subtype_end();
1232 struct UpRefRecord {
1233 // NestingLevel - The number of nesting levels that need to be popped before
1234 // this type is resolved.
1235 unsigned NestingLevel;
1237 // LastContainedTy - This is the type at the current binding level for the
1238 // type. Every time we reduce the nesting level, this gets updated.
1239 const Type *LastContainedTy;
1241 // UpRefTy - This is the actual opaque type that the upreference is
1242 // represented with.
1243 OpaqueType *UpRefTy;
1245 UpRefRecord(unsigned NL, OpaqueType *URTy)
1246 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1250 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1251 static std::vector<UpRefRecord> UpRefs;
1253 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1254 /// called. It loops through the UpRefs vector, which is a list of the
1255 /// currently active types. For each type, if the up reference is contained in
1256 /// the newly completed type, we decrement the level count. When the level
1257 /// count reaches zero, the upreferenced type is the type that is passed in:
1258 /// thus we can complete the cycle.
1260 static PATypeHolder HandleUpRefs(const Type *ty) {
1261 // If Ty isn't abstract, or if there are no up-references in it, then there is
1262 // nothing to resolve here.
1263 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1265 PATypeHolder Ty(ty);
1266 UR_OUT("Type '" << Ty->getDescription() <<
1267 "' newly formed. Resolving upreferences.\n" <<
1268 UpRefs.size() << " upreferences active!\n");
1270 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1271 // to zero), we resolve them all together before we resolve them to Ty. At
1272 // the end of the loop, if there is anything to resolve to Ty, it will be in
1274 OpaqueType *TypeToResolve = 0;
1276 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1277 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1278 << UpRefs[i].second->getDescription() << ") = "
1279 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1280 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1281 // Decrement level of upreference
1282 unsigned Level = --UpRefs[i].NestingLevel;
1283 UpRefs[i].LastContainedTy = Ty;
1284 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1285 if (Level == 0) { // Upreference should be resolved!
1286 if (!TypeToResolve) {
1287 TypeToResolve = UpRefs[i].UpRefTy;
1289 UR_OUT(" * Resolving upreference for "
1290 << UpRefs[i].second->getDescription() << "\n";
1291 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1292 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1293 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1294 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1296 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1297 --i; // Do not skip the next element...
1302 if (TypeToResolve) {
1303 UR_OUT(" * Resolving upreference for "
1304 << UpRefs[i].second->getDescription() << "\n";
1305 std::string OldName = TypeToResolve->getDescription());
1306 TypeToResolve->refineAbstractTypeTo(Ty);
1312 //===----------------------------------------------------------------------===//
1313 // RunVMAsmParser - Define an interface to this parser
1314 //===----------------------------------------------------------------------===//
1316 static Module* RunParser(Module * M);
1318 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1320 Module *M = RunParser(new Module(LLLgetFilename()));
1327 /* Enabling traces. */
1332 /* Enabling verbose error messages. */
1333 #ifdef YYERROR_VERBOSE
1334 # undef YYERROR_VERBOSE
1335 # define YYERROR_VERBOSE 1
1337 # define YYERROR_VERBOSE 0
1340 /* Enabling the token table. */
1341 #ifndef YYTOKEN_TABLE
1342 # define YYTOKEN_TABLE 0
1345 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1346 typedef union YYSTYPE
1347 #line 949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
1349 llvm::Module *ModuleVal;
1350 llvm::Function *FunctionVal;
1351 llvm::BasicBlock *BasicBlockVal;
1352 llvm::TerminatorInst *TermInstVal;
1353 llvm::Instruction *InstVal;
1354 llvm::Constant *ConstVal;
1356 const llvm::Type *PrimType;
1357 std::list<llvm::PATypeHolder> *TypeList;
1358 llvm::PATypeHolder *TypeVal;
1359 llvm::Value *ValueVal;
1360 std::vector<llvm::Value*> *ValueList;
1361 llvm::ArgListType *ArgList;
1362 llvm::TypeWithAttrs TypeWithAttrs;
1363 llvm::TypeWithAttrsList *TypeWithAttrsList;
1364 llvm::ParamList *ParamList;
1366 // Represent the RHS of PHI node
1367 std::list<std::pair<llvm::Value*,
1368 llvm::BasicBlock*> > *PHIList;
1369 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1370 std::vector<llvm::Constant*> *ConstVector;
1372 llvm::GlobalValue::LinkageTypes Linkage;
1373 llvm::GlobalValue::VisibilityTypes Visibility;
1374 llvm::ParameterAttributes ParamAttrs;
1375 llvm::APInt *APIntVal;
1380 llvm::APFloat *FPVal;
1383 std::string *StrVal; // This memory must be deleted
1384 llvm::ValID ValIDVal;
1386 llvm::Instruction::BinaryOps BinaryOpVal;
1387 llvm::Instruction::TermOps TermOpVal;
1388 llvm::Instruction::MemoryOps MemOpVal;
1389 llvm::Instruction::CastOps CastOpVal;
1390 llvm::Instruction::OtherOps OtherOpVal;
1391 llvm::ICmpInst::Predicate IPredicate;
1392 llvm::FCmpInst::Predicate FPredicate;
1394 /* Line 193 of yacc.c. */
1395 #line 1396 "llvmAsmParser.tab.c"
1397 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1398 # define YYSTYPE_IS_DECLARED 1
1399 # define YYSTYPE_IS_TRIVIAL 1
1404 /* Copy the second part of user declarations. */
1407 /* Line 216 of yacc.c. */
1408 #line 1409 "llvmAsmParser.tab.c"
1415 typedef YYTYPE_UINT8 yytype_uint8;
1417 typedef unsigned char yytype_uint8;
1421 typedef YYTYPE_INT8 yytype_int8;
1422 #elif (defined __STDC__ || defined __C99__FUNC__ \
1423 || defined __cplusplus || defined _MSC_VER)
1424 typedef signed char yytype_int8;
1426 typedef short int yytype_int8;
1429 #ifdef YYTYPE_UINT16
1430 typedef YYTYPE_UINT16 yytype_uint16;
1432 typedef unsigned short int yytype_uint16;
1436 typedef YYTYPE_INT16 yytype_int16;
1438 typedef short int yytype_int16;
1442 # ifdef __SIZE_TYPE__
1443 # define YYSIZE_T __SIZE_TYPE__
1444 # elif defined size_t
1445 # define YYSIZE_T size_t
1446 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1447 || defined __cplusplus || defined _MSC_VER)
1448 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1449 # define YYSIZE_T size_t
1451 # define YYSIZE_T unsigned int
1455 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1458 # if defined YYENABLE_NLS && YYENABLE_NLS
1460 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1461 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1465 # define YY_(msgid) msgid
1469 /* Suppress unused-variable warnings by "using" E. */
1470 #if ! defined lint || defined __GNUC__
1471 # define YYUSE(e) ((void) (e))
1473 # define YYUSE(e) /* empty */
1476 /* Identity function, used to suppress warnings about constant conditions. */
1478 # define YYID(n) (n)
1480 #if (defined __STDC__ || defined __C99__FUNC__ \
1481 || defined __cplusplus || defined _MSC_VER)
1494 #if ! defined yyoverflow || YYERROR_VERBOSE
1496 /* The parser invokes alloca or malloc; define the necessary symbols. */
1498 # ifdef YYSTACK_USE_ALLOCA
1499 # if YYSTACK_USE_ALLOCA
1501 # define YYSTACK_ALLOC __builtin_alloca
1502 # elif defined __BUILTIN_VA_ARG_INCR
1503 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1505 # define YYSTACK_ALLOC __alloca
1506 # elif defined _MSC_VER
1507 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1508 # define alloca _alloca
1510 # define YYSTACK_ALLOC alloca
1511 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1512 || defined __cplusplus || defined _MSC_VER)
1513 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1515 # define _STDLIB_H 1
1522 # ifdef YYSTACK_ALLOC
1523 /* Pacify GCC's `empty if-body' warning. */
1524 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1525 # ifndef YYSTACK_ALLOC_MAXIMUM
1526 /* The OS might guarantee only one guard page at the bottom of the stack,
1527 and a page size can be as small as 4096 bytes. So we cannot safely
1528 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1529 to allow for a few compiler-allocated temporary stack slots. */
1530 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1533 # define YYSTACK_ALLOC YYMALLOC
1534 # define YYSTACK_FREE YYFREE
1535 # ifndef YYSTACK_ALLOC_MAXIMUM
1536 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1538 # if (defined __cplusplus && ! defined _STDLIB_H \
1539 && ! ((defined YYMALLOC || defined malloc) \
1540 && (defined YYFREE || defined free)))
1541 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1543 # define _STDLIB_H 1
1547 # define YYMALLOC malloc
1548 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1554 # define YYFREE free
1555 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1556 || defined __cplusplus || defined _MSC_VER)
1557 void free (void *); /* INFRINGES ON USER NAME SPACE */
1561 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1564 #if (! defined yyoverflow \
1565 && (! defined __cplusplus \
1566 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1568 /* A type that is properly aligned for any stack member. */
1575 /* The size of the maximum gap between one aligned stack and the next. */
1576 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1578 /* The size of an array large to enough to hold all stacks, each with
1580 # define YYSTACK_BYTES(N) \
1581 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1582 + YYSTACK_GAP_MAXIMUM)
1584 /* Copy COUNT objects from FROM to TO. The source and destination do
1587 # if defined __GNUC__ && 1 < __GNUC__
1588 # define YYCOPY(To, From, Count) \
1589 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1591 # define YYCOPY(To, From, Count) \
1595 for (yyi = 0; yyi < (Count); yyi++) \
1596 (To)[yyi] = (From)[yyi]; \
1602 /* Relocate STACK from its old location to the new one. The
1603 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1604 elements in the stack, and YYPTR gives the new location of the
1605 stack. Advance YYPTR to a properly aligned location for the next
1607 # define YYSTACK_RELOCATE(Stack) \
1610 YYSIZE_T yynewbytes; \
1611 YYCOPY (&yyptr->Stack, Stack, yysize); \
1612 Stack = &yyptr->Stack; \
1613 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1614 yyptr += yynewbytes / sizeof (*yyptr); \
1620 /* YYFINAL -- State number of the termination state. */
1622 /* YYLAST -- Last index in YYTABLE. */
1625 /* YYNTOKENS -- Number of terminals. */
1626 #define YYNTOKENS 170
1627 /* YYNNTS -- Number of nonterminals. */
1629 /* YYNRULES -- Number of rules. */
1630 #define YYNRULES 331
1631 /* YYNRULES -- Number of states. */
1632 #define YYNSTATES 679
1634 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1635 #define YYUNDEFTOK 2
1636 #define YYMAXUTOK 410
1638 #define YYTRANSLATE(YYX) \
1639 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1641 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1642 static const yytype_uint8 yytranslate[] =
1644 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 156, 157, 160, 2, 159, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 165, 158, 166, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 162, 161, 164, 2, 2, 2, 2, 2, 169,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 163, 2, 2, 167, 2, 168, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1663 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1664 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1665 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1667 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1668 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1669 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1670 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1671 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1672 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1673 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1674 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1675 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1676 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1677 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1678 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1679 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1680 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1681 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1682 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1683 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1684 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1689 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1691 static const yytype_uint16 yyprhs[] =
1693 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1694 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1695 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1696 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1697 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1698 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1699 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1700 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1701 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1702 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1703 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1704 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1705 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1706 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1707 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1708 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1709 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1710 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1711 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1712 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
1713 526, 535, 544, 550, 558, 562, 564, 566, 568, 570,
1714 571, 574, 581, 583, 584, 586, 589, 590, 594, 595,
1715 599, 603, 607, 611, 612, 621, 622, 632, 633, 643,
1716 649, 652, 656, 658, 662, 666, 670, 674, 676, 677,
1717 683, 687, 689, 693, 695, 696, 707, 709, 711, 716,
1718 718, 720, 723, 727, 728, 730, 732, 734, 736, 738,
1719 740, 742, 744, 746, 750, 752, 758, 760, 762, 764,
1720 766, 768, 770, 773, 775, 779, 782, 785, 789, 792,
1721 793, 795, 798, 801, 805, 815, 825, 834, 849, 851,
1722 853, 860, 866, 869, 876, 884, 889, 894, 901, 908,
1723 909, 910, 914, 917, 919, 925, 931, 938, 945, 952,
1724 959, 964, 971, 976, 981, 988, 995, 998, 1007, 1009,
1725 1011, 1012, 1016, 1023, 1027, 1034, 1037, 1043, 1051, 1057,
1729 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1730 static const yytype_int16 yyrhs[] =
1732 216, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1733 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1734 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1735 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1736 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1737 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1738 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1739 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1740 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1741 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1742 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
1743 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1744 -1, 19, -1, 22, -1, 24, -1, 178, -1, -1,
1745 55, 156, 4, 157, -1, -1, 178, 158, -1, -1,
1746 20, -1, 23, -1, 184, -1, -1, 182, 158, -1,
1747 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1748 49, -1, 46, -1, 48, -1, 51, -1, -1, 153,
1749 -1, 154, -1, 155, -1, -1, 46, -1, 48, -1,
1750 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1751 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
1752 -1, 66, -1, 67, -1, 62, 4, -1, 142, -1,
1753 121, -1, 141, -1, 122, -1, 144, -1, 145, -1,
1754 147, -1, 148, -1, 149, -1, 54, 4, -1, -1,
1755 193, 192, -1, 143, -1, 146, -1, 142, -1, 141,
1756 -1, 150, -1, 151, -1, -1, 195, 194, -1, -1,
1757 152, 22, -1, -1, 54, 4, -1, -1, 159, 54,
1758 4, -1, 34, 22, -1, -1, 199, -1, -1, 159,
1759 202, 201, -1, 199, -1, 54, 4, -1, 11, -1,
1760 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
1761 17, -1, 50, -1, 203, -1, 204, 180, 160, -1,
1762 238, -1, 161, 4, -1, 204, 156, 208, 157, 195,
1763 -1, 10, 156, 208, 157, 195, -1, 162, 4, 163,
1764 204, 164, -1, 165, 4, 163, 204, 166, -1, 167,
1765 209, 168, -1, 167, 168, -1, 165, 167, 209, 168,
1766 166, -1, 165, 167, 168, 166, -1, 204, 193, -1,
1767 204, -1, 10, -1, 205, -1, 207, 159, 205, -1,
1768 207, -1, 207, 159, 39, -1, 39, -1, -1, 204,
1769 -1, 209, 159, 204, -1, 204, 162, 212, 164, -1,
1770 204, 162, 164, -1, 204, 169, 22, -1, 204, 165,
1771 212, 166, -1, 204, 167, 212, 168, -1, 204, 167,
1772 168, -1, 204, 165, 167, 212, 168, 166, -1, 204,
1773 165, 167, 168, 166, -1, 204, 40, -1, 204, 41,
1774 -1, 204, 238, -1, 204, 211, -1, 204, 25, -1,
1775 176, 3, -1, 176, 5, -1, 176, 4, -1, 176,
1776 6, -1, 11, 26, -1, 11, 27, -1, 177, 9,
1777 -1, 173, 156, 210, 38, 204, 157, -1, 119, 156,
1778 210, 250, 157, -1, 133, 156, 210, 159, 210, 159,
1779 210, 157, -1, 171, 156, 210, 159, 210, 157, -1,
1780 172, 156, 210, 159, 210, 157, -1, 90, 174, 156,
1781 210, 159, 210, 157, -1, 91, 175, 156, 210, 159,
1782 210, 157, -1, 92, 174, 156, 210, 159, 210, 157,
1783 -1, 93, 175, 156, 210, 159, 210, 157, -1, 135,
1784 156, 210, 159, 210, 157, -1, 136, 156, 210, 159,
1785 210, 159, 210, 157, -1, 137, 156, 210, 159, 210,
1786 159, 210, 157, -1, 139, 156, 210, 250, 157, -1,
1787 140, 156, 210, 159, 210, 250, 157, -1, 212, 159,
1788 210, -1, 210, -1, 32, -1, 33, -1, 37, -1,
1789 -1, 206, 238, -1, 125, 156, 215, 38, 204, 157,
1790 -1, 217, -1, -1, 218, -1, 217, 218, -1, -1,
1791 31, 219, 234, -1, -1, 30, 220, 235, -1, 60,
1792 59, 224, -1, 181, 18, 204, -1, 181, 18, 10,
1793 -1, -1, 183, 187, 214, 213, 210, 180, 221, 201,
1794 -1, -1, 183, 185, 187, 214, 213, 210, 180, 222,
1795 201, -1, -1, 183, 186, 187, 214, 213, 204, 180,
1796 223, 201, -1, 183, 187, 35, 190, 215, -1, 52,
1797 225, -1, 56, 158, 226, -1, 22, -1, 53, 158,
1798 22, -1, 68, 158, 22, -1, 162, 227, 164, -1,
1799 227, 159, 22, -1, 22, -1, -1, 228, 159, 204,
1800 193, 179, -1, 204, 193, 179, -1, 228, -1, 228,
1801 159, 39, -1, 39, -1, -1, 191, 206, 182, 156,
1802 229, 157, 195, 200, 197, 196, -1, 28, -1, 167,
1803 -1, 189, 187, 230, 231, -1, 29, -1, 168, -1,
1804 242, 233, -1, 188, 187, 230, -1, -1, 61, -1,
1805 3, -1, 4, -1, 9, -1, 26, -1, 27, -1,
1806 40, -1, 41, -1, 25, -1, 165, 212, 166, -1,
1807 211, -1, 59, 236, 22, 159, 22, -1, 7, -1,
1808 8, -1, 178, -1, 182, -1, 238, -1, 237, -1,
1809 204, 239, -1, 240, -1, 241, 159, 240, -1, 242,
1810 243, -1, 232, 243, -1, 244, 181, 245, -1, 244,
1811 247, -1, -1, 21, -1, 69, 241, -1, 69, 10,
1812 -1, 70, 17, 239, -1, 70, 11, 239, 159, 17,
1813 239, 159, 17, 239, -1, 71, 176, 239, 159, 17,
1814 239, 162, 246, 164, -1, 71, 176, 239, 159, 17,
1815 239, 162, 164, -1, 72, 191, 206, 239, 156, 249,
1816 157, 195, 38, 17, 239, 73, 17, 239, -1, 73,
1817 -1, 74, -1, 246, 176, 237, 159, 17, 239, -1,
1818 176, 237, 159, 17, 239, -1, 181, 252, -1, 204,
1819 162, 239, 159, 239, 164, -1, 248, 159, 162, 239,
1820 159, 239, 164, -1, 204, 193, 239, 193, -1, 17,
1821 193, 239, 193, -1, 249, 159, 204, 193, 239, 193,
1822 -1, 249, 159, 17, 193, 239, 193, -1, -1, -1,
1823 250, 159, 240, -1, 58, 57, -1, 57, -1, 171,
1824 204, 239, 159, 239, -1, 172, 204, 239, 159, 239,
1825 -1, 90, 174, 204, 239, 159, 239, -1, 91, 175,
1826 204, 239, 159, 239, -1, 92, 174, 204, 239, 159,
1827 239, -1, 93, 175, 204, 239, 159, 239, -1, 173,
1828 240, 38, 204, -1, 133, 240, 159, 240, 159, 240,
1829 -1, 134, 240, 159, 204, -1, 135, 240, 159, 240,
1830 -1, 136, 240, 159, 240, 159, 240, -1, 137, 240,
1831 159, 240, 159, 240, -1, 132, 248, -1, 251, 191,
1832 206, 239, 156, 249, 157, 195, -1, 254, -1, 36,
1833 -1, -1, 114, 204, 198, -1, 114, 204, 159, 11,
1834 239, 198, -1, 115, 204, 198, -1, 115, 204, 159,
1835 11, 239, 198, -1, 116, 240, -1, 253, 117, 204,
1836 239, 198, -1, 253, 118, 240, 159, 204, 239, 198,
1837 -1, 138, 204, 239, 159, 4, -1, 119, 204, 239,
1838 250, -1, 139, 204, 239, 250, -1, 140, 204, 239,
1839 159, 204, 239, 250, -1
1842 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1843 static const yytype_uint16 yyrline[] =
1845 0, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
1846 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114,
1847 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1118,
1848 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126,
1849 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131,
1850 1131, 1132, 1132, 1133, 1134, 1139, 1140, 1140, 1140, 1140,
1851 1140, 1142, 1142, 1142, 1143, 1143, 1145, 1146, 1150, 1154,
1852 1159, 1159, 1161, 1162, 1167, 1173, 1174, 1175, 1176, 1177,
1853 1178, 1182, 1183, 1184, 1188, 1189, 1190, 1191, 1195, 1196,
1854 1197, 1201, 1202, 1203, 1204, 1205, 1209, 1210, 1211, 1214,
1855 1215, 1216, 1217, 1218, 1219, 1220, 1227, 1228, 1229, 1230,
1856 1231, 1232, 1233, 1234, 1235, 1236, 1240, 1241, 1246, 1247,
1857 1248, 1249, 1250, 1251, 1254, 1255, 1260, 1261, 1268, 1269,
1858 1275, 1276, 1285, 1293, 1294, 1299, 1300, 1301, 1306, 1319,
1859 1319, 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337,
1860 1342, 1350, 1379, 1404, 1409, 1419, 1429, 1433, 1443, 1450,
1861 1459, 1466, 1471, 1476, 1483, 1484, 1491, 1498, 1506, 1512,
1862 1524, 1552, 1568, 1595, 1623, 1649, 1669, 1695, 1715, 1727,
1863 1734, 1800, 1810, 1820, 1826, 1836, 1842, 1852, 1857, 1862,
1864 1875, 1887, 1908, 1916, 1922, 1933, 1938, 1943, 1948, 1953,
1865 1959, 1965, 1971, 1992, 2016, 2020, 2028, 2028, 2031, 2031,
1866 2034, 2046, 2067, 2072, 2080, 2081, 2085, 2085, 2089, 2089,
1867 2092, 2095, 2119, 2131, 2130, 2142, 2141, 2151, 2150, 2161,
1868 2201, 2204, 2210, 2220, 2224, 2229, 2231, 2236, 2241, 2250,
1869 2260, 2271, 2275, 2284, 2293, 2298, 2427, 2427, 2429, 2438,
1870 2438, 2440, 2445, 2457, 2461, 2466, 2470, 2474, 2478, 2482,
1871 2486, 2490, 2494, 2498, 2523, 2527, 2537, 2541, 2545, 2550,
1872 2557, 2557, 2563, 2572, 2577, 2582, 2586, 2595, 2604, 2613,
1873 2617, 2625, 2632, 2636, 2641, 2651, 2670, 2679, 2765, 2769,
1874 2776, 2787, 2800, 2810, 2821, 2831, 2842, 2850, 2860, 2867,
1875 2870, 2871, 2878, 2882, 2887, 2903, 2920, 2934, 2948, 2962,
1876 2976, 2988, 2996, 3003, 3009, 3015, 3021, 3036, 3126, 3131,
1877 3135, 3142, 3149, 3157, 3164, 3172, 3180, 3194, 3211, 3219,
1882 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1883 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1884 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1885 static const char *const yytname[] =
1887 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1888 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1889 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1890 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1891 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1892 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1893 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1894 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1895 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
1896 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1897 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1898 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1899 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1900 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1901 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1902 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1903 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1904 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1905 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1906 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1907 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1908 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1909 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1910 "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1911 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1912 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1913 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1914 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName",
1915 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1916 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1917 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1918 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1919 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1920 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1921 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1922 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1923 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1924 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1925 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1926 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1927 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1928 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1929 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1930 "InstVal", "OptVolatile", "MemoryInst", 0
1935 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1937 static const yytype_uint16 yytoknum[] =
1939 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1940 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1941 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1942 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1943 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1944 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1945 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1946 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1947 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1948 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1949 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1950 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1951 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1952 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1953 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1954 405, 406, 407, 408, 409, 410, 40, 41, 61, 44,
1955 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
1959 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1960 static const yytype_uint8 yyr1[] =
1962 0, 170, 171, 171, 171, 171, 171, 171, 171, 171,
1963 171, 172, 172, 172, 172, 172, 172, 173, 173, 173,
1964 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1965 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
1966 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1967 175, 175, 175, 175, 175, 176, 177, 177, 177, 177,
1968 177, 178, 178, 178, 179, 179, 180, 180, 181, 181,
1969 182, 182, 183, 183, 184, 185, 185, 185, 185, 185,
1970 185, 186, 186, 186, 187, 187, 187, 187, 188, 188,
1971 188, 189, 189, 189, 189, 189, 190, 190, 190, 191,
1972 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1973 192, 192, 192, 192, 192, 192, 193, 193, 194, 194,
1974 194, 194, 194, 194, 195, 195, 196, 196, 197, 197,
1975 198, 198, 199, 200, 200, 201, 201, 202, 202, 203,
1976 203, 203, 203, 203, 203, 203, 204, 204, 204, 204,
1977 204, 204, 204, 204, 204, 204, 204, 204, 204, 205,
1978 206, 206, 207, 207, 208, 208, 208, 208, 209, 209,
1979 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1980 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1981 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
1982 211, 211, 211, 211, 212, 212, 213, 213, 214, 214,
1983 215, 215, 216, 216, 217, 217, 219, 218, 220, 218,
1984 218, 218, 218, 221, 218, 222, 218, 223, 218, 218,
1985 218, 218, 224, 225, 225, 226, 227, 227, 227, 228,
1986 228, 229, 229, 229, 229, 230, 231, 231, 232, 233,
1987 233, 234, 235, 236, 236, 237, 237, 237, 237, 237,
1988 237, 237, 237, 237, 237, 237, 238, 238, 238, 238,
1989 239, 239, 240, 241, 241, 242, 242, 243, 244, 244,
1990 244, 245, 245, 245, 245, 245, 245, 245, 245, 245,
1991 246, 246, 247, 248, 248, 249, 249, 249, 249, 249,
1992 250, 250, 251, 251, 252, 252, 252, 252, 252, 252,
1993 252, 252, 252, 252, 252, 252, 252, 252, 252, 253,
1994 253, 254, 254, 254, 254, 254, 254, 254, 254, 254,
1998 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1999 static const yytype_uint8 yyr2[] =
2001 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2002 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2003 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2004 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2005 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2006 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2007 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2008 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
2009 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2010 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2011 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2012 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2013 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2014 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2015 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2016 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2017 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2018 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2019 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2020 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2021 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2022 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2023 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2024 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2025 3, 1, 3, 1, 0, 10, 1, 1, 4, 1,
2026 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2027 1, 1, 1, 3, 1, 5, 1, 1, 1, 1,
2028 1, 1, 2, 1, 3, 2, 2, 3, 2, 0,
2029 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
2030 6, 5, 2, 6, 7, 4, 4, 6, 6, 0,
2031 0, 3, 2, 1, 5, 5, 6, 6, 6, 6,
2032 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
2033 0, 3, 6, 3, 6, 2, 5, 7, 5, 4,
2037 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2038 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2039 means the default is an error. */
2040 static const yytype_uint16 yydefact[] =
2042 73, 61, 70, 62, 71, 63, 218, 216, 0, 0,
2043 0, 0, 0, 0, 84, 72, 0, 73, 214, 88,
2044 91, 0, 0, 230, 0, 0, 68, 0, 74, 75,
2045 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
2046 87, 84, 84, 209, 1, 215, 89, 90, 84, 219,
2047 92, 93, 94, 95, 84, 279, 217, 279, 0, 0,
2048 238, 231, 232, 220, 266, 267, 222, 139, 140, 141,
2049 144, 143, 142, 145, 146, 0, 0, 0, 0, 268,
2050 269, 147, 221, 149, 209, 209, 96, 208, 0, 99,
2051 99, 280, 276, 69, 249, 250, 251, 275, 233, 234,
2052 237, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2053 0, 0, 167, 0, 0, 0, 98, 97, 0, 206,
2054 207, 0, 0, 100, 101, 102, 103, 104, 0, 252,
2055 0, 320, 278, 0, 235, 166, 116, 162, 164, 0,
2056 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
2057 0, 161, 0, 160, 0, 229, 139, 140, 141, 144,
2058 143, 142, 0, 0, 67, 67, 105, 0, 246, 247,
2059 248, 319, 303, 0, 0, 0, 0, 99, 288, 289,
2060 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2061 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2062 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2063 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
2064 0, 0, 0, 0, 0, 0, 0, 277, 99, 292,
2065 0, 318, 236, 159, 0, 124, 67, 67, 158, 0,
2066 169, 0, 124, 67, 67, 0, 210, 187, 188, 183,
2067 185, 184, 186, 189, 182, 178, 179, 0, 0, 0,
2068 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2069 0, 0, 0, 0, 0, 181, 180, 223, 0, 302,
2070 282, 67, 273, 281, 0, 0, 55, 0, 0, 29,
2071 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2072 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2073 43, 44, 45, 46, 47, 48, 0, 0, 0, 130,
2074 130, 325, 67, 67, 316, 0, 0, 0, 0, 0,
2075 67, 67, 67, 67, 67, 0, 0, 0, 0, 0,
2076 107, 109, 108, 106, 110, 111, 112, 113, 114, 117,
2077 165, 163, 152, 153, 154, 157, 66, 151, 225, 227,
2078 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2079 0, 0, 171, 205, 0, 0, 0, 175, 0, 172,
2080 0, 0, 0, 135, 244, 255, 256, 257, 262, 258,
2081 259, 260, 261, 253, 0, 264, 271, 270, 272, 0,
2082 0, 283, 0, 0, 67, 67, 67, 67, 0, 321,
2083 0, 323, 300, 0, 0, 0, 0, 0, 0, 0,
2084 0, 300, 0, 0, 0, 0, 0, 67, 0, 115,
2085 121, 120, 118, 119, 122, 123, 125, 135, 135, 0,
2086 0, 0, 0, 0, 300, 0, 0, 0, 0, 300,
2087 0, 0, 170, 156, 168, 0, 173, 174, 0, 0,
2088 0, 0, 224, 243, 116, 241, 0, 254, 0, 0,
2089 274, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 0, 329, 0, 0, 0, 312, 313, 0, 0, 0,
2091 330, 0, 0, 0, 310, 0, 130, 0, 226, 228,
2092 67, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2093 0, 0, 204, 177, 0, 0, 0, 0, 0, 0,
2094 137, 135, 65, 0, 124, 0, 263, 0, 0, 299,
2095 0, 0, 0, 0, 130, 131, 130, 0, 0, 0,
2096 0, 0, 0, 328, 67, 304, 305, 299, 0, 326,
2097 67, 211, 0, 0, 0, 0, 191, 0, 0, 0,
2098 0, 202, 300, 176, 0, 0, 67, 132, 138, 136,
2099 64, 240, 242, 116, 133, 0, 0, 0, 116, 116,
2100 0, 306, 307, 308, 309, 322, 324, 301, 0, 0,
2101 311, 314, 315, 300, 0, 130, 0, 0, 0, 0,
2102 0, 199, 0, 0, 0, 193, 194, 190, 65, 134,
2103 128, 265, 0, 0, 0, 0, 124, 0, 293, 0,
2104 331, 124, 327, 195, 196, 197, 198, 0, 0, 0,
2105 203, 239, 0, 126, 0, 286, 0, 0, 107, 109,
2106 116, 116, 0, 116, 116, 294, 317, 192, 200, 201,
2107 129, 0, 245, 284, 0, 285, 0, 296, 295, 0,
2108 0, 0, 127, 0, 0, 0, 116, 116, 0, 0,
2109 0, 298, 297, 291, 0, 0, 290, 0, 287
2112 /* YYDEFGOTO[NTERM-NUM]. */
2113 static const yytype_int16 yydefgoto[] =
2115 -1, 272, 273, 274, 299, 316, 162, 163, 79, 571,
2116 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
2117 118, 128, 349, 233, 436, 352, 652, 633, 409, 520,
2118 610, 462, 521, 81, 164, 137, 154, 138, 139, 110,
2119 373, 395, 374, 121, 88, 155, 16, 17, 18, 20,
2120 19, 383, 437, 438, 63, 23, 61, 101, 465, 466,
2121 129, 170, 55, 96, 56, 49, 468, 396, 83, 398,
2122 282, 283, 57, 92, 93, 227, 637, 132, 324, 580,
2123 481, 228, 229, 230, 231
2126 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2128 #define YYPACT_NINF -578
2129 static const yytype_int16 yypact[] =
2131 348, -578, -578, -578, -578, -578, -578, -578, 42, -145,
2132 -8, -70, 59, -15, -2, -578, 154, 1288, -578, 155,
2133 317, 4, 24, -578, -4, 157, -578, 1678, -578, -578,
2134 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2135 -578, 133, 133, 203, -578, -578, -578, -578, 133, -578,
2136 -578, -578, -578, -578, 133, 183, -578, -5, 191, 194,
2137 204, -578, -578, -578, -578, -578, 73, -578, -578, -578,
2138 -578, -578, -578, -578, -578, 235, 238, 11, 244, -578,
2139 -578, -578, 87, -578, 212, 212, 261, -578, 100, 321,
2140 321, -578, -578, 250, -578, -578, -578, -578, -578, -578,
2141 -578, -47, 50, -578, 102, 107, 787, 73, -578, 87,
2142 -81, 141, 50, 129, 100, 100, -578, -578, 1362, -578,
2143 -578, 1722, 303, -578, -578, -578, -578, -578, 1780, -578,
2144 -17, 2004, -578, 302, -578, -578, 87, -578, 173, 189,
2145 1840, 1840, 181, -61, 1840, -578, 346, 200, -578, 1722,
2146 1840, 73, 195, 87, 294, -578, 79, 360, 365, 371,
2147 372, 385, 272, 388, 1425, 343, -578, 30, -578, -578,
2148 -578, -578, -578, 344, 1858, 220, 391, 321, -578, -578,
2149 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2150 -578, -578, -578, -578, -578, 668, 443, 668, 443, 1840,
2151 1840, 1840, 1840, -578, -578, -578, -578, -578, -578, -578,
2152 -578, -578, -578, -578, -578, 1840, 1840, 1840, 1840, 1840,
2153 1840, 1840, 1840, 1840, 1840, 1840, 1840, -578, 321, -578,
2154 53, -578, -578, 178, 1560, -578, -20, -27, -578, 241,
2155 87, 253, -578, 343, 16, 1362, -578, -578, -578, -578,
2156 -578, -578, -578, -578, -578, -578, -578, 668, 443, 668,
2157 443, 258, 264, 268, 275, 278, 280, 281, 1601, 1887,
2158 1046, 395, 282, 284, 287, -578, -578, -578, 288, -578,
2159 73, 996, -578, 266, 1140, 1140, -578, 1140, 1780, -578,
2160 -578, -578, -578, -578, -578, -578, -578, -578, -578, 1840,
2161 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2162 -578, -578, -578, -578, -578, -578, 1840, 1840, 1840, 68,
2163 85, -578, 996, -25, 271, 286, 289, 290, 291, 299,
2164 996, 996, 996, 996, 996, 408, 1780, 1840, 1840, 455,
2165 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2166 -578, -578, 188, -578, -578, -578, -578, 188, -578, 129,
2167 409, 304, 305, 306, 308, 1722, 1722, 1722, 1722, 1722,
2168 1722, 1722, -578, -578, 89, 1087, -58, -578, -48, -578,
2169 1722, 1722, 1722, 313, 1619, -578, -578, -578, -578, -578,
2170 -578, -578, -578, 412, 1722, -578, -578, -578, -578, 1840,
2171 315, -578, 316, 1140, 996, 996, 996, 996, 27, -578,
2172 37, -578, -578, 1140, 322, 1840, 1840, 1840, 1840, 1840,
2173 319, -578, 324, 326, 327, 1840, 1140, 996, 329, -578,
2174 -578, -578, -578, -578, -578, -578, -578, 313, 313, 1840,
2175 1722, 1722, 1722, 1722, -578, 330, 331, 333, 335, -578,
2176 336, 1722, -578, 332, 1274, -40, -578, -578, 337, 341,
2177 463, 21, -578, -578, 87, 345, 349, -578, 480, 22,
2178 -578, 488, 490, 352, 350, 351, 353, 354, 1140, 513,
2179 1140, 359, 361, 1140, 364, 87, -578, 366, 373, 515,
2180 359, 1840, 1140, 1140, 87, 368, 375, 1840, -578, -578,
2181 -1, 376, 377, 380, 381, 147, 1722, 1722, 1722, 1722,
2182 176, 1722, -578, -578, 392, 1722, 1722, 1840, 519, 538,
2183 -578, 313, 274, 1660, -578, 398, -578, 1140, 1140, 1905,
2184 1140, 1140, 1140, 1140, 375, -578, 375, 1840, 1140, 400,
2185 1840, 1840, 1840, -578, 996, -578, -578, 1905, 506, -578,
2186 996, -578, 1722, 1722, 1722, 1722, -578, 402, 405, 406,
2187 407, -578, -578, -578, 410, 413, 49, -578, -578, -578,
2188 -578, -578, -578, 87, -16, 547, 414, 419, 90, 87,
2189 206, -578, -578, -578, -578, -578, -578, -578, 411, 1140,
2190 -578, -578, -578, -578, 269, 375, 415, 417, 425, 427,
2191 1722, -578, 1722, 1722, 276, -578, -578, -578, 274, -578,
2192 517, -578, 568, 1, 849, 849, -578, 1946, -578, 422,
2193 359, -578, -578, -578, -578, -578, -578, 430, 431, 432,
2194 -578, -578, 586, 444, 1140, -578, 621, 3, 442, 447,
2195 -578, -578, 18, 90, 87, -578, 188, -578, -578, -578,
2196 -578, 577, -578, -578, 441, -578, 621, 178, 178, 587,
2197 849, 849, -578, 588, 448, 1140, -578, -578, 1140, 589,
2198 539, 178, 178, -578, 1140, 594, -578, 1140, -578
2201 /* YYPGOTO[NTERM-NUM]. */
2202 static const yytype_int16 yypgoto[] =
2204 -578, 482, 484, 485, -163, -161, -174, -578, 0, 12,
2205 -97, 525, 10, -578, -578, -578, -578, 267, -578, -578,
2206 -578, -138, -578, -457, -578, -239, -578, -578, -311, 45,
2207 -578, -412, -578, -578, -26, 387, -122, -578, 510, 521,
2208 86, -159, -237, 222, 257, 383, -578, -578, 612, -578,
2209 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2210 541, -578, -578, -578, -578, -578, -578, -577, -51, 246,
2211 -197, -578, -578, 575, -578, -578, -578, -578, -578, 88,
2212 -413, -578, -578, -578, -578
2215 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2216 positive, shift that token. If negative, reduce the rule which
2217 number is the opposite. If zero, do what YYDEFACT says.
2218 If YYTABLE_NINF, syntax error. */
2219 #define YYTABLE_NINF -214
2220 static const yytype_int16 yytable[] =
2222 11, 82, 287, 357, 321, 275, 167, 522, 490, 411,
2223 13, 168, 286, 24, 286, 105, 91, 11, 518, 325,
2224 326, 327, 328, 329, 94, 498, 499, 13, 111, 335,
2225 111, 505, 376, 378, 317, 111, 510, 318, 478, 288,
2226 29, 30, 31, 32, 33, 34, 35, 36, 480, 37,
2227 2, 25, 109, 4, 111, 518, 659, 64, 65, 654,
2228 107, 67, 68, 69, 70, 71, 72, 73, 277, 1,
2229 2, 111, 3, 4, 5, 519, 136, 27, 144, 664,
2230 109, 479, -55, -55, -55, -55, 136, 145, 26, 135,
2231 336, 479, 153, 11, 361, 21, 363, 362, 144, 364,
2232 74, 451, 153, 246, 111, 247, 248, 239, 456, 569,
2233 22, 451, 133, 276, 236, 237, 608, 134, 240, 451,
2234 457, 614, 615, 111, 244, 430, 431, 432, 514, 112,
2235 433, 112, 119, 120, 434, 435, 112, 413, 455, 354,
2236 111, 428, 111, 28, 353, -145, 358, 359, 281, 604,
2237 169, 38, 39, 40, 44, 112, 551, 469, 60, 430,
2238 431, 432, 58, 95, 433, 635, 403, 655, 434, 435,
2239 337, 338, 112, 319, 320, 281, 322, 278, 106, 62,
2240 620, 451, 59, 657, 658, 549, 660, 661, 526, 323,
2241 281, 281, 281, 281, 281, 330, 331, 332, 333, 334,
2242 281, 46, 470, 47, 91, 112, 607, 165, 136, 671,
2243 672, 75, 76, 98, 426, 77, 99, 78, 484, 153,
2244 486, 487, 488, 585, 112, 586, 100, 408, -67, 102,
2245 397, 284, 339, 397, 397, 243, 397, 285, 86, 103,
2246 87, 112, 104, 112, 410, -67, -145, -67, 451, 87,
2247 -145, 64, 65, 452, 107, 67, 68, 69, 70, 71,
2248 72, 73, 153, 1, 2, 140, 3, 4, 5, 1,
2249 141, 397, 3, 404, 5, 249, 250, 251, 252, 397,
2250 397, 397, 397, 397, 622, 574, 38, 39, 40, 148,
2251 405, 406, 407, 1, 74, 275, 3, 146, 5, 340,
2252 341, 64, 65, 116, 556, 117, 537, 166, 84, 85,
2253 153, 427, 281, 1, 2, 89, 3, 4, 5, 342,
2254 343, 90, 344, 345, 232, 346, 347, 348, 339, 430,
2255 431, 432, 234, 561, 433, 537, 149, 150, 434, 435,
2256 587, 114, 115, 590, 591, 592, 235, 238, -213, 454,
2257 241, 245, 397, 397, 397, 397, 397, 242, 464, 50,
2258 51, 52, 397, 616, 53, 617, -69, 1, 2, -56,
2259 3, 4, 5, 281, -57, 397, 397, 642, 6, 7,
2260 -60, -59, 646, 122, 123, 124, 125, 126, 127, 281,
2261 485, 281, 281, 281, -58, 340, 341, 253, 111, 494,
2262 8, 279, 286, 276, 9, 75, 76, 355, 10, 77,
2263 356, 78, 108, 500, 365, 342, 343, 379, 344, 345,
2264 366, 346, 347, 348, 367, 399, 621, 397, 617, 397,
2265 414, 368, 397, 630, 369, 537, 370, 371, 380, 636,
2266 381, 397, 397, 382, 384, 415, 425, 439, 416, 417,
2267 418, 444, 445, 446, 447, 448, 449, 450, 419, 429,
2268 440, 441, 442, 656, 443, 544, 458, 459, 460, 300,
2269 301, 550, 461, 467, 471, 472, 397, 397, 489, 397,
2270 397, 397, 397, 491, 483, 492, 493, 397, 497, 506,
2271 507, 566, 508, 397, 509, 511, 515, 573, 513, 397,
2272 516, 517, 525, 579, 523, 527, 524, 528, 529, 530,
2273 531, 281, 532, 533, 281, 281, 281, 535, 537, 543,
2274 538, 579, 570, 540, 547, 541, 501, 502, 503, 504,
2275 400, 401, 542, 402, 548, 552, 553, 512, 397, 554,
2276 555, 567, 568, 302, 303, 304, 305, 306, 307, 308,
2277 309, 310, 311, 312, 313, 314, 315, 575, 563, 589,
2278 479, 600, 601, 397, 397, 602, 603, 605, 412, 611,
2279 606, 632, 623, 612, 624, 618, 420, 421, 422, 423,
2280 424, 613, 625, 397, 626, 634, 645, 647, 648, 649,
2281 650, 644, 557, 558, 559, 560, 651, 562, -18, 662,
2282 663, 564, 565, -19, 665, 668, 674, 669, 570, 397,
2283 397, 677, 675, 224, 397, 225, 226, 397, 131, 609,
2284 631, 351, 147, 397, 385, 386, 397, 143, 360, 45,
2285 387, 130, 97, 0, 0, 594, 0, 0, 596, 597,
2286 598, 599, 0, 0, 0, 0, 388, 389, 390, 473,
2287 474, 475, 476, 477, 0, 0, 0, 0, 0, 482,
2288 0, 391, 392, 0, 0, 0, 0, 0, 0, 0,
2289 0, 0, 495, 496, 0, 0, 0, 0, 0, 0,
2290 393, 0, 0, 0, 0, 0, 627, 0, 628, 629,
2291 0, 0, 0, 0, 0, 0, 180, 181, 182, 183,
2292 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2293 194, 257, 258, 259, 260, 0, 0, 0, 0, 0,
2294 0, 0, 0, 0, 534, 0, 536, 0, 0, 539,
2295 0, 0, 0, 0, 0, 0, 0, 0, 545, 546,
2296 261, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2297 212, 213, 214, 0, 262, 0, 263, 264, 265, 0,
2298 266, 267, 289, 290, 291, 292, 293, 294, 295, 296,
2299 297, 298, 0, 576, 577, 0, 581, 582, 583, 584,
2300 0, 0, 0, 0, 588, 0, 394, 0, 0, 0,
2301 593, 0, 0, 0, 64, 65, 595, 107, 67, 68,
2302 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2303 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2305 0, 0, 0, 0, 0, 619, 0, 74, 0, 0,
2306 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2307 0, 0, 385, 386, 0, 0, 64, 65, 387, 0,
2308 640, 641, 0, 0, 0, 0, 0, 0, 1, 2,
2309 0, 3, 4, 5, 388, 389, 390, 0, 0, 0,
2310 653, 0, 0, 0, 0, 0, 0, 0, 0, 391,
2311 392, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2312 0, 0, 0, 339, 0, 0, 666, 667, 393, 0,
2313 0, 670, 0, 0, 673, 0, 0, 0, 0, 0,
2314 676, 0, 0, 678, 180, 181, 182, 183, 184, 185,
2315 186, 187, 188, 189, 190, 191, 192, 193, 194, 257,
2316 258, 259, 260, 0, 0, 0, 0, 0, 75, 76,
2317 0, 0, 77, 0, 78, 142, 0, 0, 0, 0,
2318 0, 0, 0, 0, 0, 0, 0, 0, 261, 203,
2319 638, 639, 206, 207, 208, 209, 210, 211, 212, 213,
2320 214, 0, 262, 0, 263, 264, 265, 0, 266, 267,
2321 342, 343, 0, 344, 345, 0, 346, 347, 348, 385,
2322 386, 0, 0, 64, 65, 387, 0, 0, 0, 0,
2323 0, 0, 0, 0, 394, 1, 2, 0, 3, 4,
2324 5, 388, 389, 390, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 0, 0, 0, 391, 392, 0, 0,
2326 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2327 0, 111, 0, 64, 65, 393, 107, 156, 157, 158,
2328 159, 160, 161, 73, 0, 1, 2, 0, 3, 4,
2329 5, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2330 189, 190, 191, 192, 193, 194, 257, 258, 259, 260,
2331 0, 0, 0, 0, 64, 65, 74, 107, 156, 157,
2332 158, 159, 160, 161, 73, 0, 1, 2, 0, 3,
2333 4, 5, 0, 0, 0, 261, 203, 204, 205, 206,
2334 207, 208, 209, 210, 211, 212, 213, 214, 0, 262,
2335 0, 263, 264, 265, 0, 266, 267, 74, 0, 0,
2336 0, 0, 0, 385, 386, 0, 0, 64, 65, 387,
2337 0, 0, 112, 0, 0, 0, 0, 0, 0, 1,
2338 2, 394, 3, 4, 5, 388, 389, 390, 0, 0,
2339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2340 391, 392, 0, 0, 0, 0, 0, 0, 0, 0,
2341 0, 0, 0, 0, 0, 0, 0, 0, 0, 393,
2342 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2343 0, 77, 0, 78, 377, 180, 181, 182, 183, 184,
2344 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2345 257, 258, 259, 260, 0, 0, 0, 0, 0, 0,
2346 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2347 0, 0, 77, 0, 78, 453, 0, 0, 0, 261,
2348 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2349 213, 214, 0, 262, 0, 263, 264, 265, 0, 266,
2350 267, 64, 65, 0, 0, 0, 0, 0, -212, 0,
2351 0, 0, 0, 1, 2, 0, 3, 4, 5, 254,
2352 0, 0, 0, 0, 0, 394, -69, 1, 2, 0,
2353 3, 4, 5, 0, 255, 256, 0, 0, 6, 7,
2354 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2355 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2356 8, 0, 0, 0, 9, 0, 0, 0, 10, 180,
2357 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2358 191, 192, 193, 194, 257, 258, 259, 260, 0, 64,
2359 65, 0, 151, 67, 68, 69, 70, 71, 72, 73,
2360 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2361 0, 0, 0, 261, 203, 204, 205, 206, 207, 208,
2362 209, 210, 211, 212, 213, 214, 0, 262, 0, 263,
2363 264, 265, 74, 266, 267, 0, 0, 0, 0, 0,
2364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2365 112, 0, 64, 65, -67, 0, 268, 0, 0, 269,
2366 0, 270, 0, 271, 1, 2, 0, 3, 4, 5,
2367 254, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2368 0, 0, 0, 0, 0, 255, 256, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2370 111, 0, 0, 0, 0, 0, 0, 152, 0, 0,
2371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2372 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2373 190, 191, 192, 193, 194, 257, 258, 259, 260, 0,
2374 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 261, 203, 204, 205, 206, 207,
2377 208, 209, 210, 211, 212, 213, 214, 0, 262, 0,
2378 263, 264, 265, 0, 266, 267, 0, 64, 65, 0,
2379 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2380 2, 112, 3, 4, 5, 0, 0, 268, 0, 0,
2381 269, 0, 270, 0, 271, 0, 0, 0, 0, 350,
2382 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2383 74, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2384 1, 2, 0, 3, 4, 5, 64, 65, 0, 107,
2385 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2386 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2387 0, 74, 0, 0, 0, 0, 0, 0, 463, 0,
2388 0, 0, 0, 0, 0, 0, 0, 64, 65, 74,
2389 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2390 2, 0, 3, 4, 5, 64, 65, 0, 66, 67,
2391 68, 69, 70, 71, 72, 73, 0, 1, 2, 572,
2392 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2393 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2394 0, 75, 76, 0, 0, 77, 0, 78, 74, 64,
2395 65, 0, 107, 156, 157, 158, 159, 160, 161, 73,
2396 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2398 0, 0, 75, 76, 0, 372, 77, 0, 78, 0,
2399 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2400 75, 76, 0, 0, 77, 0, 78, 64, 65, 0,
2401 151, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2402 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2404 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2405 74, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2406 76, 0, 0, 77, 0, 78, 0, 64, 65, 0,
2407 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2408 2, 0, 3, 4, 5, 64, 65, 0, 280, 67,
2409 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2410 3, 4, 5, 75, 76, 0, 0, 77, 0, 78,
2411 74, 0, 0, 0, 64, 65, 0, 107, 156, 157,
2412 158, 159, 160, 161, 73, 0, 1, 2, 74, 3,
2413 4, 5, 64, 65, 0, 107, 67, 68, 69, 70,
2414 71, 72, 578, 0, 1, 2, 0, 3, 4, 5,
2415 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2416 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2417 0, 0, 0, 64, 65, 74, 107, 67, 68, 69,
2418 70, 71, 72, 643, 0, 1, 2, 0, 3, 4,
2419 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2420 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2421 0, 0, 0, 0, 0, 0, 74, 0, 0, 0,
2422 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2423 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2424 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2426 171, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2427 0, 0, 77, 0, 375, 0, 0, 0, 0, 0,
2428 0, 172, 173, 0, 0, 0, 75, 76, 0, 0,
2429 77, 0, 78, 174, 175, 176, 177, 178, 179, 180,
2430 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2431 191, 192, 193, 194, 195, 196, 197, 198, 0, 0,
2432 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2433 0, 77, 0, 78, 0, 0, 0, 0, 199, 200,
2434 201, 0, 0, 202, 203, 204, 205, 206, 207, 208,
2435 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
2436 219, 220, 221, 222, 223
2439 static const yytype_int16 yycheck[] =
2441 0, 27, 176, 242, 201, 164, 128, 464, 421, 320,
2442 0, 28, 11, 158, 11, 4, 21, 17, 34, 216,
2443 217, 218, 219, 220, 29, 437, 438, 17, 55, 226,
2444 55, 444, 269, 270, 197, 55, 449, 198, 11, 177,
2445 42, 43, 44, 45, 46, 47, 48, 49, 11, 51,
2446 20, 59, 78, 23, 55, 34, 38, 7, 8, 636,
2447 10, 11, 12, 13, 14, 15, 16, 17, 165, 19,
2448 20, 55, 22, 23, 24, 54, 102, 18, 159, 656,
2449 106, 54, 3, 4, 5, 6, 112, 168, 158, 39,
2450 228, 54, 118, 93, 257, 53, 259, 258, 159, 260,
2451 50, 159, 128, 154, 55, 26, 27, 168, 166, 521,
2452 68, 159, 159, 164, 140, 141, 573, 164, 144, 159,
2453 168, 578, 579, 55, 150, 141, 142, 143, 168, 156,
2454 146, 156, 32, 33, 150, 151, 156, 162, 375, 166,
2455 55, 338, 55, 158, 164, 55, 243, 244, 174, 562,
2456 167, 153, 154, 155, 0, 156, 157, 394, 162, 141,
2457 142, 143, 158, 168, 146, 164, 288, 164, 150, 151,
2458 117, 118, 156, 199, 200, 201, 202, 167, 167, 22,
2459 593, 159, 158, 640, 641, 496, 643, 644, 166, 215,
2460 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
2461 226, 46, 399, 48, 21, 156, 157, 121, 234, 666,
2462 667, 161, 162, 22, 336, 165, 22, 167, 415, 245,
2463 417, 418, 419, 534, 156, 536, 22, 159, 160, 156,
2464 281, 11, 54, 284, 285, 149, 287, 17, 35, 4,
2465 37, 156, 4, 156, 159, 160, 156, 160, 159, 37,
2466 160, 7, 8, 164, 10, 11, 12, 13, 14, 15,
2467 16, 17, 288, 19, 20, 163, 22, 23, 24, 19,
2468 163, 322, 22, 299, 24, 3, 4, 5, 6, 330,
2469 331, 332, 333, 334, 595, 524, 153, 154, 155, 160,
2470 316, 317, 318, 19, 50, 454, 22, 156, 24, 121,
2471 122, 7, 8, 42, 157, 44, 159, 4, 41, 42,
2472 336, 337, 338, 19, 20, 48, 22, 23, 24, 141,
2473 142, 54, 144, 145, 22, 147, 148, 149, 54, 141,
2474 142, 143, 159, 157, 146, 159, 114, 115, 150, 151,
2475 537, 84, 85, 540, 541, 542, 157, 166, 0, 375,
2476 4, 156, 403, 404, 405, 406, 407, 157, 384, 42,
2477 43, 44, 413, 157, 47, 159, 18, 19, 20, 9,
2478 22, 23, 24, 399, 9, 426, 427, 616, 30, 31,
2479 9, 9, 621, 62, 63, 64, 65, 66, 67, 415,
2480 416, 417, 418, 419, 9, 121, 122, 9, 55, 425,
2481 52, 57, 11, 454, 56, 161, 162, 166, 60, 165,
2482 157, 167, 168, 439, 156, 141, 142, 22, 144, 145,
2483 156, 147, 148, 149, 156, 159, 157, 478, 159, 480,
2484 159, 156, 483, 157, 156, 159, 156, 156, 156, 613,
2485 156, 492, 493, 156, 156, 159, 38, 38, 159, 159,
2486 159, 365, 366, 367, 368, 369, 370, 371, 159, 4,
2487 156, 156, 156, 637, 156, 491, 380, 381, 382, 26,
2488 27, 497, 159, 61, 159, 159, 527, 528, 159, 530,
2489 531, 532, 533, 159, 162, 159, 159, 538, 159, 159,
2490 159, 517, 159, 544, 159, 159, 159, 523, 166, 550,
2491 159, 38, 22, 529, 159, 17, 157, 17, 156, 159,
2492 159, 537, 159, 159, 540, 541, 542, 4, 159, 4,
2493 159, 547, 522, 159, 156, 159, 440, 441, 442, 443,
2494 284, 285, 159, 287, 159, 159, 159, 451, 589, 159,
2495 159, 22, 4, 100, 101, 102, 103, 104, 105, 106,
2496 107, 108, 109, 110, 111, 112, 113, 159, 166, 159,
2497 54, 159, 157, 614, 615, 159, 159, 157, 322, 22,
2498 157, 54, 157, 159, 157, 164, 330, 331, 332, 333,
2499 334, 162, 157, 634, 157, 17, 164, 157, 157, 157,
2500 4, 617, 506, 507, 508, 509, 152, 511, 156, 22,
2501 159, 515, 516, 156, 17, 17, 17, 159, 608, 660,
2502 661, 17, 73, 131, 665, 131, 131, 668, 93, 574,
2503 608, 234, 112, 674, 3, 4, 677, 106, 245, 17,
2504 9, 90, 57, -1, -1, 547, -1, -1, 552, 553,
2505 554, 555, -1, -1, -1, -1, 25, 26, 27, 403,
2506 404, 405, 406, 407, -1, -1, -1, -1, -1, 413,
2507 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2508 -1, -1, 426, 427, -1, -1, -1, -1, -1, -1,
2509 59, -1, -1, -1, -1, -1, 600, -1, 602, 603,
2510 -1, -1, -1, -1, -1, -1, 75, 76, 77, 78,
2511 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2512 89, 90, 91, 92, 93, -1, -1, -1, -1, -1,
2513 -1, -1, -1, -1, 478, -1, 480, -1, -1, 483,
2514 -1, -1, -1, -1, -1, -1, -1, -1, 492, 493,
2515 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2516 129, 130, 131, -1, 133, -1, 135, 136, 137, -1,
2517 139, 140, 94, 95, 96, 97, 98, 99, 100, 101,
2518 102, 103, -1, 527, 528, -1, 530, 531, 532, 533,
2519 -1, -1, -1, -1, 538, -1, 165, -1, -1, -1,
2520 544, -1, -1, -1, 7, 8, 550, 10, 11, 12,
2521 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2522 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2523 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2524 -1, -1, -1, -1, -1, 589, -1, 50, -1, -1,
2525 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2526 -1, -1, 3, 4, -1, -1, 7, 8, 9, -1,
2527 614, 615, -1, -1, -1, -1, -1, -1, 19, 20,
2528 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2529 634, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2530 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2531 -1, -1, -1, 54, -1, -1, 660, 661, 59, -1,
2532 -1, 665, -1, -1, 668, -1, -1, -1, -1, -1,
2533 674, -1, -1, 677, 75, 76, 77, 78, 79, 80,
2534 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2535 91, 92, 93, -1, -1, -1, -1, -1, 161, 162,
2536 -1, -1, 165, -1, 167, 168, -1, -1, -1, -1,
2537 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2538 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2539 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2540 141, 142, -1, 144, 145, -1, 147, 148, 149, 3,
2541 4, -1, -1, 7, 8, 9, -1, -1, -1, -1,
2542 -1, -1, -1, -1, 165, 19, 20, -1, 22, 23,
2543 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2544 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2545 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2546 -1, 55, -1, 7, 8, 59, 10, 11, 12, 13,
2547 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2548 24, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2549 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2550 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2551 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2552 23, 24, -1, -1, -1, 119, 120, 121, 122, 123,
2553 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2554 -1, 135, 136, 137, -1, 139, 140, 50, -1, -1,
2555 -1, -1, -1, 3, 4, -1, -1, 7, 8, 9,
2556 -1, -1, 156, -1, -1, -1, -1, -1, -1, 19,
2557 20, 165, 22, 23, 24, 25, 26, 27, -1, -1,
2558 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2559 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2560 -1, -1, -1, -1, -1, -1, -1, -1, -1, 59,
2561 -1, -1, -1, -1, -1, -1, -1, 161, 162, -1,
2562 -1, 165, -1, 167, 168, 75, 76, 77, 78, 79,
2563 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2564 90, 91, 92, 93, -1, -1, -1, -1, -1, -1,
2565 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2566 -1, -1, 165, -1, 167, 168, -1, -1, -1, 119,
2567 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2568 130, 131, -1, 133, -1, 135, 136, 137, -1, 139,
2569 140, 7, 8, -1, -1, -1, -1, -1, 0, -1,
2570 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
2571 -1, -1, -1, -1, -1, 165, 18, 19, 20, -1,
2572 22, 23, 24, -1, 40, 41, -1, -1, 30, 31,
2573 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
2574 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2575 52, -1, -1, -1, 56, -1, -1, -1, 60, 75,
2576 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2577 86, 87, 88, 89, 90, 91, 92, 93, -1, 7,
2578 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2579 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2580 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2581 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2582 136, 137, 50, 139, 140, -1, -1, -1, -1, -1,
2583 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2584 156, -1, 7, 8, 160, -1, 162, -1, -1, 165,
2585 -1, 167, -1, 169, 19, 20, -1, 22, 23, 24,
2586 25, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2587 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2588 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2589 55, -1, -1, -1, -1, -1, -1, 125, -1, -1,
2590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2591 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2592 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2593 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2594 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2595 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2596 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2597 135, 136, 137, -1, 139, 140, -1, 7, 8, -1,
2598 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2599 20, 156, 22, 23, 24, -1, -1, 162, -1, -1,
2600 165, -1, 167, -1, 169, -1, -1, -1, -1, 39,
2601 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2602 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2603 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2604 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2605 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2606 -1, 50, -1, -1, -1, -1, -1, -1, 39, -1,
2607 -1, -1, -1, -1, -1, -1, -1, 7, 8, 50,
2608 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2609 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2610 12, 13, 14, 15, 16, 17, -1, 19, 20, 39,
2611 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2612 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2613 -1, 161, 162, -1, -1, 165, -1, 167, 50, 7,
2614 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2615 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2616 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2617 -1, -1, 161, 162, -1, 164, 165, -1, 167, -1,
2618 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2619 161, 162, -1, -1, 165, -1, 167, 7, 8, -1,
2620 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2621 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2622 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2623 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2624 50, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2625 162, -1, -1, 165, -1, 167, -1, 7, 8, -1,
2626 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2627 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2628 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2629 22, 23, 24, 161, 162, -1, -1, 165, -1, 167,
2630 50, -1, -1, -1, 7, 8, -1, 10, 11, 12,
2631 13, 14, 15, 16, 17, -1, 19, 20, 50, 22,
2632 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2633 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2634 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2635 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2636 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2637 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2638 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2639 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2640 -1, -1, -1, -1, -1, -1, 50, -1, -1, -1,
2641 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2642 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2643 162, -1, -1, 165, -1, 167, -1, -1, -1, -1,
2644 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2645 36, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2646 -1, -1, 165, -1, 167, -1, -1, -1, -1, -1,
2647 -1, 57, 58, -1, -1, -1, 161, 162, -1, -1,
2648 165, -1, 167, 69, 70, 71, 72, 73, 74, 75,
2649 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2650 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2651 -1, -1, -1, -1, -1, -1, -1, 161, 162, -1,
2652 -1, 165, -1, 167, -1, -1, -1, -1, 114, 115,
2653 116, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2654 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2655 136, 137, 138, 139, 140
2658 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2659 symbol of state STATE-NUM. */
2660 static const yytype_uint8 yystos[] =
2662 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
2663 60, 178, 181, 182, 183, 184, 216, 217, 218, 220,
2664 219, 53, 68, 225, 158, 59, 158, 18, 158, 42,
2665 43, 44, 45, 46, 47, 48, 49, 51, 153, 154,
2666 155, 185, 186, 187, 0, 218, 46, 48, 188, 235,
2667 42, 43, 44, 47, 189, 232, 234, 242, 158, 158,
2668 162, 226, 22, 224, 7, 8, 10, 11, 12, 13,
2669 14, 15, 16, 17, 50, 161, 162, 165, 167, 178,
2670 182, 203, 204, 238, 187, 187, 35, 37, 214, 187,
2671 187, 21, 243, 244, 29, 168, 233, 243, 22, 22,
2672 22, 227, 156, 4, 4, 4, 167, 10, 168, 204,
2673 209, 55, 156, 180, 214, 214, 42, 44, 190, 32,
2674 33, 213, 62, 63, 64, 65, 66, 67, 191, 230,
2675 230, 181, 247, 159, 164, 39, 204, 205, 207, 208,
2676 163, 163, 168, 209, 159, 168, 156, 208, 160, 213,
2677 213, 10, 125, 204, 206, 215, 11, 12, 13, 14,
2678 15, 16, 176, 177, 204, 210, 4, 206, 28, 167,
2679 231, 36, 57, 58, 69, 70, 71, 72, 73, 74,
2680 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2681 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2682 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
2683 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2684 137, 138, 139, 140, 171, 172, 173, 245, 251, 252,
2685 253, 254, 22, 193, 159, 157, 204, 204, 166, 168,
2686 204, 4, 157, 210, 204, 156, 238, 26, 27, 3,
2687 4, 5, 6, 9, 25, 40, 41, 90, 91, 92,
2688 93, 119, 133, 135, 136, 137, 139, 140, 162, 165,
2689 167, 169, 171, 172, 173, 211, 238, 180, 182, 57,
2690 10, 204, 240, 241, 11, 17, 11, 176, 191, 94,
2691 95, 96, 97, 98, 99, 100, 101, 102, 103, 174,
2692 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2693 108, 109, 110, 111, 112, 113, 175, 174, 175, 204,
2694 204, 240, 204, 204, 248, 240, 240, 240, 240, 240,
2695 204, 204, 204, 204, 204, 240, 191, 117, 118, 54,
2696 121, 122, 141, 142, 144, 145, 147, 148, 149, 192,
2697 39, 205, 195, 164, 166, 166, 157, 195, 180, 180,
2698 215, 174, 175, 174, 175, 156, 156, 156, 156, 156,
2699 156, 156, 164, 210, 212, 167, 212, 168, 212, 22,
2700 156, 156, 156, 221, 156, 3, 4, 9, 25, 26,
2701 27, 40, 41, 59, 165, 211, 237, 238, 239, 159,
2702 239, 239, 239, 206, 204, 204, 204, 204, 159, 198,
2703 159, 198, 239, 162, 159, 159, 159, 159, 159, 159,
2704 239, 239, 239, 239, 239, 38, 206, 204, 240, 4,
2705 141, 142, 143, 146, 150, 151, 194, 222, 223, 38,
2706 156, 156, 156, 156, 210, 210, 210, 210, 210, 210,
2707 210, 159, 164, 168, 204, 212, 166, 168, 210, 210,
2708 210, 159, 201, 39, 204, 228, 229, 61, 236, 212,
2709 240, 159, 159, 239, 239, 239, 239, 239, 11, 54,
2710 11, 250, 239, 162, 240, 204, 240, 240, 240, 159,
2711 250, 159, 159, 159, 204, 239, 239, 159, 201, 201,
2712 204, 210, 210, 210, 210, 250, 159, 159, 159, 159,
2713 250, 159, 210, 166, 168, 159, 159, 38, 34, 54,
2714 199, 202, 193, 159, 157, 22, 166, 17, 17, 156,
2715 159, 159, 159, 159, 239, 4, 239, 159, 159, 239,
2716 159, 159, 159, 4, 204, 239, 239, 156, 159, 198,
2717 204, 157, 159, 159, 159, 159, 157, 210, 210, 210,
2718 210, 157, 210, 166, 210, 210, 204, 22, 4, 201,
2719 178, 179, 39, 204, 195, 159, 239, 239, 17, 204,
2720 249, 239, 239, 239, 239, 198, 198, 240, 239, 159,
2721 240, 240, 240, 239, 249, 239, 210, 210, 210, 210,
2722 159, 157, 159, 159, 250, 157, 157, 157, 193, 199,
2723 200, 22, 159, 162, 193, 193, 157, 159, 164, 239,
2724 250, 157, 198, 157, 157, 157, 157, 210, 210, 210,
2725 157, 179, 54, 197, 17, 164, 176, 246, 121, 122,
2726 239, 239, 195, 17, 204, 164, 195, 157, 157, 157,
2727 4, 152, 196, 239, 237, 164, 176, 193, 193, 38,
2728 193, 193, 22, 159, 237, 17, 239, 239, 17, 159,
2729 239, 193, 193, 239, 17, 73, 239, 17, 239
2732 #define yyerrok (yyerrstatus = 0)
2733 #define yyclearin (yychar = YYEMPTY)
2734 #define YYEMPTY (-2)
2737 #define YYACCEPT goto yyacceptlab
2738 #define YYABORT goto yyabortlab
2739 #define YYERROR goto yyerrorlab
2742 /* Like YYERROR except do call yyerror. This remains here temporarily
2743 to ease the transition to the new meaning of YYERROR, for GCC.
2744 Once GCC version 2 has supplanted version 1, this can go. */
2746 #define YYFAIL goto yyerrlab
2748 #define YYRECOVERING() (!!yyerrstatus)
2750 #define YYBACKUP(Token, Value) \
2752 if (yychar == YYEMPTY && yylen == 1) \
2756 yytoken = YYTRANSLATE (yychar); \
2762 yyerror (YY_("syntax error: cannot back up")); \
2769 #define YYERRCODE 256
2772 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2773 If N is 0, then set CURRENT to the empty location which ends
2774 the previous symbol: RHS[0] (always defined). */
2776 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2777 #ifndef YYLLOC_DEFAULT
2778 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2782 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2783 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2784 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2785 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2789 (Current).first_line = (Current).last_line = \
2790 YYRHSLOC (Rhs, 0).last_line; \
2791 (Current).first_column = (Current).last_column = \
2792 YYRHSLOC (Rhs, 0).last_column; \
2798 /* YY_LOCATION_PRINT -- Print the location on the stream.
2799 This macro was not mandated originally: define only if we know
2800 we won't break user code: when these are the locations we know. */
2802 #ifndef YY_LOCATION_PRINT
2803 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2804 # define YY_LOCATION_PRINT(File, Loc) \
2805 fprintf (File, "%d.%d-%d.%d", \
2806 (Loc).first_line, (Loc).first_column, \
2807 (Loc).last_line, (Loc).last_column)
2809 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2814 /* YYLEX -- calling `yylex' with the right arguments. */
2817 # define YYLEX yylex (YYLEX_PARAM)
2819 # define YYLEX yylex ()
2822 /* Enable debugging if requested. */
2826 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2827 # define YYFPRINTF fprintf
2830 # define YYDPRINTF(Args) \
2836 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2840 YYFPRINTF (stderr, "%s ", Title); \
2841 yy_symbol_print (stderr, \
2843 YYFPRINTF (stderr, "\n"); \
2848 /*--------------------------------.
2849 | Print this symbol on YYOUTPUT. |
2850 `--------------------------------*/
2853 #if (defined __STDC__ || defined __C99__FUNC__ \
2854 || defined __cplusplus || defined _MSC_VER)
2856 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2859 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2862 YYSTYPE const * const yyvaluep;
2868 if (yytype < YYNTOKENS)
2869 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2881 /*--------------------------------.
2882 | Print this symbol on YYOUTPUT. |
2883 `--------------------------------*/
2885 #if (defined __STDC__ || defined __C99__FUNC__ \
2886 || defined __cplusplus || defined _MSC_VER)
2888 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2891 yy_symbol_print (yyoutput, yytype, yyvaluep)
2894 YYSTYPE const * const yyvaluep;
2897 if (yytype < YYNTOKENS)
2898 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2900 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2902 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2903 YYFPRINTF (yyoutput, ")");
2906 /*------------------------------------------------------------------.
2907 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2909 `------------------------------------------------------------------*/
2911 #if (defined __STDC__ || defined __C99__FUNC__ \
2912 || defined __cplusplus || defined _MSC_VER)
2914 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2917 yy_stack_print (bottom, top)
2918 yytype_int16 *bottom;
2922 YYFPRINTF (stderr, "Stack now");
2923 for (; bottom <= top; ++bottom)
2924 YYFPRINTF (stderr, " %d", *bottom);
2925 YYFPRINTF (stderr, "\n");
2928 # define YY_STACK_PRINT(Bottom, Top) \
2931 yy_stack_print ((Bottom), (Top)); \
2935 /*------------------------------------------------.
2936 | Report that the YYRULE is going to be reduced. |
2937 `------------------------------------------------*/
2939 #if (defined __STDC__ || defined __C99__FUNC__ \
2940 || defined __cplusplus || defined _MSC_VER)
2942 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2945 yy_reduce_print (yyvsp, yyrule)
2950 int yynrhs = yyr2[yyrule];
2952 unsigned long int yylno = yyrline[yyrule];
2953 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2955 /* The symbols being reduced. */
2956 for (yyi = 0; yyi < yynrhs; yyi++)
2958 fprintf (stderr, " $%d = ", yyi + 1);
2959 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2960 &(yyvsp[(yyi + 1) - (yynrhs)])
2962 fprintf (stderr, "\n");
2966 # define YY_REDUCE_PRINT(Rule) \
2969 yy_reduce_print (yyvsp, Rule); \
2972 /* Nonzero means print parse trace. It is left uninitialized so that
2973 multiple parsers can coexist. */
2975 #else /* !YYDEBUG */
2976 # define YYDPRINTF(Args)
2977 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2978 # define YY_STACK_PRINT(Bottom, Top)
2979 # define YY_REDUCE_PRINT(Rule)
2980 #endif /* !YYDEBUG */
2983 /* YYINITDEPTH -- initial size of the parser's stacks. */
2985 # define YYINITDEPTH 200
2988 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2989 if the built-in stack extension method is used).
2991 Do not make this value too large; the results are undefined if
2992 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2993 evaluated with infinite-precision integer arithmetic. */
2996 # define YYMAXDEPTH 10000
3004 # if defined __GLIBC__ && defined _STRING_H
3005 # define yystrlen strlen
3007 /* Return the length of YYSTR. */
3008 #if (defined __STDC__ || defined __C99__FUNC__ \
3009 || defined __cplusplus || defined _MSC_VER)
3011 yystrlen (const char *yystr)
3019 for (yylen = 0; yystr[yylen]; yylen++)
3027 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3028 # define yystpcpy stpcpy
3030 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3032 #if (defined __STDC__ || defined __C99__FUNC__ \
3033 || defined __cplusplus || defined _MSC_VER)
3035 yystpcpy (char *yydest, const char *yysrc)
3038 yystpcpy (yydest, yysrc)
3044 const char *yys = yysrc;
3046 while ((*yyd++ = *yys++) != '\0')
3055 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3056 quotes and backslashes, so that it's suitable for yyerror. The
3057 heuristic is that double-quoting is unnecessary unless the string
3058 contains an apostrophe, a comma, or backslash (other than
3059 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3060 null, do not copy; instead, return the length of what the result
3063 yytnamerr (char *yyres, const char *yystr)
3068 char const *yyp = yystr;
3075 goto do_not_strip_quotes;
3079 goto do_not_strip_quotes;
3092 do_not_strip_quotes: ;
3096 return yystrlen (yystr);
3098 return yystpcpy (yyres, yystr) - yyres;
3102 /* Copy into YYRESULT an error message about the unexpected token
3103 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3104 including the terminating null byte. If YYRESULT is null, do not
3105 copy anything; just return the number of bytes that would be
3106 copied. As a special case, return 0 if an ordinary "syntax error"
3107 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3108 size calculation. */
3110 yysyntax_error (char *yyresult, int yystate, int yychar)
3112 int yyn = yypact[yystate];
3114 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3118 int yytype = YYTRANSLATE (yychar);
3119 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3120 YYSIZE_T yysize = yysize0;
3122 int yysize_overflow = 0;
3123 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3124 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3128 /* This is so xgettext sees the translatable formats that are
3129 constructed on the fly. */
3130 YY_("syntax error, unexpected %s");
3131 YY_("syntax error, unexpected %s, expecting %s");
3132 YY_("syntax error, unexpected %s, expecting %s or %s");
3133 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3134 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3138 static char const yyunexpected[] = "syntax error, unexpected %s";
3139 static char const yyexpecting[] = ", expecting %s";
3140 static char const yyor[] = " or %s";
3141 char yyformat[sizeof yyunexpected
3142 + sizeof yyexpecting - 1
3143 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3144 * (sizeof yyor - 1))];
3145 char const *yyprefix = yyexpecting;
3147 /* Start YYX at -YYN if negative to avoid negative indexes in
3149 int yyxbegin = yyn < 0 ? -yyn : 0;
3151 /* Stay within bounds of both yycheck and yytname. */
3152 int yychecklim = YYLAST - yyn + 1;
3153 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3156 yyarg[0] = yytname[yytype];
3157 yyfmt = yystpcpy (yyformat, yyunexpected);
3159 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3160 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3162 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3166 yyformat[sizeof yyunexpected - 1] = '\0';
3169 yyarg[yycount++] = yytname[yyx];
3170 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3171 yysize_overflow |= (yysize1 < yysize);
3173 yyfmt = yystpcpy (yyfmt, yyprefix);
3177 yyf = YY_(yyformat);
3178 yysize1 = yysize + yystrlen (yyf);
3179 yysize_overflow |= (yysize1 < yysize);
3182 if (yysize_overflow)
3183 return YYSIZE_MAXIMUM;
3187 /* Avoid sprintf, as that infringes on the user's name space.
3188 Don't have undefined behavior even if the translation
3189 produced a string with the wrong number of "%s"s. */
3190 char *yyp = yyresult;
3192 while ((*yyp = *yyf) != '\0')
3194 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3196 yyp += yytnamerr (yyp, yyarg[yyi++]);
3209 #endif /* YYERROR_VERBOSE */
3212 /*-----------------------------------------------.
3213 | Release the memory associated to this symbol. |
3214 `-----------------------------------------------*/
3217 #if (defined __STDC__ || defined __C99__FUNC__ \
3218 || defined __cplusplus || defined _MSC_VER)
3220 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3223 yydestruct (yymsg, yytype, yyvaluep)
3233 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3244 /* Prevent warnings from -Wmissing-prototypes. */
3246 #ifdef YYPARSE_PARAM
3247 #if defined __STDC__ || defined __cplusplus
3248 int yyparse (void *YYPARSE_PARAM);
3252 #else /* ! YYPARSE_PARAM */
3253 #if defined __STDC__ || defined __cplusplus
3258 #endif /* ! YYPARSE_PARAM */
3262 /* The look-ahead symbol. */
3265 /* The semantic value of the look-ahead symbol. */
3268 /* Number of syntax errors so far. */
3277 #ifdef YYPARSE_PARAM
3278 #if (defined __STDC__ || defined __C99__FUNC__ \
3279 || defined __cplusplus || defined _MSC_VER)
3281 yyparse (void *YYPARSE_PARAM)
3284 yyparse (YYPARSE_PARAM)
3285 void *YYPARSE_PARAM;
3287 #else /* ! YYPARSE_PARAM */
3288 #if (defined __STDC__ || defined __C99__FUNC__ \
3289 || defined __cplusplus || defined _MSC_VER)
3303 /* Number of tokens to shift before error messages enabled. */
3305 /* Look-ahead token as an internal (translated) token number. */
3308 /* Buffer for error messages, and its allocated size. */
3310 char *yymsg = yymsgbuf;
3311 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3314 /* Three stacks and their tools:
3315 `yyss': related to states,
3316 `yyvs': related to semantic values,
3317 `yyls': related to locations.
3319 Refer to the stacks thru separate pointers, to allow yyoverflow
3320 to reallocate them elsewhere. */
3322 /* The state stack. */
3323 yytype_int16 yyssa[YYINITDEPTH];
3324 yytype_int16 *yyss = yyssa;
3325 yytype_int16 *yyssp;
3327 /* The semantic value stack. */
3328 YYSTYPE yyvsa[YYINITDEPTH];
3329 YYSTYPE *yyvs = yyvsa;
3334 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3336 YYSIZE_T yystacksize = YYINITDEPTH;
3338 /* The variables used to return semantic value and location from the
3343 /* The number of symbols on the RHS of the reduced rule.
3344 Keep to zero when no symbol should be popped. */
3347 YYDPRINTF ((stderr, "Starting parse\n"));
3352 yychar = YYEMPTY; /* Cause a token to be read. */
3354 /* Initialize stack pointers.
3355 Waste one element of value and location stack
3356 so that they stay on the same level as the state stack.
3357 The wasted elements are never initialized. */
3364 /*------------------------------------------------------------.
3365 | yynewstate -- Push a new state, which is found in yystate. |
3366 `------------------------------------------------------------*/
3368 /* In all cases, when you get here, the value and location stacks
3369 have just been pushed. So pushing a state here evens the stacks. */
3375 if (yyss + yystacksize - 1 <= yyssp)
3377 /* Get the current used size of the three stacks, in elements. */
3378 YYSIZE_T yysize = yyssp - yyss + 1;
3382 /* Give user a chance to reallocate the stack. Use copies of
3383 these so that the &'s don't force the real ones into
3385 YYSTYPE *yyvs1 = yyvs;
3386 yytype_int16 *yyss1 = yyss;
3389 /* Each stack pointer address is followed by the size of the
3390 data in use in that stack, in bytes. This used to be a
3391 conditional around just the two extra args, but that might
3392 be undefined if yyoverflow is a macro. */
3393 yyoverflow (YY_("memory exhausted"),
3394 &yyss1, yysize * sizeof (*yyssp),
3395 &yyvs1, yysize * sizeof (*yyvsp),
3402 #else /* no yyoverflow */
3403 # ifndef YYSTACK_RELOCATE
3404 goto yyexhaustedlab;
3406 /* Extend the stack our own way. */
3407 if (YYMAXDEPTH <= yystacksize)
3408 goto yyexhaustedlab;
3410 if (YYMAXDEPTH < yystacksize)
3411 yystacksize = YYMAXDEPTH;
3414 yytype_int16 *yyss1 = yyss;
3415 union yyalloc *yyptr =
3416 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3418 goto yyexhaustedlab;
3419 YYSTACK_RELOCATE (yyss);
3420 YYSTACK_RELOCATE (yyvs);
3422 # undef YYSTACK_RELOCATE
3424 YYSTACK_FREE (yyss1);
3427 #endif /* no yyoverflow */
3429 yyssp = yyss + yysize - 1;
3430 yyvsp = yyvs + yysize - 1;
3433 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3434 (unsigned long int) yystacksize));
3436 if (yyss + yystacksize - 1 <= yyssp)
3440 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3449 /* Do appropriate processing given the current state. Read a
3450 look-ahead token if we need one and don't already have one. */
3452 /* First try to decide what to do without reference to look-ahead token. */
3453 yyn = yypact[yystate];
3454 if (yyn == YYPACT_NINF)
3457 /* Not known => get a look-ahead token if don't already have one. */
3459 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3460 if (yychar == YYEMPTY)
3462 YYDPRINTF ((stderr, "Reading a token: "));
3466 if (yychar <= YYEOF)
3468 yychar = yytoken = YYEOF;
3469 YYDPRINTF ((stderr, "Now at end of input.\n"));
3473 yytoken = YYTRANSLATE (yychar);
3474 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3477 /* If the proper action on seeing token YYTOKEN is to reduce or to
3478 detect an error, take that action. */
3480 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3485 if (yyn == 0 || yyn == YYTABLE_NINF)
3494 /* Count tokens shifted since error; after three, turn off error
3499 /* Shift the look-ahead token. */
3500 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3502 /* Discard the shifted token unless it is eof. */
3503 if (yychar != YYEOF)
3512 /*-----------------------------------------------------------.
3513 | yydefault -- do the default action for the current state. |
3514 `-----------------------------------------------------------*/
3516 yyn = yydefact[yystate];
3522 /*-----------------------------.
3523 | yyreduce -- Do a reduction. |
3524 `-----------------------------*/
3526 /* yyn is the number of a rule to reduce with. */
3529 /* If YYLEN is nonzero, implement the default value of the action:
3532 Otherwise, the following line sets YYVAL to garbage.
3533 This behavior is undocumented and Bison
3534 users should not rely upon it. Assigning to YYVAL
3535 unconditionally makes the parser a bit smaller, and it avoids a
3536 GCC warning that YYVAL may be used uninitialized. */
3537 yyval = yyvsp[1-yylen];
3540 YY_REDUCE_PRINT (yyn);
3544 #line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3545 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3549 #line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3550 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3554 #line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3555 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3559 #line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3560 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3564 #line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3565 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3569 #line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3570 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3574 #line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3575 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3579 #line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3580 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3584 #line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3585 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3589 #line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3590 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3594 #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3595 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3599 #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3600 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3604 #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3605 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3609 #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3610 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3614 #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3615 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3619 #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3620 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3624 #line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3625 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3629 #line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3630 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3634 #line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3635 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3639 #line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3640 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3644 #line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3645 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3649 #line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3650 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3654 #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3655 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3659 #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3660 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3664 #line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3665 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3669 #line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3670 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3674 #line 1143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3675 { (yyval.StrVal) = 0; ;}
3679 #line 1145 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3680 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3684 #line 1146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3685 { (yyval.UIntVal)=0; ;}
3689 #line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3691 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3697 #line 1154 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3705 #line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3713 #line 1167 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3715 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3721 #line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3722 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3726 #line 1174 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3727 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3731 #line 1175 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3732 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3736 #line 1176 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3737 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3741 #line 1177 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3742 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3746 #line 1178 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3747 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
3751 #line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3752 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3756 #line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3757 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3761 #line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3762 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3766 #line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3767 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3771 #line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3772 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3776 #line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3777 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3781 #line 1191 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3782 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3786 #line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3787 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3791 #line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3792 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3796 #line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3797 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3801 #line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3802 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3806 #line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3807 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3811 #line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3812 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3816 #line 1204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3817 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3821 #line 1205 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3822 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3826 #line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3827 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3831 #line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3832 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3836 #line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3837 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3841 #line 1214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3842 { (yyval.UIntVal) = CallingConv::C; ;}
3846 #line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3847 { (yyval.UIntVal) = CallingConv::C; ;}
3851 #line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3852 { (yyval.UIntVal) = CallingConv::Fast; ;}
3856 #line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3857 { (yyval.UIntVal) = CallingConv::Cold; ;}
3861 #line 1218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3862 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3866 #line 1219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3867 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3871 #line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3873 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3874 GEN_ERROR("Calling conv too large");
3875 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3881 #line 1227 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3882 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3886 #line 1228 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3887 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3891 #line 1229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3892 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3896 #line 1230 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3897 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3901 #line 1231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3902 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3906 #line 1232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3907 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3911 #line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3912 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3916 #line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3917 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3921 #line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3922 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3926 #line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3927 { (yyval.ParamAttrs) =
3928 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3932 #line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3933 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3937 #line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3939 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3944 #line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3945 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3949 #line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3950 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3954 #line 1248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3955 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3959 #line 1249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3960 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3964 #line 1250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3965 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3969 #line 1251 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3970 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3974 #line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3975 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3979 #line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3981 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3986 #line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3987 { (yyval.StrVal) = 0; ;}
3991 #line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3993 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3998 #line 1268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3999 { (yyval.UIntVal) = 0; ;}
4003 #line 1269 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4005 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4006 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4007 GEN_ERROR("Alignment must be a power of two");
4013 #line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4014 { (yyval.UIntVal) = 0; ;}
4018 #line 1276 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4020 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4021 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4022 GEN_ERROR("Alignment must be a power of two");
4028 #line 1285 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4030 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4031 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
4032 GEN_ERROR("Invalid character in section name");
4033 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4039 #line 1293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4040 { (yyval.StrVal) = 0; ;}
4044 #line 1294 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4045 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4049 #line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4054 #line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4059 #line 1301 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4061 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4062 delete (yyvsp[(1) - (1)].StrVal);
4068 #line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4070 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4071 GEN_ERROR("Alignment must be a power of two");
4072 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4078 #line 1322 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4080 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4086 #line 1326 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4088 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4094 #line 1330 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4096 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4097 GEN_ERROR("Cannot form a pointer to a basic block");
4098 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4099 delete (yyvsp[(1) - (3)].TypeVal);
4105 #line 1337 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4106 { // Named types are also simple types...
4107 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4109 (yyval.TypeVal) = new PATypeHolder(tmp);
4114 #line 1342 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4115 { // Type UpReference
4116 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4117 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4118 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4119 (yyval.TypeVal) = new PATypeHolder(OT);
4120 UR_OUT("New Upreference!\n");
4126 #line 1350 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4128 // Allow but ignore attributes on function types; this permits auto-upgrade.
4129 // FIXME: remove in LLVM 3.0.
4130 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4131 if (!FunctionType::isValidReturnType(RetTy))
4132 GEN_ERROR("Invalid result type for LLVM function");
4134 std::vector<const Type*> Params;
4135 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4136 for (; I != E; ++I ) {
4137 const Type *Ty = I->Ty->get();
4138 Params.push_back(Ty);
4141 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4142 if (isVarArg) Params.pop_back();
4144 for (unsigned i = 0; i != Params.size(); ++i)
4145 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4146 GEN_ERROR("Function arguments must be value types!");
4150 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4151 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4152 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4153 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4159 #line 1379 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4161 // Allow but ignore attributes on function types; this permits auto-upgrade.
4162 // FIXME: remove in LLVM 3.0.
4163 std::vector<const Type*> Params;
4164 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4165 for ( ; I != E; ++I ) {
4166 const Type* Ty = I->Ty->get();
4167 Params.push_back(Ty);
4170 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4171 if (isVarArg) Params.pop_back();
4173 for (unsigned i = 0; i != Params.size(); ++i)
4174 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4175 GEN_ERROR("Function arguments must be value types!");
4179 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4180 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4181 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4187 #line 1404 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4188 { // Sized array type?
4189 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4190 delete (yyvsp[(4) - (5)].TypeVal);
4196 #line 1409 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4198 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4199 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4200 GEN_ERROR("Unsigned result not equal to signed result");
4201 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4202 GEN_ERROR("Element type of a VectorType must be primitive");
4203 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4204 delete (yyvsp[(4) - (5)].TypeVal);
4210 #line 1419 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4211 { // Structure type?
4212 std::vector<const Type*> Elements;
4213 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4214 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4215 Elements.push_back(*I);
4217 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4218 delete (yyvsp[(2) - (3)].TypeList);
4224 #line 1429 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4225 { // Empty structure type?
4226 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4232 #line 1433 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4234 std::vector<const Type*> Elements;
4235 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4236 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4237 Elements.push_back(*I);
4239 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4240 delete (yyvsp[(3) - (5)].TypeList);
4246 #line 1443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4247 { // Empty structure type?
4248 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4254 #line 1450 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4256 // Allow but ignore attributes on function types; this permits auto-upgrade.
4257 // FIXME: remove in LLVM 3.0.
4258 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4259 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4264 #line 1459 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4266 if (!UpRefs.empty())
4267 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4268 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4269 GEN_ERROR("LLVM functions cannot return aggregate types");
4270 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4275 #line 1466 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4277 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4282 #line 1471 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4284 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4285 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4291 #line 1476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4293 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4299 #line 1484 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4301 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4302 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4303 TWA.Ty = new PATypeHolder(Type::VoidTy);
4304 (yyval.TypeWithAttrsList)->push_back(TWA);
4310 #line 1491 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4312 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4313 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4314 TWA.Ty = new PATypeHolder(Type::VoidTy);
4315 (yyval.TypeWithAttrsList)->push_back(TWA);
4321 #line 1498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4323 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4329 #line 1506 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4331 (yyval.TypeList) = new std::list<PATypeHolder>();
4332 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4333 delete (yyvsp[(1) - (1)].TypeVal);
4339 #line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4341 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4342 delete (yyvsp[(3) - (3)].TypeVal);
4348 #line 1524 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4349 { // Nonempty unsized arr
4350 if (!UpRefs.empty())
4351 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4352 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4354 GEN_ERROR("Cannot make array constant with type: '" +
4355 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4356 const Type *ETy = ATy->getElementType();
4357 int NumElements = ATy->getNumElements();
4359 // Verify that we have the correct size...
4360 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4361 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4362 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4363 itostr(NumElements) + "");
4365 // Verify all elements are correct type!
4366 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4367 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4368 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4369 ETy->getDescription() +"' as required!\nIt is of type '"+
4370 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4373 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4374 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4380 #line 1552 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4382 if (!UpRefs.empty())
4383 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4384 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4386 GEN_ERROR("Cannot make array constant with type: '" +
4387 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4389 int NumElements = ATy->getNumElements();
4390 if (NumElements != -1 && NumElements != 0)
4391 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4392 " arguments, but has size of " + itostr(NumElements) +"");
4393 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4394 delete (yyvsp[(1) - (3)].TypeVal);
4400 #line 1568 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4402 if (!UpRefs.empty())
4403 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4404 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4406 GEN_ERROR("Cannot make array constant with type: '" +
4407 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4409 int NumElements = ATy->getNumElements();
4410 const Type *ETy = ATy->getElementType();
4411 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4412 GEN_ERROR("Can't build string constant of size " +
4413 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4414 " when array has size " + itostr(NumElements) + "");
4415 std::vector<Constant*> Vals;
4416 if (ETy == Type::Int8Ty) {
4417 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4418 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4420 delete (yyvsp[(3) - (3)].StrVal);
4421 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4423 delete (yyvsp[(3) - (3)].StrVal);
4424 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4425 delete (yyvsp[(1) - (3)].TypeVal);
4431 #line 1595 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4432 { // Nonempty unsized arr
4433 if (!UpRefs.empty())
4434 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4435 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4437 GEN_ERROR("Cannot make packed constant with type: '" +
4438 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4439 const Type *ETy = PTy->getElementType();
4440 int NumElements = PTy->getNumElements();
4442 // Verify that we have the correct size...
4443 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4444 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4445 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4446 itostr(NumElements) + "");
4448 // Verify all elements are correct type!
4449 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4450 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4451 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4452 ETy->getDescription() +"' as required!\nIt is of type '"+
4453 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4456 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4457 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4463 #line 1623 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4465 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4467 GEN_ERROR("Cannot make struct constant with type: '" +
4468 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4470 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4471 GEN_ERROR("Illegal number of initializers for structure type");
4473 // Check to ensure that constants are compatible with the type initializer!
4474 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4475 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4476 GEN_ERROR("Expected type '" +
4477 STy->getElementType(i)->getDescription() +
4478 "' for element #" + utostr(i) +
4479 " of structure initializer");
4481 // Check to ensure that Type is not packed
4482 if (STy->isPacked())
4483 GEN_ERROR("Unpacked Initializer to vector type '" +
4484 STy->getDescription() + "'");
4486 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4487 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4493 #line 1649 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4495 if (!UpRefs.empty())
4496 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4497 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4499 GEN_ERROR("Cannot make struct constant with type: '" +
4500 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4502 if (STy->getNumContainedTypes() != 0)
4503 GEN_ERROR("Illegal number of initializers for structure type");
4505 // Check to ensure that Type is not packed
4506 if (STy->isPacked())
4507 GEN_ERROR("Unpacked Initializer to vector type '" +
4508 STy->getDescription() + "'");
4510 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4511 delete (yyvsp[(1) - (3)].TypeVal);
4517 #line 1669 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4519 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4521 GEN_ERROR("Cannot make struct constant with type: '" +
4522 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4524 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4525 GEN_ERROR("Illegal number of initializers for structure type");
4527 // Check to ensure that constants are compatible with the type initializer!
4528 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4529 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4530 GEN_ERROR("Expected type '" +
4531 STy->getElementType(i)->getDescription() +
4532 "' for element #" + utostr(i) +
4533 " of structure initializer");
4535 // Check to ensure that Type is packed
4536 if (!STy->isPacked())
4537 GEN_ERROR("Vector initializer to non-vector type '" +
4538 STy->getDescription() + "'");
4540 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4541 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4547 #line 1695 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4549 if (!UpRefs.empty())
4550 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4551 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4553 GEN_ERROR("Cannot make struct constant with type: '" +
4554 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4556 if (STy->getNumContainedTypes() != 0)
4557 GEN_ERROR("Illegal number of initializers for structure type");
4559 // Check to ensure that Type is packed
4560 if (!STy->isPacked())
4561 GEN_ERROR("Vector initializer to non-vector type '" +
4562 STy->getDescription() + "'");
4564 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4565 delete (yyvsp[(1) - (5)].TypeVal);
4571 #line 1715 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4573 if (!UpRefs.empty())
4574 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4575 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4577 GEN_ERROR("Cannot make null pointer constant with type: '" +
4578 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4580 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4581 delete (yyvsp[(1) - (2)].TypeVal);
4587 #line 1727 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4589 if (!UpRefs.empty())
4590 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4591 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4592 delete (yyvsp[(1) - (2)].TypeVal);
4598 #line 1734 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4600 if (!UpRefs.empty())
4601 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4602 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4604 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4606 // ConstExprs can exist in the body of a function, thus creating
4607 // GlobalValues whenever they refer to a variable. Because we are in
4608 // the context of a function, getExistingVal will search the functions
4609 // symbol table instead of the module symbol table for the global symbol,
4610 // which throws things all off. To get around this, we just tell
4611 // getExistingVal that we are at global scope here.
4613 Function *SavedCurFn = CurFun.CurrentFunction;
4614 CurFun.CurrentFunction = 0;
4616 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4619 CurFun.CurrentFunction = SavedCurFn;
4621 // If this is an initializer for a constant pointer, which is referencing a
4622 // (currently) undefined variable, create a stub now that shall be replaced
4623 // in the future with the right type of variable.
4626 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4627 const PointerType *PT = cast<PointerType>(Ty);
4629 // First check to see if the forward references value is already created!
4630 PerModuleInfo::GlobalRefsType::iterator I =
4631 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4633 if (I != CurModule.GlobalRefs.end()) {
4634 V = I->second; // Placeholder already exists, use it...
4635 (yyvsp[(2) - (2)].ValIDVal).destroy();
4638 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4639 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4640 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4641 GEN_ERROR("Invalid reference to global");
4643 // Create the forward referenced global.
4645 if (const FunctionType *FTy =
4646 dyn_cast<FunctionType>(PT->getElementType())) {
4647 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4648 CurModule.CurrentModule);
4650 GV = new GlobalVariable(PT->getElementType(), false,
4651 GlobalValue::ExternalWeakLinkage, 0,
4652 Name, CurModule.CurrentModule);
4655 // Keep track of the fact that we have a forward ref to recycle it
4656 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4661 (yyval.ConstVal) = cast<GlobalValue>(V);
4662 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4668 #line 1800 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4670 if (!UpRefs.empty())
4671 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4672 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4673 GEN_ERROR("Mismatched types for constant expression: " +
4674 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4675 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4676 delete (yyvsp[(1) - (2)].TypeVal);
4682 #line 1810 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4684 if (!UpRefs.empty())
4685 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4686 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4687 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4688 GEN_ERROR("Cannot create a null initialized value of this type");
4689 (yyval.ConstVal) = Constant::getNullValue(Ty);
4690 delete (yyvsp[(1) - (2)].TypeVal);
4696 #line 1820 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4697 { // integral constants
4698 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4699 GEN_ERROR("Constant value doesn't fit in type");
4700 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4706 #line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4707 { // arbitrary precision integer constants
4708 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4709 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4710 GEN_ERROR("Constant value does not fit in type");
4712 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4713 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4714 delete (yyvsp[(2) - (2)].APIntVal);
4720 #line 1836 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4721 { // integral constants
4722 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4723 GEN_ERROR("Constant value doesn't fit in type");
4724 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4730 #line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4731 { // arbitrary precision integer constants
4732 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4733 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4734 GEN_ERROR("Constant value does not fit in type");
4736 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4737 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4738 delete (yyvsp[(2) - (2)].APIntVal);
4744 #line 1852 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4745 { // Boolean constants
4746 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4747 (yyval.ConstVal) = ConstantInt::getTrue();
4753 #line 1857 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4754 { // Boolean constants
4755 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4756 (yyval.ConstVal) = ConstantInt::getFalse();
4762 #line 1862 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4763 { // Floating point constants
4764 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4765 GEN_ERROR("Floating point constant invalid for type");
4766 // Lexer has no type info, so builds all float and double FP constants
4767 // as double. Fix this here. Long double is done right.
4768 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4769 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4770 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4771 delete (yyvsp[(2) - (2)].FPVal);
4777 #line 1875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4779 if (!UpRefs.empty())
4780 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4781 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4782 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4783 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4784 GEN_ERROR("invalid cast opcode for cast from '" +
4785 Val->getType()->getDescription() + "' to '" +
4786 DestTy->getDescription() + "'");
4787 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4788 delete (yyvsp[(5) - (6)].TypeVal);
4793 #line 1887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4795 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4796 GEN_ERROR("GetElementPtr requires a pointer operand");
4799 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4801 GEN_ERROR("Index list invalid for constant getelementptr");
4803 SmallVector<Constant*, 8> IdxVec;
4804 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4805 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4806 IdxVec.push_back(C);
4808 GEN_ERROR("Indices to constant getelementptr must be constants");
4810 delete (yyvsp[(4) - (5)].ValueList);
4812 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4818 #line 1908 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4820 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4821 GEN_ERROR("Select condition must be of boolean type");
4822 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4823 GEN_ERROR("Select operand types must match");
4824 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4830 #line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4832 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4833 GEN_ERROR("Binary operator types must match");
4835 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4840 #line 1922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4842 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4843 GEN_ERROR("Logical operator types must match");
4844 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4845 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4846 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4847 GEN_ERROR("Logical operator requires integral operands");
4849 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4855 #line 1933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4857 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4858 GEN_ERROR("icmp operand types must match");
4859 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4864 #line 1938 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4866 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4867 GEN_ERROR("fcmp operand types must match");
4868 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4873 #line 1943 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4875 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4876 GEN_ERROR("vicmp operand types must match");
4877 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4882 #line 1948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4884 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4885 GEN_ERROR("vfcmp operand types must match");
4886 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4891 #line 1953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4893 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4894 GEN_ERROR("Invalid extractelement operands");
4895 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4901 #line 1959 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4903 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4904 GEN_ERROR("Invalid insertelement operands");
4905 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4911 #line 1965 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4913 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4914 GEN_ERROR("Invalid shufflevector operands");
4915 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4921 #line 1971 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4923 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4924 GEN_ERROR("ExtractValue requires an aggregate operand");
4927 ExtractValueInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4929 GEN_ERROR("Index list invalid for constant extractvalue");
4931 SmallVector<Constant*, 8> IdxVec;
4932 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4933 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4934 IdxVec.push_back(C);
4936 GEN_ERROR("Indices to constant extractvalue must be constants");
4938 delete (yyvsp[(4) - (5)].ValueList);
4940 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4946 #line 1992 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4948 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
4949 GEN_ERROR("InsertValue requires an aggregate operand");
4952 ExtractValueInst::getIndexedType((yyvsp[(3) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ValueList)->begin(), (yyvsp[(6) - (7)].ValueList)->end());
4953 if (IdxTy != (yyvsp[(5) - (7)].ConstVal)->getType())
4954 GEN_ERROR("Index list invalid for constant insertvalue");
4956 SmallVector<Constant*, 8> IdxVec;
4957 for (unsigned i = 0, e = (yyvsp[(6) - (7)].ValueList)->size(); i != e; ++i)
4958 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(6) - (7)].ValueList))[i]))
4959 IdxVec.push_back(C);
4961 GEN_ERROR("Indices to constant insertvalue must be constants");
4963 delete (yyvsp[(6) - (7)].ValueList);
4965 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &IdxVec[0], IdxVec.size());
4971 #line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4973 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4979 #line 2020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4981 (yyval.ConstVector) = new std::vector<Constant*>();
4982 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4988 #line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4989 { (yyval.BoolVal) = false; ;}
4993 #line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4994 { (yyval.BoolVal) = true; ;}
4998 #line 2031 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4999 { (yyval.BoolVal) = true; ;}
5003 #line 2031 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5004 { (yyval.BoolVal) = false; ;}
5008 #line 2034 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5010 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5011 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
5013 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5015 GEN_ERROR("Aliases can be created only to global values");
5017 (yyval.ConstVal) = Aliasee;
5019 delete (yyvsp[(1) - (2)].TypeVal);
5024 #line 2046 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5026 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5027 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5028 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
5029 GEN_ERROR("invalid cast opcode for cast from '" +
5030 Val->getType()->getDescription() + "' to '" +
5031 DestTy->getDescription() + "'");
5033 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5035 delete (yyvsp[(5) - (6)].TypeVal);
5040 #line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5042 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5043 CurModule.ModuleDone();
5049 #line 2072 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5051 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5052 CurModule.ModuleDone();
5058 #line 2085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5059 { CurFun.isDeclare = false; ;}
5063 #line 2085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5065 CurFun.FunctionDone();
5071 #line 2089 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5072 { CurFun.isDeclare = true; ;}
5076 #line 2089 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5083 #line 2092 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5090 #line 2095 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5092 if (!UpRefs.empty())
5093 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
5094 // Eagerly resolve types. This is not an optimization, this is a
5095 // requirement that is due to the fact that we could have this:
5097 // %list = type { %list * }
5098 // %list = type { %list * } ; repeated type decl
5100 // If types are not resolved eagerly, then the two types will not be
5101 // determined to be the same type!
5103 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
5105 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5107 // If this is a named type that is not a redefinition, add it to the slot
5109 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
5112 delete (yyvsp[(3) - (3)].TypeVal);
5118 #line 2119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5120 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5122 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5124 // If this is a named type that is not a redefinition, add it to the slot
5126 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5133 #line 2131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5135 /* "Externally Visible" Linkage */
5136 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5137 GEN_ERROR("Global value initializer is not a constant");
5138 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5139 (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));
5145 #line 2138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5152 #line 2142 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5154 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5155 GEN_ERROR("Global value initializer is not a constant");
5156 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));
5162 #line 2147 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5169 #line 2151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5171 if (!UpRefs.empty())
5172 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5173 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));
5175 delete (yyvsp[(6) - (7)].TypeVal);
5180 #line 2157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5188 #line 2161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5191 if ((yyvsp[(1) - (5)].StrVal)) {
5192 Name = *(yyvsp[(1) - (5)].StrVal);
5193 delete (yyvsp[(1) - (5)].StrVal);
5196 GEN_ERROR("Alias name cannot be empty");
5198 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5200 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5202 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5203 CurModule.CurrentModule);
5204 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5205 InsertValue(GA, CurModule.Values);
5208 // If there was a forward reference of this alias, resolve it now.
5212 ID = ValID::createGlobalName(Name);
5214 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5216 if (GlobalValue *FWGV =
5217 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5218 // Replace uses of the fwdref with the actual alias.
5219 FWGV->replaceAllUsesWith(GA);
5220 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5221 GV->eraseFromParent();
5223 cast<Function>(FWGV)->eraseFromParent();
5232 #line 2201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5239 #line 2204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5246 #line 2210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5248 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5249 if (AsmSoFar.empty())
5250 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5252 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5253 delete (yyvsp[(1) - (1)].StrVal);
5259 #line 2220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5261 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5262 delete (yyvsp[(3) - (3)].StrVal);
5267 #line 2224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5269 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5270 delete (yyvsp[(3) - (3)].StrVal);
5275 #line 2231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5277 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5278 delete (yyvsp[(3) - (3)].StrVal);
5284 #line 2236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5286 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5287 delete (yyvsp[(1) - (1)].StrVal);
5293 #line 2241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5300 #line 2250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5302 if (!UpRefs.empty())
5303 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5304 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5305 GEN_ERROR("void typed arguments are invalid");
5306 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5307 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5308 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5314 #line 2260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5316 if (!UpRefs.empty())
5317 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5318 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5319 GEN_ERROR("void typed arguments are invalid");
5320 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5321 (yyval.ArgList) = new ArgListType;
5322 (yyval.ArgList)->push_back(E);
5328 #line 2271 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5330 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5336 #line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5338 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5339 struct ArgListEntry E;
5340 E.Ty = new PATypeHolder(Type::VoidTy);
5342 E.Attrs = ParamAttr::None;
5343 (yyval.ArgList)->push_back(E);
5349 #line 2284 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5351 (yyval.ArgList) = new ArgListType;
5352 struct ArgListEntry E;
5353 E.Ty = new PATypeHolder(Type::VoidTy);
5355 E.Attrs = ParamAttr::None;
5356 (yyval.ArgList)->push_back(E);
5362 #line 2293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5364 (yyval.ArgList) = 0;
5370 #line 2299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5372 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5373 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5375 // Check the function result for abstractness if this is a define. We should
5376 // have no abstract types at this point
5377 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5378 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5380 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5381 GEN_ERROR("Invalid result type for LLVM function");
5383 std::vector<const Type*> ParamTypeList;
5384 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5385 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5386 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5387 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5389 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5390 const Type* Ty = I->Ty->get();
5391 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5392 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5393 ParamTypeList.push_back(Ty);
5394 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5395 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
5399 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5400 if (isVarArg) ParamTypeList.pop_back();
5404 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5406 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5407 const PointerType *PFT = PointerType::getUnqual(FT);
5408 delete (yyvsp[(2) - (10)].TypeVal);
5411 if (!FunctionName.empty()) {
5412 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5414 ID = ValID::createGlobalID(CurModule.Values.size());
5418 // See if this function was forward referenced. If so, recycle the object.
5419 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5420 // Move the function to the end of the list, from whereever it was
5421 // previously inserted.
5422 Fn = cast<Function>(FWRef);
5423 assert(Fn->getParamAttrs().isEmpty() &&
5424 "Forward reference has parameter attributes!");
5425 CurModule.CurrentModule->getFunctionList().remove(Fn);
5426 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5427 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5428 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5429 if (Fn->getFunctionType() != FT ) {
5430 // The existing function doesn't have the same type. This is an overload
5432 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5433 } else if (Fn->getParamAttrs() != PAL) {
5434 // The existing function doesn't have the same parameter attributes.
5435 // This is an overload error.
5436 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5437 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5438 // Neither the existing or the current function is a declaration and they
5439 // have the same name and same type. Clearly this is a redefinition.
5440 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5441 } else if (Fn->isDeclaration()) {
5442 // Make sure to strip off any argument names so we can't get conflicts.
5443 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5447 } else { // Not already defined?
5448 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5449 CurModule.CurrentModule);
5450 InsertValue(Fn, CurModule.Values);
5453 CurFun.FunctionStart(Fn);
5455 if (CurFun.isDeclare) {
5456 // If we have declaration, always overwrite linkage. This will allow us to
5457 // correctly handle cases, when pointer to function is passed as argument to
5458 // another function.
5459 Fn->setLinkage(CurFun.Linkage);
5460 Fn->setVisibility(CurFun.Visibility);
5462 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5463 Fn->setParamAttrs(PAL);
5464 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5465 if ((yyvsp[(8) - (10)].StrVal)) {
5466 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5467 delete (yyvsp[(8) - (10)].StrVal);
5469 if ((yyvsp[(10) - (10)].StrVal)) {
5470 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5471 delete (yyvsp[(10) - (10)].StrVal);
5474 // Add all of the arguments we parsed to the function...
5475 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5476 if (isVarArg) { // Nuke the last entry
5477 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5478 "Not a varargs marker!");
5479 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5480 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5482 Function::arg_iterator ArgIt = Fn->arg_begin();
5483 Function::arg_iterator ArgEnd = Fn->arg_end();
5485 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5486 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5487 delete I->Ty; // Delete the typeholder...
5488 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5494 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5501 #line 2429 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5503 (yyval.FunctionVal) = CurFun.CurrentFunction;
5505 // Make sure that we keep track of the linkage type even if there was a
5506 // previous "declare".
5507 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5508 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5513 #line 2440 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5515 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5521 #line 2445 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5523 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5524 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5525 (yyval.FunctionVal) = CurFun.CurrentFunction;
5526 CurFun.FunctionDone();
5532 #line 2457 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5534 (yyval.BoolVal) = false;
5540 #line 2461 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5542 (yyval.BoolVal) = true;
5548 #line 2466 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5549 { // A reference to a direct constant
5550 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5556 #line 2470 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5558 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5564 #line 2474 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5565 { // Perhaps it's an FP constant?
5566 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5572 #line 2478 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5574 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5580 #line 2482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5582 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5588 #line 2486 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5590 (yyval.ValIDVal) = ValID::createNull();
5596 #line 2490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5598 (yyval.ValIDVal) = ValID::createUndef();
5604 #line 2494 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5605 { // A vector zero constant.
5606 (yyval.ValIDVal) = ValID::createZeroInit();
5612 #line 2498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5613 { // Nonempty unsized packed vector
5614 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5615 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5617 VectorType* pt = VectorType::get(ETy, NumElements);
5618 PATypeHolder* PTy = new PATypeHolder(
5626 // Verify all elements are correct type!
5627 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5628 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5629 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5630 ETy->getDescription() +"' as required!\nIt is of type '" +
5631 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5634 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5635 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5641 #line 2523 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5643 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5649 #line 2527 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5651 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5652 delete (yyvsp[(3) - (5)].StrVal);
5653 delete (yyvsp[(5) - (5)].StrVal);
5659 #line 2537 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5660 { // Is it an integer reference...?
5661 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5667 #line 2541 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5669 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5675 #line 2545 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5676 { // Is it a named reference...?
5677 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5678 delete (yyvsp[(1) - (1)].StrVal);
5684 #line 2550 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5685 { // Is it a named reference...?
5686 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5687 delete (yyvsp[(1) - (1)].StrVal);
5693 #line 2563 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5695 if (!UpRefs.empty())
5696 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5697 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5698 delete (yyvsp[(1) - (2)].TypeVal);
5704 #line 2572 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5706 (yyval.ValueList) = new std::vector<Value *>();
5707 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5713 #line 2577 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5715 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
5721 #line 2582 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5723 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5729 #line 2586 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5730 { // Do not allow functions with 0 basic blocks
5731 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5737 #line 2595 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5739 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5741 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5742 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5743 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5749 #line 2604 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5751 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5752 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5753 if (CI2->getParent() == 0)
5754 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5755 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5756 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5762 #line 2613 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5763 { // Empty space between instruction lists
5764 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5770 #line 2617 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5771 { // Labelled (named) basic block
5772 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5773 delete (yyvsp[(1) - (1)].StrVal);
5780 #line 2625 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5781 { // Return with a result...
5782 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5783 assert(!VL.empty() && "Invalid ret operands!");
5784 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5785 delete (yyvsp[(2) - (2)].ValueList);
5791 #line 2632 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5792 { // Return with no result...
5793 (yyval.TermInstVal) = ReturnInst::Create();
5799 #line 2636 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5800 { // Unconditional Branch...
5801 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5803 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5808 #line 2641 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5810 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5811 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5813 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5815 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5817 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5822 #line 2651 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5824 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5826 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5828 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5829 (yyval.TermInstVal) = S;
5831 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5832 E = (yyvsp[(8) - (9)].JumpTable)->end();
5833 for (; I != E; ++I) {
5834 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5835 S->addCase(CI, I->second);
5837 GEN_ERROR("Switch case is constant, but not a simple integer");
5839 delete (yyvsp[(8) - (9)].JumpTable);
5845 #line 2670 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5847 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5849 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5851 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
5852 (yyval.TermInstVal) = S;
5858 #line 2680 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5861 // Handle the short syntax
5862 const PointerType *PFTy = 0;
5863 const FunctionType *Ty = 0;
5864 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5865 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5866 // Pull out the types of all of the arguments...
5867 std::vector<const Type*> ParamTypes;
5868 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5869 for (; I != E; ++I) {
5870 const Type *Ty = I->Val->getType();
5871 if (Ty == Type::VoidTy)
5872 GEN_ERROR("Short call syntax cannot be used with varargs");
5873 ParamTypes.push_back(Ty);
5876 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5877 GEN_ERROR("Invalid result type for LLVM function");
5879 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5880 PFTy = PointerType::getUnqual(Ty);
5883 delete (yyvsp[(3) - (14)].TypeVal);
5885 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5887 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5889 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5892 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5893 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5894 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
5896 // Check the arguments
5898 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5899 // Make sure no arguments is a good thing!
5900 if (Ty->getNumParams() != 0)
5901 GEN_ERROR("No arguments passed to a function that "
5902 "expects arguments");
5903 } else { // Has arguments?
5904 // Loop through FunctionType's arguments and ensure they are specified
5906 FunctionType::param_iterator I = Ty->param_begin();
5907 FunctionType::param_iterator E = Ty->param_end();
5908 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5911 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5912 if (ArgI->Val->getType() != *I)
5913 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5914 (*I)->getDescription() + "'");
5915 Args.push_back(ArgI->Val);
5916 if (ArgI->Attrs != ParamAttr::None)
5917 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5920 if (Ty->isVarArg()) {
5922 for (; ArgI != ArgE; ++ArgI, ++index) {
5923 Args.push_back(ArgI->Val); // push the remaining varargs
5924 if (ArgI->Attrs != ParamAttr::None)
5925 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5927 } else if (I != E || ArgI != ArgE)
5928 GEN_ERROR("Invalid number of parameters detected");
5933 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5935 // Create the InvokeInst
5936 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
5937 Args.begin(), Args.end());
5938 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5939 II->setParamAttrs(PAL);
5940 (yyval.TermInstVal) = II;
5941 delete (yyvsp[(6) - (14)].ParamList);
5947 #line 2765 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5949 (yyval.TermInstVal) = new UnwindInst();
5955 #line 2769 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5957 (yyval.TermInstVal) = new UnreachableInst();
5963 #line 2776 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5965 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5966 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5969 GEN_ERROR("May only switch on a constant pool value");
5971 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5973 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5978 #line 2787 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5980 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5981 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5985 GEN_ERROR("May only switch on a constant pool value");
5987 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5989 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5994 #line 2800 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5996 // Is this definition named?? if so, assign the name...
5997 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5999 InsertValue((yyvsp[(2) - (2)].InstVal));
6000 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6006 #line 2810 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6007 { // Used for PHI nodes
6008 if (!UpRefs.empty())
6009 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6010 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6011 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
6013 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6015 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6016 delete (yyvsp[(1) - (6)].TypeVal);
6021 #line 2821 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6023 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6024 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
6026 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
6028 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6033 #line 2831 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6035 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6036 if (!UpRefs.empty())
6037 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
6038 // Used for call and invoke instructions
6039 (yyval.ParamList) = new ParamList();
6040 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6041 (yyval.ParamList)->push_back(E);
6042 delete (yyvsp[(1) - (4)].TypeVal);
6048 #line 2842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6050 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6051 // Labels are only valid in ASMs
6052 (yyval.ParamList) = new ParamList();
6053 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6054 (yyval.ParamList)->push_back(E);
6060 #line 2850 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6062 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6063 if (!UpRefs.empty())
6064 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6065 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6066 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6067 (yyval.ParamList)->push_back(E);
6068 delete (yyvsp[(3) - (6)].TypeVal);
6074 #line 2860 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6076 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6077 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6078 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6079 (yyval.ParamList)->push_back(E);
6085 #line 2867 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6086 { (yyval.ParamList) = new ParamList(); ;}
6090 #line 2870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6091 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6095 #line 2871 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6097 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6098 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6104 #line 2878 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6106 (yyval.BoolVal) = true;
6112 #line 2882 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6114 (yyval.BoolVal) = false;
6120 #line 2887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6122 if (!UpRefs.empty())
6123 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6124 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6125 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6127 "Arithmetic operator requires integer, FP, or packed operands");
6128 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6130 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6132 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6133 if ((yyval.InstVal) == 0)
6134 GEN_ERROR("binary operator returned null");
6135 delete (yyvsp[(2) - (5)].TypeVal);
6140 #line 2903 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6142 if (!UpRefs.empty())
6143 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6144 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6145 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6146 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6147 GEN_ERROR("Logical operator requires integral operands");
6149 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6151 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6153 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6154 if ((yyval.InstVal) == 0)
6155 GEN_ERROR("binary operator returned null");
6156 delete (yyvsp[(2) - (5)].TypeVal);
6161 #line 2920 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6163 if (!UpRefs.empty())
6164 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6165 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6166 GEN_ERROR("Vector types not supported by icmp instruction");
6167 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6169 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6171 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6172 if ((yyval.InstVal) == 0)
6173 GEN_ERROR("icmp operator returned null");
6174 delete (yyvsp[(3) - (6)].TypeVal);
6179 #line 2934 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6181 if (!UpRefs.empty())
6182 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6183 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6184 GEN_ERROR("Vector types not supported by fcmp instruction");
6185 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6187 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6189 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6190 if ((yyval.InstVal) == 0)
6191 GEN_ERROR("fcmp operator returned null");
6192 delete (yyvsp[(3) - (6)].TypeVal);
6197 #line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6199 if (!UpRefs.empty())
6200 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6201 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6202 GEN_ERROR("Scalar types not supported by vicmp instruction");
6203 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6205 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6207 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6208 if ((yyval.InstVal) == 0)
6209 GEN_ERROR("icmp operator returned null");
6210 delete (yyvsp[(3) - (6)].TypeVal);
6215 #line 2962 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6217 if (!UpRefs.empty())
6218 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6219 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6220 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6221 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6223 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6225 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6226 if ((yyval.InstVal) == 0)
6227 GEN_ERROR("fcmp operator returned null");
6228 delete (yyvsp[(3) - (6)].TypeVal);
6233 #line 2976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6235 if (!UpRefs.empty())
6236 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6237 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6238 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6239 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6240 GEN_ERROR("invalid cast opcode for cast from '" +
6241 Val->getType()->getDescription() + "' to '" +
6242 DestTy->getDescription() + "'");
6243 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6244 delete (yyvsp[(4) - (4)].TypeVal);
6249 #line 2988 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6251 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6252 GEN_ERROR("select condition must be boolean");
6253 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6254 GEN_ERROR("select value types should match");
6255 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6261 #line 2996 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6263 if (!UpRefs.empty())
6264 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6265 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6266 delete (yyvsp[(4) - (4)].TypeVal);
6272 #line 3003 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6274 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6275 GEN_ERROR("Invalid extractelement operands");
6276 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6282 #line 3009 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6284 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6285 GEN_ERROR("Invalid insertelement operands");
6286 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6292 #line 3015 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6294 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6295 GEN_ERROR("Invalid shufflevector operands");
6296 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6302 #line 3021 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6304 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6305 if (!Ty->isFirstClassType())
6306 GEN_ERROR("PHI node operands must be of first class type");
6307 (yyval.InstVal) = PHINode::Create(Ty);
6308 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6309 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6310 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6311 GEN_ERROR("All elements of a PHI node must be of the same type");
6312 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6313 (yyvsp[(2) - (2)].PHIList)->pop_front();
6315 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6321 #line 3037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6324 // Handle the short syntax
6325 const PointerType *PFTy = 0;
6326 const FunctionType *Ty = 0;
6327 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6328 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6329 // Pull out the types of all of the arguments...
6330 std::vector<const Type*> ParamTypes;
6331 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6332 for (; I != E; ++I) {
6333 const Type *Ty = I->Val->getType();
6334 if (Ty == Type::VoidTy)
6335 GEN_ERROR("Short call syntax cannot be used with varargs");
6336 ParamTypes.push_back(Ty);
6339 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6340 GEN_ERROR("Invalid result type for LLVM function");
6342 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6343 PFTy = PointerType::getUnqual(Ty);
6346 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6349 // Check for call to invalid intrinsic to avoid crashing later.
6350 if (Function *theF = dyn_cast<Function>(V)) {
6351 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6352 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6353 !theF->getIntrinsicID(true))
6354 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6355 theF->getName() + "'");
6358 // Set up the ParamAttrs for the function
6359 SmallVector<ParamAttrsWithIndex, 8> Attrs;
6360 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6361 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
6362 // Check the arguments
6364 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6365 // Make sure no arguments is a good thing!
6366 if (Ty->getNumParams() != 0)
6367 GEN_ERROR("No arguments passed to a function that "
6368 "expects arguments");
6369 } else { // Has arguments?
6370 // Loop through FunctionType's arguments and ensure they are specified
6371 // correctly. Also, gather any parameter attributes.
6372 FunctionType::param_iterator I = Ty->param_begin();
6373 FunctionType::param_iterator E = Ty->param_end();
6374 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6377 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6378 if (ArgI->Val->getType() != *I)
6379 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6380 (*I)->getDescription() + "'");
6381 Args.push_back(ArgI->Val);
6382 if (ArgI->Attrs != ParamAttr::None)
6383 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6385 if (Ty->isVarArg()) {
6387 for (; ArgI != ArgE; ++ArgI, ++index) {
6388 Args.push_back(ArgI->Val); // push the remaining varargs
6389 if (ArgI->Attrs != ParamAttr::None)
6390 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6392 } else if (I != E || ArgI != ArgE)
6393 GEN_ERROR("Invalid number of parameters detected");
6396 // Finish off the ParamAttrs and check them
6399 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6401 // Create the call node
6402 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6403 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6404 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6405 CI->setParamAttrs(PAL);
6406 (yyval.InstVal) = CI;
6407 delete (yyvsp[(6) - (8)].ParamList);
6408 delete (yyvsp[(3) - (8)].TypeVal);
6414 #line 3126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6416 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6422 #line 3131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6424 (yyval.BoolVal) = true;
6430 #line 3135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6432 (yyval.BoolVal) = false;
6438 #line 3142 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6440 if (!UpRefs.empty())
6441 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6442 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6443 delete (yyvsp[(2) - (3)].TypeVal);
6449 #line 3149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6451 if (!UpRefs.empty())
6452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6453 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6455 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6456 delete (yyvsp[(2) - (6)].TypeVal);
6461 #line 3157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6463 if (!UpRefs.empty())
6464 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6465 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6466 delete (yyvsp[(2) - (3)].TypeVal);
6472 #line 3164 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6474 if (!UpRefs.empty())
6475 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6476 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6478 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6479 delete (yyvsp[(2) - (6)].TypeVal);
6484 #line 3172 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6486 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6487 GEN_ERROR("Trying to free nonpointer type " +
6488 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6489 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6495 #line 3180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6497 if (!UpRefs.empty())
6498 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6499 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6500 GEN_ERROR("Can't load from nonpointer type: " +
6501 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6502 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6503 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6504 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6505 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6507 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6508 delete (yyvsp[(3) - (5)].TypeVal);
6513 #line 3194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6515 if (!UpRefs.empty())
6516 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6517 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6519 GEN_ERROR("Can't store to a nonpointer type: " +
6520 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6521 const Type *ElTy = PT->getElementType();
6522 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6523 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6524 "' into space of type '" + ElTy->getDescription() + "'");
6526 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6528 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6529 delete (yyvsp[(5) - (7)].TypeVal);
6534 #line 3211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6536 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6537 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6538 GEN_ERROR("Invalid getresult operands");
6539 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6540 delete (yyvsp[(2) - (5)].TypeVal);
6546 #line 3219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6548 if (!UpRefs.empty())
6549 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6550 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6551 GEN_ERROR("getelementptr insn requires pointer operand");
6553 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6554 GEN_ERROR("Invalid getelementptr indices for type '" +
6555 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6556 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6558 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6559 delete (yyvsp[(2) - (4)].TypeVal);
6560 delete (yyvsp[(4) - (4)].ValueList);
6565 #line 3234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6567 if (!UpRefs.empty())
6568 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6569 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6570 GEN_ERROR("extractvalue insn requires an aggregate operand");
6572 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6573 GEN_ERROR("Invalid extractvalue indices for type '" +
6574 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6575 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6577 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6578 delete (yyvsp[(2) - (4)].TypeVal);
6579 delete (yyvsp[(4) - (4)].ValueList);
6584 #line 3249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6586 if (!UpRefs.empty())
6587 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6588 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6589 GEN_ERROR("extractvalue insn requires an aggregate operand");
6591 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ValueList)->begin(), (yyvsp[(7) - (7)].ValueList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
6592 GEN_ERROR("Invalid insertvalue indices for type '" +
6593 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6594 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6595 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6597 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ValueList)->begin(), (yyvsp[(7) - (7)].ValueList)->end());
6598 delete (yyvsp[(2) - (7)].TypeVal);
6599 delete (yyvsp[(5) - (7)].TypeVal);
6600 delete (yyvsp[(7) - (7)].ValueList);
6605 /* Line 1267 of yacc.c. */
6606 #line 6607 "llvmAsmParser.tab.c"
6609 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6613 YY_STACK_PRINT (yyss, yyssp);
6618 /* Now `shift' the result of the reduction. Determine what state
6619 that goes to, based on the state we popped back to and the rule
6620 number reduced by. */
6624 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6625 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6626 yystate = yytable[yystate];
6628 yystate = yydefgoto[yyn - YYNTOKENS];
6633 /*------------------------------------.
6634 | yyerrlab -- here on detecting error |
6635 `------------------------------------*/
6637 /* If not already recovering from an error, report this error. */
6641 #if ! YYERROR_VERBOSE
6642 yyerror (YY_("syntax error"));
6645 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6646 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6648 YYSIZE_T yyalloc = 2 * yysize;
6649 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6650 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6651 if (yymsg != yymsgbuf)
6652 YYSTACK_FREE (yymsg);
6653 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6655 yymsg_alloc = yyalloc;
6659 yymsg_alloc = sizeof yymsgbuf;
6663 if (0 < yysize && yysize <= yymsg_alloc)
6665 (void) yysyntax_error (yymsg, yystate, yychar);
6670 yyerror (YY_("syntax error"));
6672 goto yyexhaustedlab;
6680 if (yyerrstatus == 3)
6682 /* If just tried and failed to reuse look-ahead token after an
6683 error, discard it. */
6685 if (yychar <= YYEOF)
6687 /* Return failure if at end of input. */
6688 if (yychar == YYEOF)
6693 yydestruct ("Error: discarding",
6699 /* Else will try to reuse look-ahead token after shifting the error
6704 /*---------------------------------------------------.
6705 | yyerrorlab -- error raised explicitly by YYERROR. |
6706 `---------------------------------------------------*/
6709 /* Pacify compilers like GCC when the user code never invokes
6710 YYERROR and the label yyerrorlab therefore never appears in user
6712 if (/*CONSTCOND*/ 0)
6715 /* Do not reclaim the symbols of the rule which action triggered
6719 YY_STACK_PRINT (yyss, yyssp);
6724 /*-------------------------------------------------------------.
6725 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6726 `-------------------------------------------------------------*/
6728 yyerrstatus = 3; /* Each real token shifted decrements this. */
6732 yyn = yypact[yystate];
6733 if (yyn != YYPACT_NINF)
6736 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6744 /* Pop the current state because it cannot handle the error token. */
6749 yydestruct ("Error: popping",
6750 yystos[yystate], yyvsp);
6753 YY_STACK_PRINT (yyss, yyssp);
6762 /* Shift the error token. */
6763 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6769 /*-------------------------------------.
6770 | yyacceptlab -- YYACCEPT comes here. |
6771 `-------------------------------------*/
6776 /*-----------------------------------.
6777 | yyabortlab -- YYABORT comes here. |
6778 `-----------------------------------*/
6784 /*-------------------------------------------------.
6785 | yyexhaustedlab -- memory exhaustion comes here. |
6786 `-------------------------------------------------*/
6788 yyerror (YY_("memory exhausted"));
6794 if (yychar != YYEOF && yychar != YYEMPTY)
6795 yydestruct ("Cleanup: discarding lookahead",
6797 /* Do not reclaim the symbols of the rule which action triggered
6798 this YYABORT or YYACCEPT. */
6800 YY_STACK_PRINT (yyss, yyssp);
6801 while (yyssp != yyss)
6803 yydestruct ("Cleanup: popping",
6804 yystos[*yyssp], yyvsp);
6809 YYSTACK_FREE (yyss);
6812 if (yymsg != yymsgbuf)
6813 YYSTACK_FREE (yymsg);
6815 /* Make sure YYID is used. */
6816 return YYID (yyresult);
6820 #line 3268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6823 // common code from the two 'RunVMAsmParser' functions
6824 static Module* RunParser(Module * M) {
6825 CurModule.CurrentModule = M;
6826 // Check to make sure the parser succeeded
6829 delete ParserResult;
6833 // Emit an error if there are any unresolved types left.
6834 if (!CurModule.LateResolveTypes.empty()) {
6835 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6836 if (DID.Type == ValID::LocalName) {
6837 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6839 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6842 delete ParserResult;
6846 // Emit an error if there are any unresolved values left.
6847 if (!CurModule.LateResolveValues.empty()) {
6848 Value *V = CurModule.LateResolveValues.back();
6849 std::map<Value*, std::pair<ValID, int> >::iterator I =
6850 CurModule.PlaceHolderInfo.find(V);
6852 if (I != CurModule.PlaceHolderInfo.end()) {
6853 ValID &DID = I->second.first;
6854 if (DID.Type == ValID::LocalName) {
6855 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6857 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6860 delete ParserResult;
6865 // Check to make sure that parsing produced a result
6869 // Reset ParserResult variable while saving its value for the result.
6870 Module *Result = ParserResult;
6876 void llvm::GenerateError(const std::string &message, int LineNo) {
6877 if (LineNo == -1) LineNo = LLLgetLineNo();
6878 // TODO: column number in exception
6880 TheParseError->setError(LLLgetFilename(), message, LineNo);
6884 int yyerror(const char *ErrorMsg) {
6885 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6886 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6887 if (yychar != YYEMPTY && yychar != 0) {
6888 errMsg += " while reading token: '";
6889 errMsg += std::string(LLLgetTokenStart(),
6890 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6892 GenerateError(errMsg);