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,
231 #define ESINT64VAL 258
232 #define EUINT64VAL 259
233 #define ESAPINTVAL 260
234 #define EUAPINTVAL 261
235 #define LOCALVAL_ID 262
236 #define GLOBALVAL_ID 263
244 #define PPC_FP128 271
248 #define GLOBALVAR 275
250 #define STRINGCONSTANT 277
251 #define ATSTRINGCONSTANT 278
252 #define PCTSTRINGCONSTANT 279
253 #define ZEROINITIALIZER 280
265 #define THREAD_LOCAL 292
267 #define DOTDOTDOT 294
273 #define APPENDING 300
274 #define DLLIMPORT 301
275 #define DLLEXPORT 302
276 #define EXTERN_WEAK 303
283 #define ADDRSPACE 310
289 #define SIDEEFFECT 316
292 #define FASTCC_TOK 319
293 #define COLDCC_TOK 320
294 #define X86_STDCALLCC_TOK 321
295 #define X86_FASTCALLCC_TOK 322
296 #define DATALAYOUT 323
302 #define UNREACHABLE 329
347 #define GETELEMENTPTR 374
363 #define EXTRACTELEMENT 390
364 #define INSERTELEMENT 391
365 #define SHUFFLEVECTOR 392
366 #define GETRESULT 393
381 #define PROTECTED 408
386 /* Copy the first part of user declarations. */
387 #line 14 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
389 #include "ParserInternals.h"
390 #include "llvm/CallingConv.h"
391 #include "llvm/InlineAsm.h"
392 #include "llvm/Instructions.h"
393 #include "llvm/Module.h"
394 #include "llvm/ValueSymbolTable.h"
395 #include "llvm/AutoUpgrade.h"
396 #include "llvm/Support/GetElementPtrTypeIterator.h"
397 #include "llvm/Support/CommandLine.h"
398 #include "llvm/ADT/SmallVector.h"
399 #include "llvm/ADT/STLExtras.h"
400 #include "llvm/Support/MathExtras.h"
401 #include "llvm/Support/Streams.h"
407 // The following is a gross hack. In order to rid the libAsmParser library of
408 // exceptions, we have to have a way of getting the yyparse function to go into
409 // an error situation. So, whenever we want an error to occur, the GenerateError
410 // function (see bottom of file) sets TriggerError. Then, at the end of each
411 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
412 // (a goto) to put YACC in error state. Furthermore, several calls to
413 // GenerateError are made from inside productions and they must simulate the
414 // previous exception behavior by exiting the production immediately. We have
415 // replaced these with the GEN_ERROR macro which calls GeneratError and then
416 // immediately invokes YYERROR. This would be so much cleaner if it was a
417 // recursive descent parser.
418 static bool TriggerError = false;
419 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
420 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
422 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
423 int yylex(); // declaration" of xxx warnings.
425 using namespace llvm;
427 static Module *ParserResult;
429 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
430 // relating to upreferences in the input stream.
432 //#define DEBUG_UPREFS 1
434 #define UR_OUT(X) cerr << X
439 #define YYERROR_VERBOSE 1
441 static GlobalVariable *CurGV;
444 // This contains info used when building the body of a function. It is
445 // destroyed when the function is completed.
447 typedef std::vector<Value *> ValueList; // Numbered defs
450 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
452 static struct PerModuleInfo {
453 Module *CurrentModule;
454 ValueList Values; // Module level numbered definitions
455 ValueList LateResolveValues;
456 std::vector<PATypeHolder> Types;
457 std::map<ValID, PATypeHolder> LateResolveTypes;
459 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
460 /// how they were referenced and on which line of the input they came from so
461 /// that we can resolve them later and print error messages as appropriate.
462 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
464 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
465 // references to global values. Global values may be referenced before they
466 // are defined, and if so, the temporary object that they represent is held
467 // here. This is used for forward references of GlobalValues.
469 typedef std::map<std::pair<const PointerType *,
470 ValID>, GlobalValue*> GlobalRefsType;
471 GlobalRefsType GlobalRefs;
474 // If we could not resolve some functions at function compilation time
475 // (calls to functions before they are defined), resolve them now... Types
476 // are resolved when the constant pool has been completely parsed.
478 ResolveDefinitions(LateResolveValues);
482 // Check to make sure that all global value forward references have been
485 if (!GlobalRefs.empty()) {
486 std::string UndefinedReferences = "Unresolved global references exist:\n";
488 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
490 UndefinedReferences += " " + I->first.first->getDescription() + " " +
491 I->first.second.getName() + "\n";
493 GenerateError(UndefinedReferences);
497 // Look for intrinsic functions and CallInst that need to be upgraded
498 for (Module::iterator FI = CurrentModule->begin(),
499 FE = CurrentModule->end(); FI != FE; )
500 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
502 Values.clear(); // Clear out function local definitions
507 // GetForwardRefForGlobal - Check to see if there is a forward reference
508 // for this global. If so, remove it from the GlobalRefs map and return it.
509 // If not, just return null.
510 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
511 // Check to see if there is a forward reference to this global variable...
512 // if there is, eliminate it and patch the reference to use the new def'n.
513 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
514 GlobalValue *Ret = 0;
515 if (I != GlobalRefs.end()) {
522 bool TypeIsUnresolved(PATypeHolder* PATy) {
523 // If it isn't abstract, its resolved
524 const Type* Ty = PATy->get();
525 if (!Ty->isAbstract())
527 // Traverse the type looking for abstract types. If it isn't abstract then
528 // we don't need to traverse that leg of the type.
529 std::vector<const Type*> WorkList, SeenList;
530 WorkList.push_back(Ty);
531 while (!WorkList.empty()) {
532 const Type* Ty = WorkList.back();
533 SeenList.push_back(Ty);
535 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
536 // Check to see if this is an unresolved type
537 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
538 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
539 for ( ; I != E; ++I) {
540 if (I->second.get() == OpTy)
543 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
544 const Type* TheTy = SeqTy->getElementType();
545 if (TheTy->isAbstract() && TheTy != Ty) {
546 std::vector<const Type*>::iterator I = SeenList.begin(),
552 WorkList.push_back(TheTy);
554 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
555 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
556 const Type* TheTy = StrTy->getElementType(i);
557 if (TheTy->isAbstract() && TheTy != Ty) {
558 std::vector<const Type*>::iterator I = SeenList.begin(),
564 WorkList.push_back(TheTy);
573 static struct PerFunctionInfo {
574 Function *CurrentFunction; // Pointer to current function being created
576 ValueList Values; // Keep track of #'d definitions
578 ValueList LateResolveValues;
579 bool isDeclare; // Is this function a forward declararation?
580 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
581 GlobalValue::VisibilityTypes Visibility;
583 /// BBForwardRefs - When we see forward references to basic blocks, keep
584 /// track of them here.
585 std::map<ValID, BasicBlock*> BBForwardRefs;
587 inline PerFunctionInfo() {
590 Linkage = GlobalValue::ExternalLinkage;
591 Visibility = GlobalValue::DefaultVisibility;
594 inline void FunctionStart(Function *M) {
599 void FunctionDone() {
600 // Any forward referenced blocks left?
601 if (!BBForwardRefs.empty()) {
602 GenerateError("Undefined reference to label " +
603 BBForwardRefs.begin()->second->getName());
607 // Resolve all forward references now.
608 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
610 Values.clear(); // Clear out function local definitions
611 BBForwardRefs.clear();
614 Linkage = GlobalValue::ExternalLinkage;
615 Visibility = GlobalValue::DefaultVisibility;
617 } CurFun; // Info for the current function...
619 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
622 //===----------------------------------------------------------------------===//
623 // Code to handle definitions of all the types
624 //===----------------------------------------------------------------------===//
626 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
627 // Things that have names or are void typed don't get slot numbers
628 if (V->hasName() || (V->getType() == Type::VoidTy))
631 // In the case of function values, we have to allow for the forward reference
632 // of basic blocks, which are included in the numbering. Consequently, we keep
633 // track of the next insertion location with NextValNum. When a BB gets
634 // inserted, it could change the size of the CurFun.Values vector.
635 if (&ValueTab == &CurFun.Values) {
636 if (ValueTab.size() <= CurFun.NextValNum)
637 ValueTab.resize(CurFun.NextValNum+1);
638 ValueTab[CurFun.NextValNum++] = V;
641 // For all other lists, its okay to just tack it on the back of the vector.
642 ValueTab.push_back(V);
645 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
647 case ValID::LocalID: // Is it a numbered definition?
648 // Module constants occupy the lowest numbered slots...
649 if (D.Num < CurModule.Types.size())
650 return CurModule.Types[D.Num];
652 case ValID::LocalName: // Is it a named definition?
653 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
654 D.destroy(); // Free old strdup'd memory...
659 GenerateError("Internal parser error: Invalid symbol type reference");
663 // If we reached here, we referenced either a symbol that we don't know about
664 // or an id number that hasn't been read yet. We may be referencing something
665 // forward, so just create an entry to be resolved later and get to it...
667 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
670 if (inFunctionScope()) {
671 if (D.Type == ValID::LocalName) {
672 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
675 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
680 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
681 if (I != CurModule.LateResolveTypes.end())
684 Type *Typ = OpaqueType::get();
685 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
689 // getExistingVal - Look up the value specified by the provided type and
690 // the provided ValID. If the value exists and has already been defined, return
691 // it. Otherwise return null.
693 static Value *getExistingVal(const Type *Ty, const ValID &D) {
694 if (isa<FunctionType>(Ty)) {
695 GenerateError("Functions are not values and "
696 "must be referenced as pointers");
701 case ValID::LocalID: { // Is it a numbered definition?
702 // Check that the number is within bounds.
703 if (D.Num >= CurFun.Values.size())
705 Value *Result = CurFun.Values[D.Num];
706 if (Ty != Result->getType()) {
707 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
708 Result->getType()->getDescription() + "' does not match "
709 "expected type, '" + Ty->getDescription() + "'");
714 case ValID::GlobalID: { // Is it a numbered definition?
715 if (D.Num >= CurModule.Values.size())
717 Value *Result = CurModule.Values[D.Num];
718 if (Ty != Result->getType()) {
719 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
720 Result->getType()->getDescription() + "' does not match "
721 "expected type, '" + Ty->getDescription() + "'");
727 case ValID::LocalName: { // Is it a named definition?
728 if (!inFunctionScope())
730 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
731 Value *N = SymTab.lookup(D.getName());
734 if (N->getType() != Ty)
737 D.destroy(); // Free old strdup'd memory...
740 case ValID::GlobalName: { // Is it a named definition?
741 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
742 Value *N = SymTab.lookup(D.getName());
745 if (N->getType() != Ty)
748 D.destroy(); // Free old strdup'd memory...
752 // Check to make sure that "Ty" is an integral type, and that our
753 // value will fit into the specified type...
754 case ValID::ConstSIntVal: // Is it a constant pool reference??
755 if (!isa<IntegerType>(Ty) ||
756 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
757 GenerateError("Signed integral constant '" +
758 itostr(D.ConstPool64) + "' is invalid for type '" +
759 Ty->getDescription() + "'");
762 return ConstantInt::get(Ty, D.ConstPool64, true);
764 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
765 if (isa<IntegerType>(Ty) &&
766 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
767 return ConstantInt::get(Ty, D.UConstPool64);
769 if (!isa<IntegerType>(Ty) ||
770 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
771 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
772 "' is invalid or out of range for type '" +
773 Ty->getDescription() + "'");
776 // This is really a signed reference. Transmogrify.
777 return ConstantInt::get(Ty, D.ConstPool64, true);
779 case ValID::ConstFPVal: // Is it a floating point const pool reference?
780 if (!Ty->isFloatingPoint() ||
781 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
782 GenerateError("FP constant invalid for type");
785 // Lexer has no type info, so builds all float and double FP constants
786 // as double. Fix this here. Long double does not need this.
787 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
789 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
790 return ConstantFP::get(*D.ConstPoolFP);
792 case ValID::ConstNullVal: // Is it a null value?
793 if (!isa<PointerType>(Ty)) {
794 GenerateError("Cannot create a a non pointer null");
797 return ConstantPointerNull::get(cast<PointerType>(Ty));
799 case ValID::ConstUndefVal: // Is it an undef value?
800 return UndefValue::get(Ty);
802 case ValID::ConstZeroVal: // Is it a zero value?
803 return Constant::getNullValue(Ty);
805 case ValID::ConstantVal: // Fully resolved constant?
806 if (D.ConstantValue->getType() != Ty) {
807 GenerateError("Constant expression type different from required type");
810 return D.ConstantValue;
812 case ValID::InlineAsmVal: { // Inline asm expression
813 const PointerType *PTy = dyn_cast<PointerType>(Ty);
814 const FunctionType *FTy =
815 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
816 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
817 GenerateError("Invalid type for asm constraint string");
820 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
821 D.IAD->HasSideEffects);
822 D.destroy(); // Free InlineAsmDescriptor.
826 assert(0 && "Unhandled case!");
830 assert(0 && "Unhandled case!");
834 // getVal - This function is identical to getExistingVal, except that if a
835 // value is not already defined, it "improvises" by creating a placeholder var
836 // that looks and acts just like the requested variable. When the value is
837 // defined later, all uses of the placeholder variable are replaced with the
840 static Value *getVal(const Type *Ty, const ValID &ID) {
841 if (Ty == Type::LabelTy) {
842 GenerateError("Cannot use a basic block here");
846 // See if the value has already been defined.
847 Value *V = getExistingVal(Ty, ID);
849 if (TriggerError) return 0;
851 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
852 GenerateError("Invalid use of a composite type");
856 // If we reached here, we referenced either a symbol that we don't know about
857 // or an id number that hasn't been read yet. We may be referencing something
858 // forward, so just create an entry to be resolved later and get to it...
861 case ValID::GlobalName:
862 case ValID::GlobalID: {
863 const PointerType *PTy = dyn_cast<PointerType>(Ty);
865 GenerateError("Invalid type for reference to global" );
868 const Type* ElTy = PTy->getElementType();
869 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
870 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
872 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
873 (Module*)0, false, PTy->getAddressSpace());
877 V = new Argument(Ty);
880 // Remember where this forward reference came from. FIXME, shouldn't we try
881 // to recycle these things??
882 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
885 if (inFunctionScope())
886 InsertValue(V, CurFun.LateResolveValues);
888 InsertValue(V, CurModule.LateResolveValues);
892 /// defineBBVal - This is a definition of a new basic block with the specified
893 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
894 static BasicBlock *defineBBVal(const ValID &ID) {
895 assert(inFunctionScope() && "Can't get basic block at global scope!");
899 // First, see if this was forward referenced
901 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
902 if (BBI != CurFun.BBForwardRefs.end()) {
904 // The forward declaration could have been inserted anywhere in the
905 // function: insert it into the correct place now.
906 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
907 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
909 // We're about to erase the entry, save the key so we can clean it up.
910 ValID Tmp = BBI->first;
912 // Erase the forward ref from the map as its no longer "forward"
913 CurFun.BBForwardRefs.erase(ID);
915 // The key has been removed from the map but so we don't want to leave
916 // strdup'd memory around so destroy it too.
919 // If its a numbered definition, bump the number and set the BB value.
920 if (ID.Type == ValID::LocalID) {
921 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
925 // We haven't seen this BB before and its first mention is a definition.
926 // Just create it and return it.
927 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
928 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
929 if (ID.Type == ValID::LocalID) {
930 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
939 /// getBBVal - get an existing BB value or create a forward reference for it.
941 static BasicBlock *getBBVal(const ValID &ID) {
942 assert(inFunctionScope() && "Can't get basic block at global scope!");
946 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
947 if (BBI != CurFun.BBForwardRefs.end()) {
949 } if (ID.Type == ValID::LocalName) {
950 std::string Name = ID.getName();
951 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
953 if (N->getType()->getTypeID() == Type::LabelTyID)
954 BB = cast<BasicBlock>(N);
956 GenerateError("Reference to label '" + Name + "' is actually of type '"+
957 N->getType()->getDescription() + "'");
959 } else if (ID.Type == ValID::LocalID) {
960 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
961 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
962 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
964 GenerateError("Reference to label '%" + utostr(ID.Num) +
965 "' is actually of type '"+
966 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
969 GenerateError("Illegal label reference " + ID.getName());
973 // If its already been defined, return it now.
975 ID.destroy(); // Free strdup'd memory.
979 // Otherwise, this block has not been seen before, create it.
981 if (ID.Type == ValID::LocalName)
983 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
985 // Insert it in the forward refs map.
986 CurFun.BBForwardRefs[ID] = BB;
992 //===----------------------------------------------------------------------===//
993 // Code to handle forward references in instructions
994 //===----------------------------------------------------------------------===//
996 // This code handles the late binding needed with statements that reference
997 // values not defined yet... for example, a forward branch, or the PHI node for
1000 // This keeps a table (CurFun.LateResolveValues) of all such forward references
1001 // and back patchs after we are done.
1004 // ResolveDefinitions - If we could not resolve some defs at parsing
1005 // time (forward branches, phi functions for loops, etc...) resolve the
1009 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1010 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1011 while (!LateResolvers.empty()) {
1012 Value *V = LateResolvers.back();
1013 LateResolvers.pop_back();
1015 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1016 CurModule.PlaceHolderInfo.find(V);
1017 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1019 ValID &DID = PHI->second.first;
1021 Value *TheRealValue = getExistingVal(V->getType(), DID);
1025 V->replaceAllUsesWith(TheRealValue);
1027 CurModule.PlaceHolderInfo.erase(PHI);
1028 } else if (FutureLateResolvers) {
1029 // Functions have their unresolved items forwarded to the module late
1031 InsertValue(V, *FutureLateResolvers);
1033 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1034 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1035 "' of type '" + V->getType()->getDescription() + "'",
1036 PHI->second.second);
1039 GenerateError("Reference to an invalid definition: #" +
1040 itostr(DID.Num) + " of type '" +
1041 V->getType()->getDescription() + "'",
1042 PHI->second.second);
1047 LateResolvers.clear();
1050 // ResolveTypeTo - A brand new type was just declared. This means that (if
1051 // name is not null) things referencing Name can be resolved. Otherwise, things
1052 // refering to the number can be resolved. Do this now.
1054 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1057 D = ValID::createLocalName(*Name);
1059 D = ValID::createLocalID(CurModule.Types.size());
1061 std::map<ValID, PATypeHolder>::iterator I =
1062 CurModule.LateResolveTypes.find(D);
1063 if (I != CurModule.LateResolveTypes.end()) {
1064 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1065 CurModule.LateResolveTypes.erase(I);
1069 // setValueName - Set the specified value to the name given. The name may be
1070 // null potentially, in which case this is a noop. The string passed in is
1071 // assumed to be a malloc'd string buffer, and is free'd by this function.
1073 static void setValueName(Value *V, std::string *NameStr) {
1074 if (!NameStr) return;
1075 std::string Name(*NameStr); // Copy string
1076 delete NameStr; // Free old string
1078 if (V->getType() == Type::VoidTy) {
1079 GenerateError("Can't assign name '" + Name+"' to value with void type");
1083 assert(inFunctionScope() && "Must be in function scope!");
1084 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1085 if (ST.lookup(Name)) {
1086 GenerateError("Redefinition of value '" + Name + "' of type '" +
1087 V->getType()->getDescription() + "'");
1095 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1096 /// this is a declaration, otherwise it is a definition.
1097 static GlobalVariable *
1098 ParseGlobalVariable(std::string *NameStr,
1099 GlobalValue::LinkageTypes Linkage,
1100 GlobalValue::VisibilityTypes Visibility,
1101 bool isConstantGlobal, const Type *Ty,
1102 Constant *Initializer, bool IsThreadLocal,
1103 unsigned AddressSpace = 0) {
1104 if (isa<FunctionType>(Ty)) {
1105 GenerateError("Cannot declare global vars of function type");
1109 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1113 Name = *NameStr; // Copy string
1114 delete NameStr; // Free old string
1117 // See if this global value was forward referenced. If so, recycle the
1120 if (!Name.empty()) {
1121 ID = ValID::createGlobalName(Name);
1123 ID = ValID::createGlobalID(CurModule.Values.size());
1126 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1127 // Move the global to the end of the list, from whereever it was
1128 // previously inserted.
1129 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1130 CurModule.CurrentModule->getGlobalList().remove(GV);
1131 CurModule.CurrentModule->getGlobalList().push_back(GV);
1132 GV->setInitializer(Initializer);
1133 GV->setLinkage(Linkage);
1134 GV->setVisibility(Visibility);
1135 GV->setConstant(isConstantGlobal);
1136 GV->setThreadLocal(IsThreadLocal);
1137 InsertValue(GV, CurModule.Values);
1141 // If this global has a name
1142 if (!Name.empty()) {
1143 // if the global we're parsing has an initializer (is a definition) and
1144 // has external linkage.
1145 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1146 // If there is already a global with external linkage with this name
1147 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1148 // If we allow this GVar to get created, it will be renamed in the
1149 // symbol table because it conflicts with an existing GVar. We can't
1150 // allow redefinition of GVars whose linking indicates that their name
1151 // must stay the same. Issue the error.
1152 GenerateError("Redefinition of global variable named '" + Name +
1153 "' of type '" + Ty->getDescription() + "'");
1158 // Otherwise there is no existing GV to use, create one now.
1159 GlobalVariable *GV =
1160 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1161 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1162 GV->setVisibility(Visibility);
1163 InsertValue(GV, CurModule.Values);
1167 // setTypeName - Set the specified type to the name given. The name may be
1168 // null potentially, in which case this is a noop. The string passed in is
1169 // assumed to be a malloc'd string buffer, and is freed by this function.
1171 // This function returns true if the type has already been defined, but is
1172 // allowed to be redefined in the specified context. If the name is a new name
1173 // for the type plane, it is inserted and false is returned.
1174 static bool setTypeName(const Type *T, std::string *NameStr) {
1175 assert(!inFunctionScope() && "Can't give types function-local names!");
1176 if (NameStr == 0) return false;
1178 std::string Name(*NameStr); // Copy string
1179 delete NameStr; // Free old string
1181 // We don't allow assigning names to void type
1182 if (T == Type::VoidTy) {
1183 GenerateError("Can't assign name '" + Name + "' to the void type");
1187 // Set the type name, checking for conflicts as we do so.
1188 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1190 if (AlreadyExists) { // Inserting a name that is already defined???
1191 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1192 assert(Existing && "Conflict but no matching type?!");
1194 // There is only one case where this is allowed: when we are refining an
1195 // opaque type. In this case, Existing will be an opaque type.
1196 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1197 // We ARE replacing an opaque type!
1198 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1202 // Otherwise, this is an attempt to redefine a type. That's okay if
1203 // the redefinition is identical to the original. This will be so if
1204 // Existing and T point to the same Type object. In this one case we
1205 // allow the equivalent redefinition.
1206 if (Existing == T) return true; // Yes, it's equal.
1208 // Any other kind of (non-equivalent) redefinition is an error.
1209 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1210 T->getDescription() + "'");
1216 //===----------------------------------------------------------------------===//
1217 // Code for handling upreferences in type names...
1220 // TypeContains - Returns true if Ty directly contains E in it.
1222 static bool TypeContains(const Type *Ty, const Type *E) {
1223 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1224 E) != Ty->subtype_end();
1228 struct UpRefRecord {
1229 // NestingLevel - The number of nesting levels that need to be popped before
1230 // this type is resolved.
1231 unsigned NestingLevel;
1233 // LastContainedTy - This is the type at the current binding level for the
1234 // type. Every time we reduce the nesting level, this gets updated.
1235 const Type *LastContainedTy;
1237 // UpRefTy - This is the actual opaque type that the upreference is
1238 // represented with.
1239 OpaqueType *UpRefTy;
1241 UpRefRecord(unsigned NL, OpaqueType *URTy)
1242 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1246 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1247 static std::vector<UpRefRecord> UpRefs;
1249 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1250 /// called. It loops through the UpRefs vector, which is a list of the
1251 /// currently active types. For each type, if the up reference is contained in
1252 /// the newly completed type, we decrement the level count. When the level
1253 /// count reaches zero, the upreferenced type is the type that is passed in:
1254 /// thus we can complete the cycle.
1256 static PATypeHolder HandleUpRefs(const Type *ty) {
1257 // If Ty isn't abstract, or if there are no up-references in it, then there is
1258 // nothing to resolve here.
1259 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1261 PATypeHolder Ty(ty);
1262 UR_OUT("Type '" << Ty->getDescription() <<
1263 "' newly formed. Resolving upreferences.\n" <<
1264 UpRefs.size() << " upreferences active!\n");
1266 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1267 // to zero), we resolve them all together before we resolve them to Ty. At
1268 // the end of the loop, if there is anything to resolve to Ty, it will be in
1270 OpaqueType *TypeToResolve = 0;
1272 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1273 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1274 << UpRefs[i].second->getDescription() << ") = "
1275 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1276 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1277 // Decrement level of upreference
1278 unsigned Level = --UpRefs[i].NestingLevel;
1279 UpRefs[i].LastContainedTy = Ty;
1280 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1281 if (Level == 0) { // Upreference should be resolved!
1282 if (!TypeToResolve) {
1283 TypeToResolve = UpRefs[i].UpRefTy;
1285 UR_OUT(" * Resolving upreference for "
1286 << UpRefs[i].second->getDescription() << "\n";
1287 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1288 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1289 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1290 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1292 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1293 --i; // Do not skip the next element...
1298 if (TypeToResolve) {
1299 UR_OUT(" * Resolving upreference for "
1300 << UpRefs[i].second->getDescription() << "\n";
1301 std::string OldName = TypeToResolve->getDescription());
1302 TypeToResolve->refineAbstractTypeTo(Ty);
1308 //===----------------------------------------------------------------------===//
1309 // RunVMAsmParser - Define an interface to this parser
1310 //===----------------------------------------------------------------------===//
1312 static Module* RunParser(Module * M);
1314 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1316 Module *M = RunParser(new Module(LLLgetFilename()));
1323 /* Enabling traces. */
1328 /* Enabling verbose error messages. */
1329 #ifdef YYERROR_VERBOSE
1330 # undef YYERROR_VERBOSE
1331 # define YYERROR_VERBOSE 1
1333 # define YYERROR_VERBOSE 0
1336 /* Enabling the token table. */
1337 #ifndef YYTOKEN_TABLE
1338 # define YYTOKEN_TABLE 0
1341 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1342 typedef union YYSTYPE
1343 #line 949 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
1345 llvm::Module *ModuleVal;
1346 llvm::Function *FunctionVal;
1347 llvm::BasicBlock *BasicBlockVal;
1348 llvm::TerminatorInst *TermInstVal;
1349 llvm::Instruction *InstVal;
1350 llvm::Constant *ConstVal;
1352 const llvm::Type *PrimType;
1353 std::list<llvm::PATypeHolder> *TypeList;
1354 llvm::PATypeHolder *TypeVal;
1355 llvm::Value *ValueVal;
1356 std::vector<llvm::Value*> *ValueList;
1357 llvm::ArgListType *ArgList;
1358 llvm::TypeWithAttrs TypeWithAttrs;
1359 llvm::TypeWithAttrsList *TypeWithAttrsList;
1360 llvm::ParamList *ParamList;
1362 // Represent the RHS of PHI node
1363 std::list<std::pair<llvm::Value*,
1364 llvm::BasicBlock*> > *PHIList;
1365 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1366 std::vector<llvm::Constant*> *ConstVector;
1368 llvm::GlobalValue::LinkageTypes Linkage;
1369 llvm::GlobalValue::VisibilityTypes Visibility;
1370 llvm::ParameterAttributes ParamAttrs;
1371 llvm::APInt *APIntVal;
1376 llvm::APFloat *FPVal;
1379 std::string *StrVal; // This memory must be deleted
1380 llvm::ValID ValIDVal;
1382 llvm::Instruction::BinaryOps BinaryOpVal;
1383 llvm::Instruction::TermOps TermOpVal;
1384 llvm::Instruction::MemoryOps MemOpVal;
1385 llvm::Instruction::CastOps CastOpVal;
1386 llvm::Instruction::OtherOps OtherOpVal;
1387 llvm::ICmpInst::Predicate IPredicate;
1388 llvm::FCmpInst::Predicate FPredicate;
1390 /* Line 193 of yacc.c. */
1391 #line 1392 "llvmAsmParser.tab.c"
1393 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1394 # define YYSTYPE_IS_DECLARED 1
1395 # define YYSTYPE_IS_TRIVIAL 1
1400 /* Copy the second part of user declarations. */
1403 /* Line 216 of yacc.c. */
1404 #line 1405 "llvmAsmParser.tab.c"
1411 typedef YYTYPE_UINT8 yytype_uint8;
1413 typedef unsigned char yytype_uint8;
1417 typedef YYTYPE_INT8 yytype_int8;
1418 #elif (defined __STDC__ || defined __C99__FUNC__ \
1419 || defined __cplusplus || defined _MSC_VER)
1420 typedef signed char yytype_int8;
1422 typedef short int yytype_int8;
1425 #ifdef YYTYPE_UINT16
1426 typedef YYTYPE_UINT16 yytype_uint16;
1428 typedef unsigned short int yytype_uint16;
1432 typedef YYTYPE_INT16 yytype_int16;
1434 typedef short int yytype_int16;
1438 # ifdef __SIZE_TYPE__
1439 # define YYSIZE_T __SIZE_TYPE__
1440 # elif defined size_t
1441 # define YYSIZE_T size_t
1442 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1443 || defined __cplusplus || defined _MSC_VER)
1444 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1445 # define YYSIZE_T size_t
1447 # define YYSIZE_T unsigned int
1451 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1454 # if defined YYENABLE_NLS && YYENABLE_NLS
1456 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1457 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1461 # define YY_(msgid) msgid
1465 /* Suppress unused-variable warnings by "using" E. */
1466 #if ! defined lint || defined __GNUC__
1467 # define YYUSE(e) ((void) (e))
1469 # define YYUSE(e) /* empty */
1472 /* Identity function, used to suppress warnings about constant conditions. */
1474 # define YYID(n) (n)
1476 #if (defined __STDC__ || defined __C99__FUNC__ \
1477 || defined __cplusplus || defined _MSC_VER)
1490 #if ! defined yyoverflow || YYERROR_VERBOSE
1492 /* The parser invokes alloca or malloc; define the necessary symbols. */
1494 # ifdef YYSTACK_USE_ALLOCA
1495 # if YYSTACK_USE_ALLOCA
1497 # define YYSTACK_ALLOC __builtin_alloca
1498 # elif defined __BUILTIN_VA_ARG_INCR
1499 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1501 # define YYSTACK_ALLOC __alloca
1502 # elif defined _MSC_VER
1503 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1504 # define alloca _alloca
1506 # define YYSTACK_ALLOC alloca
1507 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1508 || defined __cplusplus || defined _MSC_VER)
1509 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1511 # define _STDLIB_H 1
1518 # ifdef YYSTACK_ALLOC
1519 /* Pacify GCC's `empty if-body' warning. */
1520 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1521 # ifndef YYSTACK_ALLOC_MAXIMUM
1522 /* The OS might guarantee only one guard page at the bottom of the stack,
1523 and a page size can be as small as 4096 bytes. So we cannot safely
1524 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1525 to allow for a few compiler-allocated temporary stack slots. */
1526 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1529 # define YYSTACK_ALLOC YYMALLOC
1530 # define YYSTACK_FREE YYFREE
1531 # ifndef YYSTACK_ALLOC_MAXIMUM
1532 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1534 # if (defined __cplusplus && ! defined _STDLIB_H \
1535 && ! ((defined YYMALLOC || defined malloc) \
1536 && (defined YYFREE || defined free)))
1537 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1539 # define _STDLIB_H 1
1543 # define YYMALLOC malloc
1544 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1545 || defined __cplusplus || defined _MSC_VER)
1546 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1550 # define YYFREE free
1551 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1552 || defined __cplusplus || defined _MSC_VER)
1553 void free (void *); /* INFRINGES ON USER NAME SPACE */
1557 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1560 #if (! defined yyoverflow \
1561 && (! defined __cplusplus \
1562 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1564 /* A type that is properly aligned for any stack member. */
1571 /* The size of the maximum gap between one aligned stack and the next. */
1572 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1574 /* The size of an array large to enough to hold all stacks, each with
1576 # define YYSTACK_BYTES(N) \
1577 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1578 + YYSTACK_GAP_MAXIMUM)
1580 /* Copy COUNT objects from FROM to TO. The source and destination do
1583 # if defined __GNUC__ && 1 < __GNUC__
1584 # define YYCOPY(To, From, Count) \
1585 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1587 # define YYCOPY(To, From, Count) \
1591 for (yyi = 0; yyi < (Count); yyi++) \
1592 (To)[yyi] = (From)[yyi]; \
1598 /* Relocate STACK from its old location to the new one. The
1599 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1600 elements in the stack, and YYPTR gives the new location of the
1601 stack. Advance YYPTR to a properly aligned location for the next
1603 # define YYSTACK_RELOCATE(Stack) \
1606 YYSIZE_T yynewbytes; \
1607 YYCOPY (&yyptr->Stack, Stack, yysize); \
1608 Stack = &yyptr->Stack; \
1609 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1610 yyptr += yynewbytes / sizeof (*yyptr); \
1616 /* YYFINAL -- State number of the termination state. */
1618 /* YYLAST -- Last index in YYTABLE. */
1621 /* YYNTOKENS -- Number of terminals. */
1622 #define YYNTOKENS 168
1623 /* YYNNTS -- Number of nonterminals. */
1625 /* YYNRULES -- Number of rules. */
1626 #define YYNRULES 327
1627 /* YYNRULES -- Number of states. */
1628 #define YYNSTATES 656
1630 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1631 #define YYUNDEFTOK 2
1632 #define YYMAXUTOK 408
1634 #define YYTRANSLATE(YYX) \
1635 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1637 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1638 static const yytype_uint8 yytranslate[] =
1640 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1644 154, 155, 158, 2, 157, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 163, 156, 164, 2, 2, 2, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 160, 159, 162, 2, 2, 2, 2, 2, 167,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 161, 2, 2, 165, 2, 166, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 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, 1, 2, 3, 4,
1666 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1667 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1668 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1669 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1670 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1671 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1672 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1673 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1674 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1675 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1676 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1677 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1678 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1679 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1680 145, 146, 147, 148, 149, 150, 151, 152, 153
1684 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1686 static const yytype_uint16 yyprhs[] =
1688 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1689 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1690 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1691 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1692 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1693 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1694 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1695 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1696 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1697 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1698 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1699 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1700 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1701 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1702 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1703 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1704 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1705 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1706 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1707 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
1708 526, 535, 544, 548, 550, 552, 554, 556, 557, 560,
1709 567, 569, 570, 572, 575, 576, 580, 581, 585, 589,
1710 593, 597, 598, 607, 608, 618, 619, 629, 635, 638,
1711 642, 644, 648, 652, 656, 660, 662, 663, 669, 673,
1712 675, 679, 681, 682, 693, 695, 697, 702, 704, 706,
1713 709, 713, 714, 716, 718, 720, 722, 724, 726, 728,
1714 730, 732, 736, 738, 744, 746, 748, 750, 752, 754,
1715 756, 759, 761, 765, 768, 771, 775, 778, 779, 781,
1716 784, 787, 791, 801, 811, 820, 835, 837, 839, 846,
1717 852, 855, 862, 870, 875, 880, 887, 894, 895, 896,
1718 900, 903, 905, 911, 917, 924, 931, 938, 945, 950,
1719 957, 962, 967, 974, 981, 984, 993, 995, 997, 998,
1720 1002, 1009, 1013, 1020, 1023, 1029, 1037, 1043
1723 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1724 static const yytype_int16 yyrhs[] =
1726 214, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1727 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1728 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1729 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1730 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1731 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1732 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1733 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1734 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1735 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1736 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
1737 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1738 -1, 19, -1, 22, -1, 24, -1, 176, -1, -1,
1739 55, 154, 4, 155, -1, -1, 176, 156, -1, -1,
1740 20, -1, 23, -1, 182, -1, -1, 180, 156, -1,
1741 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1742 49, -1, 46, -1, 48, -1, 51, -1, -1, 151,
1743 -1, 152, -1, 153, -1, -1, 46, -1, 48, -1,
1744 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1745 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
1746 -1, 66, -1, 67, -1, 62, 4, -1, 140, -1,
1747 121, -1, 139, -1, 122, -1, 142, -1, 143, -1,
1748 145, -1, 146, -1, 147, -1, 54, 4, -1, -1,
1749 191, 190, -1, 141, -1, 144, -1, 140, -1, 139,
1750 -1, 148, -1, 149, -1, -1, 193, 192, -1, -1,
1751 150, 22, -1, -1, 54, 4, -1, -1, 157, 54,
1752 4, -1, 34, 22, -1, -1, 197, -1, -1, 157,
1753 200, 199, -1, 197, -1, 54, 4, -1, 11, -1,
1754 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
1755 17, -1, 50, -1, 201, -1, 202, 178, 158, -1,
1756 236, -1, 159, 4, -1, 202, 154, 206, 155, 193,
1757 -1, 10, 154, 206, 155, 193, -1, 160, 4, 161,
1758 202, 162, -1, 163, 4, 161, 202, 164, -1, 165,
1759 207, 166, -1, 165, 166, -1, 163, 165, 207, 166,
1760 164, -1, 163, 165, 166, 164, -1, 202, 191, -1,
1761 202, -1, 10, -1, 203, -1, 205, 157, 203, -1,
1762 205, -1, 205, 157, 39, -1, 39, -1, -1, 202,
1763 -1, 207, 157, 202, -1, 202, 160, 210, 162, -1,
1764 202, 160, 162, -1, 202, 167, 22, -1, 202, 163,
1765 210, 164, -1, 202, 165, 210, 166, -1, 202, 165,
1766 166, -1, 202, 163, 165, 210, 166, 164, -1, 202,
1767 163, 165, 166, 164, -1, 202, 40, -1, 202, 41,
1768 -1, 202, 236, -1, 202, 209, -1, 202, 25, -1,
1769 174, 3, -1, 174, 5, -1, 174, 4, -1, 174,
1770 6, -1, 11, 26, -1, 11, 27, -1, 175, 9,
1771 -1, 171, 154, 208, 38, 202, 155, -1, 119, 154,
1772 208, 248, 155, -1, 133, 154, 208, 157, 208, 157,
1773 208, 155, -1, 169, 154, 208, 157, 208, 155, -1,
1774 170, 154, 208, 157, 208, 155, -1, 90, 172, 154,
1775 208, 157, 208, 155, -1, 91, 173, 154, 208, 157,
1776 208, 155, -1, 92, 172, 154, 208, 157, 208, 155,
1777 -1, 93, 173, 154, 208, 157, 208, 155, -1, 135,
1778 154, 208, 157, 208, 155, -1, 136, 154, 208, 157,
1779 208, 157, 208, 155, -1, 137, 154, 208, 157, 208,
1780 157, 208, 155, -1, 210, 157, 208, -1, 208, -1,
1781 32, -1, 33, -1, 37, -1, -1, 204, 236, -1,
1782 125, 154, 213, 38, 202, 155, -1, 215, -1, -1,
1783 216, -1, 215, 216, -1, -1, 31, 217, 232, -1,
1784 -1, 30, 218, 233, -1, 60, 59, 222, -1, 179,
1785 18, 202, -1, 179, 18, 10, -1, -1, 181, 185,
1786 212, 211, 208, 178, 219, 199, -1, -1, 181, 183,
1787 185, 212, 211, 208, 178, 220, 199, -1, -1, 181,
1788 184, 185, 212, 211, 202, 178, 221, 199, -1, 181,
1789 185, 35, 188, 213, -1, 52, 223, -1, 56, 156,
1790 224, -1, 22, -1, 53, 156, 22, -1, 68, 156,
1791 22, -1, 160, 225, 162, -1, 225, 157, 22, -1,
1792 22, -1, -1, 226, 157, 202, 191, 177, -1, 202,
1793 191, 177, -1, 226, -1, 226, 157, 39, -1, 39,
1794 -1, -1, 189, 204, 180, 154, 227, 155, 193, 198,
1795 195, 194, -1, 28, -1, 165, -1, 187, 185, 228,
1796 229, -1, 29, -1, 166, -1, 240, 231, -1, 186,
1797 185, 228, -1, -1, 61, -1, 3, -1, 4, -1,
1798 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1799 25, -1, 163, 210, 164, -1, 209, -1, 59, 234,
1800 22, 157, 22, -1, 7, -1, 8, -1, 176, -1,
1801 180, -1, 236, -1, 235, -1, 202, 237, -1, 238,
1802 -1, 239, 157, 238, -1, 240, 241, -1, 230, 241,
1803 -1, 242, 179, 243, -1, 242, 245, -1, -1, 21,
1804 -1, 69, 239, -1, 69, 10, -1, 70, 17, 237,
1805 -1, 70, 11, 237, 157, 17, 237, 157, 17, 237,
1806 -1, 71, 174, 237, 157, 17, 237, 160, 244, 162,
1807 -1, 71, 174, 237, 157, 17, 237, 160, 162, -1,
1808 72, 189, 204, 237, 154, 247, 155, 193, 38, 17,
1809 237, 73, 17, 237, -1, 73, -1, 74, -1, 244,
1810 174, 235, 157, 17, 237, -1, 174, 235, 157, 17,
1811 237, -1, 179, 250, -1, 202, 160, 237, 157, 237,
1812 162, -1, 246, 157, 160, 237, 157, 237, 162, -1,
1813 202, 191, 237, 191, -1, 17, 191, 237, 191, -1,
1814 247, 157, 202, 191, 237, 191, -1, 247, 157, 17,
1815 191, 237, 191, -1, -1, -1, 248, 157, 238, -1,
1816 58, 57, -1, 57, -1, 169, 202, 237, 157, 237,
1817 -1, 170, 202, 237, 157, 237, -1, 90, 172, 202,
1818 237, 157, 237, -1, 91, 173, 202, 237, 157, 237,
1819 -1, 92, 172, 202, 237, 157, 237, -1, 93, 173,
1820 202, 237, 157, 237, -1, 171, 238, 38, 202, -1,
1821 133, 238, 157, 238, 157, 238, -1, 134, 238, 157,
1822 202, -1, 135, 238, 157, 238, -1, 136, 238, 157,
1823 238, 157, 238, -1, 137, 238, 157, 238, 157, 238,
1824 -1, 132, 246, -1, 249, 189, 204, 237, 154, 247,
1825 155, 193, -1, 252, -1, 36, -1, -1, 114, 202,
1826 196, -1, 114, 202, 157, 11, 237, 196, -1, 115,
1827 202, 196, -1, 115, 202, 157, 11, 237, 196, -1,
1828 116, 238, -1, 251, 117, 202, 237, 196, -1, 251,
1829 118, 238, 157, 202, 237, 196, -1, 138, 202, 237,
1830 157, 4, -1, 119, 202, 237, 248, -1
1833 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1834 static const yytype_uint16 yyrline[] =
1836 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
1837 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1838 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1117,
1839 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125,
1840 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130,
1841 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1139, 1139,
1842 1139, 1141, 1141, 1141, 1142, 1142, 1144, 1145, 1149, 1153,
1843 1158, 1158, 1160, 1161, 1166, 1172, 1173, 1174, 1175, 1176,
1844 1177, 1181, 1182, 1183, 1187, 1188, 1189, 1190, 1194, 1195,
1845 1196, 1200, 1201, 1202, 1203, 1204, 1208, 1209, 1210, 1213,
1846 1214, 1215, 1216, 1217, 1218, 1219, 1226, 1227, 1228, 1229,
1847 1230, 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1245, 1246,
1848 1247, 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268,
1849 1274, 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318,
1850 1318, 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336,
1851 1341, 1349, 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449,
1852 1458, 1465, 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511,
1853 1523, 1551, 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726,
1854 1733, 1799, 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861,
1855 1874, 1886, 1907, 1915, 1921, 1932, 1937, 1942, 1947, 1952,
1856 1958, 1964, 1973, 1977, 1985, 1985, 1988, 1988, 1991, 2003,
1857 2024, 2029, 2037, 2038, 2042, 2042, 2046, 2046, 2049, 2052,
1858 2076, 2088, 2087, 2099, 2098, 2108, 2107, 2118, 2158, 2161,
1859 2167, 2177, 2181, 2186, 2188, 2193, 2198, 2207, 2217, 2228,
1860 2232, 2241, 2250, 2255, 2384, 2384, 2386, 2395, 2395, 2397,
1861 2402, 2414, 2418, 2423, 2427, 2431, 2435, 2439, 2443, 2447,
1862 2451, 2455, 2480, 2484, 2494, 2498, 2502, 2507, 2514, 2514,
1863 2520, 2529, 2534, 2539, 2543, 2552, 2561, 2570, 2574, 2582,
1864 2589, 2593, 2598, 2608, 2627, 2636, 2722, 2726, 2733, 2744,
1865 2757, 2767, 2778, 2788, 2799, 2807, 2817, 2824, 2827, 2828,
1866 2835, 2839, 2844, 2860, 2877, 2891, 2905, 2919, 2933, 2945,
1867 2953, 2960, 2966, 2972, 2978, 2993, 3083, 3088, 3092, 3099,
1868 3106, 3114, 3121, 3129, 3137, 3151, 3168, 3176
1872 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1873 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1874 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1875 static const char *const yytname[] =
1877 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1878 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1879 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1880 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1881 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1882 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1883 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1884 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1885 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
1886 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1887 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1888 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1889 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1890 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1891 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1892 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1893 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1894 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1895 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1896 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1897 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1898 "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1899 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC",
1900 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1901 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1902 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1903 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1904 "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1905 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1906 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1907 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1908 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1909 "SectionString", "OptSection", "GlobalVarAttributes",
1910 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1911 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1912 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1913 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1914 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1915 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1916 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1917 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1918 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1919 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1920 "InstVal", "OptVolatile", "MemoryInst", 0
1925 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1927 static const yytype_uint16 yytoknum[] =
1929 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1930 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1931 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1932 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1933 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1934 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1935 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1936 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1937 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1938 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1939 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1940 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1941 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1942 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1943 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1944 405, 406, 407, 408, 40, 41, 61, 44, 42, 92,
1945 91, 120, 93, 60, 62, 123, 125, 99
1949 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1950 static const yytype_uint8 yyr1[] =
1952 0, 168, 169, 169, 169, 169, 169, 169, 169, 169,
1953 169, 170, 170, 170, 170, 170, 170, 171, 171, 171,
1954 171, 171, 171, 171, 171, 171, 171, 171, 171, 172,
1955 172, 172, 172, 172, 172, 172, 172, 172, 172, 173,
1956 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
1957 173, 173, 173, 173, 173, 174, 175, 175, 175, 175,
1958 175, 176, 176, 176, 177, 177, 178, 178, 179, 179,
1959 180, 180, 181, 181, 182, 183, 183, 183, 183, 183,
1960 183, 184, 184, 184, 185, 185, 185, 185, 186, 186,
1961 186, 187, 187, 187, 187, 187, 188, 188, 188, 189,
1962 189, 189, 189, 189, 189, 189, 190, 190, 190, 190,
1963 190, 190, 190, 190, 190, 190, 191, 191, 192, 192,
1964 192, 192, 192, 192, 193, 193, 194, 194, 195, 195,
1965 196, 196, 197, 198, 198, 199, 199, 200, 200, 201,
1966 201, 201, 201, 201, 201, 201, 202, 202, 202, 202,
1967 202, 202, 202, 202, 202, 202, 202, 202, 202, 203,
1968 204, 204, 205, 205, 206, 206, 206, 206, 207, 207,
1969 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
1970 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
1971 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1972 209, 209, 210, 210, 211, 211, 212, 212, 213, 213,
1973 214, 214, 215, 215, 217, 216, 218, 216, 216, 216,
1974 216, 219, 216, 220, 216, 221, 216, 216, 216, 216,
1975 222, 223, 223, 224, 225, 225, 225, 226, 226, 227,
1976 227, 227, 227, 228, 229, 229, 230, 231, 231, 232,
1977 233, 234, 234, 235, 235, 235, 235, 235, 235, 235,
1978 235, 235, 235, 235, 236, 236, 236, 236, 237, 237,
1979 238, 239, 239, 240, 240, 241, 242, 242, 242, 243,
1980 243, 243, 243, 243, 243, 243, 243, 243, 244, 244,
1981 245, 246, 246, 247, 247, 247, 247, 247, 248, 248,
1982 249, 249, 250, 250, 250, 250, 250, 250, 250, 250,
1983 250, 250, 250, 250, 250, 250, 250, 251, 251, 252,
1984 252, 252, 252, 252, 252, 252, 252, 252
1987 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1988 static const yytype_uint8 yyr2[] =
1990 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1992 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1993 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1994 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1995 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1996 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1997 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1998 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
1999 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2000 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2001 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2002 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2003 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2004 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2005 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2006 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2007 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2008 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2009 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2010 8, 8, 3, 1, 1, 1, 1, 0, 2, 6,
2011 1, 0, 1, 2, 0, 3, 0, 3, 3, 3,
2012 3, 0, 8, 0, 9, 0, 9, 5, 2, 3,
2013 1, 3, 3, 3, 3, 1, 0, 5, 3, 1,
2014 3, 1, 0, 10, 1, 1, 4, 1, 1, 2,
2015 3, 0, 1, 1, 1, 1, 1, 1, 1, 1,
2016 1, 3, 1, 5, 1, 1, 1, 1, 1, 1,
2017 2, 1, 3, 2, 2, 3, 2, 0, 1, 2,
2018 2, 3, 9, 9, 8, 14, 1, 1, 6, 5,
2019 2, 6, 7, 4, 4, 6, 6, 0, 0, 3,
2020 2, 1, 5, 5, 6, 6, 6, 6, 4, 6,
2021 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
2022 6, 3, 6, 2, 5, 7, 5, 4
2025 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2026 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2027 means the default is an error. */
2028 static const yytype_uint16 yydefact[] =
2030 73, 61, 70, 62, 71, 63, 216, 214, 0, 0,
2031 0, 0, 0, 0, 84, 72, 0, 73, 212, 88,
2032 91, 0, 0, 228, 0, 0, 68, 0, 74, 75,
2033 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
2034 87, 84, 84, 207, 1, 213, 89, 90, 84, 217,
2035 92, 93, 94, 95, 84, 277, 215, 277, 0, 0,
2036 236, 229, 230, 218, 264, 265, 220, 139, 140, 141,
2037 144, 143, 142, 145, 146, 0, 0, 0, 0, 266,
2038 267, 147, 219, 149, 207, 207, 96, 206, 0, 99,
2039 99, 278, 274, 69, 247, 248, 249, 273, 231, 232,
2040 235, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2041 0, 0, 167, 0, 0, 0, 98, 97, 0, 204,
2042 205, 0, 0, 100, 101, 102, 103, 104, 0, 250,
2043 0, 318, 276, 0, 233, 166, 116, 162, 164, 0,
2044 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
2045 0, 161, 0, 160, 0, 227, 139, 140, 141, 144,
2046 143, 142, 0, 0, 67, 67, 105, 0, 244, 245,
2047 246, 317, 301, 0, 0, 0, 0, 99, 286, 287,
2048 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2049 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2050 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2051 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0, 0, 275, 99, 290, 0, 316,
2053 234, 159, 0, 124, 67, 67, 158, 0, 169, 0,
2054 124, 67, 67, 0, 208, 187, 188, 183, 185, 184,
2055 186, 189, 182, 178, 179, 0, 0, 0, 0, 0,
2056 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2057 0, 181, 180, 221, 0, 300, 280, 67, 271, 279,
2058 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
2059 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
2060 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
2061 47, 48, 0, 0, 0, 130, 130, 323, 67, 67,
2062 314, 0, 0, 0, 0, 0, 67, 67, 67, 0,
2063 0, 0, 0, 0, 107, 109, 108, 106, 110, 111,
2064 112, 113, 114, 117, 165, 163, 152, 153, 154, 157,
2065 66, 151, 223, 225, 0, 0, 0, 0, 0, 0,
2066 0, 0, 0, 0, 171, 203, 0, 0, 0, 175,
2067 0, 172, 0, 0, 0, 135, 242, 253, 254, 255,
2068 260, 256, 257, 258, 259, 251, 0, 262, 269, 268,
2069 270, 0, 0, 281, 0, 0, 67, 67, 67, 67,
2070 0, 319, 0, 321, 298, 0, 0, 0, 0, 0,
2071 0, 0, 0, 0, 0, 0, 0, 67, 0, 115,
2072 121, 120, 118, 119, 122, 123, 125, 135, 135, 0,
2073 0, 0, 0, 0, 298, 0, 0, 0, 0, 0,
2074 170, 156, 168, 0, 173, 174, 0, 0, 0, 0,
2075 222, 241, 116, 239, 0, 252, 0, 0, 272, 0,
2076 0, 0, 0, 0, 0, 0, 0, 0, 0, 327,
2077 0, 0, 0, 310, 311, 0, 0, 0, 0, 0,
2078 308, 0, 130, 0, 224, 226, 67, 0, 0, 0,
2079 0, 0, 0, 0, 0, 0, 202, 177, 0, 0,
2080 0, 0, 0, 0, 137, 135, 65, 0, 124, 0,
2081 261, 0, 0, 297, 0, 0, 0, 0, 130, 131,
2082 130, 0, 0, 0, 0, 0, 0, 326, 302, 303,
2083 297, 0, 324, 67, 209, 0, 0, 0, 0, 191,
2084 0, 0, 0, 0, 176, 0, 0, 67, 132, 138,
2085 136, 64, 238, 240, 116, 133, 0, 0, 0, 116,
2086 116, 0, 304, 305, 306, 307, 320, 322, 299, 0,
2087 0, 309, 312, 313, 0, 130, 0, 0, 0, 0,
2088 0, 199, 0, 0, 193, 194, 190, 65, 134, 128,
2089 263, 0, 0, 0, 0, 124, 0, 291, 0, 124,
2090 325, 195, 196, 197, 198, 0, 0, 0, 237, 0,
2091 126, 0, 284, 0, 0, 107, 109, 116, 116, 0,
2092 116, 116, 292, 315, 192, 200, 201, 129, 0, 243,
2093 282, 0, 283, 0, 294, 293, 0, 0, 0, 127,
2094 0, 0, 0, 116, 116, 0, 0, 0, 296, 295,
2095 289, 0, 0, 288, 0, 285
2098 /* YYDEFGOTO[NTERM-NUM]. */
2099 static const yytype_int16 yydefgoto[] =
2101 -1, 268, 269, 270, 295, 312, 162, 163, 79, 552,
2102 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
2103 118, 128, 343, 231, 426, 346, 629, 610, 401, 504,
2104 589, 450, 505, 81, 164, 137, 154, 138, 139, 110,
2105 365, 387, 366, 121, 88, 155, 16, 17, 18, 20,
2106 19, 375, 427, 428, 63, 23, 61, 101, 453, 454,
2107 129, 170, 55, 96, 56, 49, 456, 388, 83, 390,
2108 278, 279, 57, 92, 93, 225, 614, 132, 320, 561,
2109 469, 226, 227, 228, 229
2112 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2114 #define YYPACT_NINF -560
2115 static const yytype_int16 yypact[] =
2117 590, -560, -560, -560, -560, -560, -560, -560, 9, -119,
2118 23, -66, 80, -43, -1, -560, 132, 897, -560, 131,
2119 219, 16, 43, -560, 48, 203, -560, 1564, -560, -560,
2120 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2121 -560, -6, -6, 230, -560, -560, -560, -560, -6, -560,
2122 -560, -560, -560, -560, -6, 211, -560, -10, 223, 234,
2123 246, -560, -560, -560, -560, -560, 119, -560, -560, -560,
2124 -560, -560, -560, -560, -560, 289, 296, 2, 227, -560,
2125 -560, -560, 3, -560, 266, 266, 247, -560, 34, 121,
2126 121, -560, -560, 233, -560, -560, -560, -560, -560, -560,
2127 -560, 67, 1400, -560, 146, 151, 830, 119, -560, 3,
2128 -102, 171, 1400, 159, 34, 34, -560, -560, 1441, -560,
2129 -560, 1682, 322, -560, -560, -560, -560, -560, 1723, -560,
2130 -16, 1902, -560, 306, -560, -560, 3, -560, 172, 176,
2131 1741, 1741, 168, -101, 1741, -560, 332, 182, -560, 1682,
2132 1741, 119, 184, 3, 252, -560, 102, 335, 339, 340,
2133 343, 345, 106, 346, 1164, 303, -560, 213, -560, -560,
2134 -560, -560, -560, 302, 1764, 52, 349, 121, -560, -560,
2135 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2136 -560, -560, -560, -560, -560, 591, 440, 591, 440, 1741,
2137 1741, 1741, 1741, -560, -560, -560, -560, -560, -560, -560,
2138 -560, -560, -560, -560, -560, 1741, 1741, 1741, 1741, 1741,
2139 1741, 1741, 1741, 1741, 1741, -560, 121, -560, 36, -560,
2140 -560, 200, 1461, -560, -20, -37, -560, 198, 3, 215,
2141 -560, 303, 4, 1441, -560, -560, -560, -560, -560, -560,
2142 -560, -560, -560, -560, -560, 591, 440, 591, 440, 217,
2143 218, 220, 222, 224, 1482, 1782, 1061, 351, 225, 226,
2144 237, -560, -560, -560, 240, -560, 119, 742, -560, 231,
2145 884, 884, -560, 884, 1723, -560, -560, -560, -560, -560,
2146 -560, -560, -560, -560, -560, 1741, -560, -560, -560, -560,
2147 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2148 -560, -560, 1741, 1741, 1741, -21, 24, -560, 742, -35,
2149 238, 241, 249, 254, 255, 256, 742, 742, 742, 366,
2150 1723, 1741, 1741, 373, -560, -560, -560, -560, -560, -560,
2151 -560, -560, -560, -560, -560, -560, 175, -560, -560, -560,
2152 -560, 175, -560, 159, 371, 260, 261, 262, 263, 1682,
2153 1682, 1682, 1682, 1682, -560, -560, 91, 1105, -96, -560,
2154 -69, -560, 1682, 1682, 1682, 264, 1502, -560, -560, -560,
2155 -560, -560, -560, -560, -560, 359, 1682, -560, -560, -560,
2156 -560, 1741, 265, -560, 267, 884, 742, 742, 742, 742,
2157 21, -560, 40, -560, -560, 884, 272, 1741, 1741, 1741,
2158 1741, 1741, 268, 269, 270, 1741, 884, 742, 276, -560,
2159 -560, -560, -560, -560, -560, -560, -560, 264, 264, 1741,
2160 1682, 1682, 1682, 1682, -560, 277, 280, 281, 282, 1682,
2161 -560, 259, 1015, -62, -560, -560, 287, 290, 408, 19,
2162 -560, -560, 3, 291, 294, -560, 428, -61, -560, 434,
2163 435, 299, 297, 301, 304, 305, 884, 452, 884, 307,
2164 308, 884, 311, 3, -560, 312, 313, 455, 884, 884,
2165 3, 309, 319, 1741, -560, -560, -15, 320, 325, 326,
2166 327, 137, 1682, 1682, 1682, 1682, -560, -560, 321, 1682,
2167 1682, 1741, 438, 482, -560, 264, 386, 1523, -560, 334,
2168 -560, 884, 884, 1805, 884, 884, 884, 884, 319, -560,
2169 319, 1741, 884, 336, 1741, 1741, 1741, -560, -560, -560,
2170 1805, 443, -560, 742, -560, 1682, 1682, 1682, 1682, -560,
2171 337, 347, 344, 348, -560, 354, 355, 15, -560, -560,
2172 -560, -560, -560, -560, 3, -18, 470, 356, 352, 5,
2173 3, 156, -560, -560, -560, -560, -560, -560, -560, 341,
2174 884, -560, -560, -560, 163, 319, 360, 362, 365, 369,
2175 1682, -560, 1682, 1682, -560, -560, -560, 386, -560, 457,
2176 -560, 497, -7, 577, 577, -560, 1846, -560, 372, -560,
2177 -560, -560, -560, -560, -560, 380, 382, 383, -560, 517,
2178 404, 884, -560, 1307, -2, 401, 402, -560, -560, 82,
2179 5, 3, -560, 175, -560, -560, -560, -560, 540, -560,
2180 -560, 406, -560, 1307, 200, 200, 547, 577, 577, -560,
2181 548, 409, 884, -560, -560, 884, 551, 496, 200, 200,
2182 -560, 884, 554, -560, 884, -560
2185 /* YYPGOTO[NTERM-NUM]. */
2186 static const yytype_int16 yypgoto[] =
2188 -560, 441, 442, 444, -174, -167, -173, -560, 0, -13,
2189 -141, 483, 13, -560, -560, -560, -560, 30, -560, -560,
2190 -560, -139, -560, -416, -560, -238, -560, -560, -311, 22,
2191 -560, -406, -560, -560, -26, 350, -120, -560, 471, 485,
2192 -64, -157, -251, 100, 194, 363, -560, -560, 571, -560,
2193 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2194 499, -560, -560, -560, -560, -560, -560, -559, -115, 162,
2195 -191, -560, -560, 535, -560, -560, -560, -560, -560, 63,
2196 160, -560, -560, -560, -560
2199 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2200 positive, shift that token. If negative, reduce the rule which
2201 number is the opposite. If zero, do what YYDEFACT says.
2202 If YYTABLE_NINF, syntax error. */
2203 #define YYTABLE_NINF -212
2204 static const yytype_int16 yytable[] =
2206 11, 82, 351, 283, 282, 403, 105, 271, 167, 282,
2207 317, 91, 168, 13, 368, 370, 502, 11, 111, 94,
2208 111, 484, 485, 313, 273, 321, 322, 323, 324, 325,
2209 13, 314, 466, 329, 111, 111, 506, 24, 284, 244,
2210 111, 29, 30, 31, 32, 33, 34, 35, 36, 272,
2211 37, 468, 109, 502, 631, 144, 144, 165, 111, 111,
2212 -145, 439, 21, 280, 145, 237, 119, 120, 444, 281,
2213 111, 84, 85, 503, 641, 467, 136, 22, 89, 111,
2214 109, 355, 25, 357, 90, 241, 136, 330, 439, 356,
2215 26, 358, 153, 11, 467, 439, 439, 445, 27, 550,
2216 352, 353, 153, 510, 498, -55, -55, -55, -55, 247,
2217 248, 249, 250, 28, 234, 235, 443, 112, 238, 112,
2218 636, 420, 421, 422, 242, 405, 423, 348, 245, 246,
2219 424, 425, 44, 112, 112, 457, 400, -67, 587, 112,
2220 534, 418, 347, 593, 594, 38, 39, 40, 277, 169,
2221 38, 39, 40, 331, 332, 612, 95, 112, 112, -145,
2222 632, -67, 389, -145, 395, 389, 389, 106, 389, 112,
2223 586, 532, 58, 315, 316, 277, 318, 46, 112, 47,
2224 274, 402, -67, 122, 123, 124, 125, 126, 127, 319,
2225 277, 277, 277, 277, 277, 326, 327, 328, 277, 59,
2226 458, 634, 635, 389, 637, 638, 136, 566, 60, 567,
2227 416, 389, 389, 389, 149, 150, 472, 153, 474, 475,
2228 476, 420, 421, 422, 133, 62, 423, 648, 649, 134,
2229 424, 425, 91, 2, 64, 65, 4, 107, 67, 68,
2230 69, 70, 71, 72, 73, 98, 1, 2, 439, 3,
2231 4, 5, 1, 440, 333, 3, 99, 5, 153, 64,
2232 65, 50, 51, 52, 600, 86, 53, 87, 100, 396,
2233 555, 1, 2, 102, 3, 4, 5, 74, 114, 115,
2234 389, 389, 389, 389, 389, 271, 397, 398, 399, 116,
2235 389, 117, 539, 103, 521, 434, 435, 436, 437, 438,
2236 104, 389, 389, 87, 153, 417, 277, 140, 446, 447,
2237 448, 595, 141, 596, 420, 421, 422, 148, 599, 423,
2238 596, 334, 335, 424, 425, 146, 166, 272, 230, 232,
2239 568, 233, 236, 571, 572, 573, 239, 240, 243, 336,
2240 337, 442, 338, 339, -56, 340, 341, 342, -57, -60,
2241 452, 389, -59, 389, -58, 251, 389, 619, 111, 275,
2242 282, 623, 349, 389, 389, 277, 487, 488, 489, 490,
2243 350, 359, 360, 371, 361, 496, 362, 419, 363, 372,
2244 373, 277, 473, 277, 277, 277, 75, 76, 391, 480,
2245 77, 374, 78, 108, 376, 406, 389, 389, 407, 389,
2246 389, 389, 389, 486, 415, 1, 408, 389, 3, 429,
2247 5, 409, 410, 411, 430, 431, 432, 433, 389, 613,
2248 455, 449, 459, 497, 460, 477, 478, 479, 540, 541,
2249 542, 543, 471, 483, 492, 545, 546, 493, 494, 495,
2250 333, 633, 392, 393, 499, 394, 501, 500, 507, 508,
2251 509, 511, 512, 513, 514, 389, 519, 533, 515, 527,
2252 548, 516, 517, 530, 521, 522, 296, 297, 524, 525,
2253 526, 576, 577, 578, 579, 547, 531, 535, 389, 389,
2254 404, 554, 536, 537, 538, 544, 549, 560, 412, 413,
2255 414, 556, 590, 570, 580, 277, 389, 467, 277, 277,
2256 277, 582, 581, 597, 560, 583, 551, 334, 335, 584,
2257 585, 609, 592, 591, 611, 601, 605, 602, 606, 607,
2258 603, 627, 389, 389, 604, 336, 337, 389, 338, 339,
2259 389, 340, 341, 342, 622, 624, 389, 625, 626, 389,
2260 298, 299, 300, 301, 302, 303, 304, 305, 306, 307,
2261 308, 309, 310, 311, 628, -18, -19, 461, 462, 463,
2262 464, 465, 639, 640, 642, 645, 646, 470, 651, 652,
2263 621, 654, 222, 223, 608, 224, 131, 588, 481, 482,
2264 377, 378, 345, 147, 64, 65, 379, 551, 45, 130,
2265 -211, 143, 97, 574, 491, 0, 1, 2, 0, 3,
2266 4, 5, 380, 381, 382, 0, 354, 0, -69, 1,
2267 2, 0, 3, 4, 5, 0, 0, 383, 384, 0,
2268 6, 7, 0, 0, 0, 0, 0, 0, 518, 0,
2269 520, 333, 0, 523, 0, 0, 385, 0, 0, 0,
2270 528, 529, 8, 0, 0, 0, 9, 0, 0, 0,
2271 10, 0, 180, 181, 182, 183, 184, 185, 186, 187,
2272 188, 189, 190, 191, 192, 193, 194, 255, 256, 257,
2273 258, 0, 0, 557, 558, 0, 562, 563, 564, 565,
2274 0, 0, 0, 0, 569, 285, 286, 287, 288, 289,
2275 290, 291, 292, 293, 294, 575, 259, 203, 615, 616,
2276 206, 207, 208, 209, 210, 211, 212, 213, 214, 0,
2277 260, 0, 261, 262, 263, 0, 336, 337, 0, 338,
2278 339, 0, 340, 341, 342, 0, 0, 0, 0, 0,
2279 0, 0, 598, 0, 0, 0, 0, 0, 0, 0,
2280 386, 0, 0, 0, 0, 377, 378, 0, 0, 64,
2281 65, 379, 0, 0, 0, 617, 618, 0, 0, 0,
2282 0, 1, 2, 0, 3, 4, 5, 380, 381, 382,
2283 0, 0, 0, 630, 0, 0, 0, 0, 0, 0,
2284 0, 0, 383, 384, 0, 0, 0, 0, 0, 0,
2285 0, 0, 0, 0, 0, 0, 0, 111, 0, 643,
2286 644, 385, 0, 0, 647, 0, 0, 650, 0, 0,
2287 0, 0, 0, 653, 0, 0, 655, 180, 181, 182,
2288 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2289 193, 194, 255, 256, 257, 258, 0, 64, 65, 0,
2290 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2291 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2292 0, 259, 203, 204, 205, 206, 207, 208, 209, 210,
2293 211, 212, 213, 214, 0, 260, 0, 261, 262, 263,
2294 74, 0, 0, 0, 0, 0, 0, 377, 378, 0,
2295 0, 64, 65, 379, 0, 0, 112, -210, 0, 0,
2296 0, 0, 0, 1, 2, 386, 3, 4, 5, 380,
2297 381, 382, 0, 0, 0, -69, 1, 2, 0, 3,
2298 4, 5, 0, 0, 383, 384, 0, 6, 7, 0,
2299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2300 0, 0, 0, 385, 0, 0, 0, 0, 0, 8,
2301 0, 0, 0, 9, 0, 0, 0, 10, 0, 180,
2302 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2303 191, 192, 193, 194, 255, 256, 257, 258, 0, 0,
2304 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2305 76, 0, 0, 77, 0, 78, 142, 0, 0, 0,
2306 0, 0, 0, 259, 203, 204, 205, 206, 207, 208,
2307 209, 210, 211, 212, 213, 214, 0, 260, 0, 261,
2308 262, 263, 64, 65, 0, 0, 0, 0, 0, 0,
2309 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
2310 252, 0, 0, 0, 0, 0, 0, 386, 0, 0,
2311 0, 0, 0, 0, 0, 253, 254, 0, 0, 0,
2312 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2313 111, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2314 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2315 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2316 190, 191, 192, 193, 194, 255, 256, 257, 258, 0,
2317 0, 74, 64, 65, 0, 107, 156, 157, 158, 159,
2318 160, 161, 73, 0, 1, 2, 0, 3, 4, 5,
2319 0, 0, 0, 0, 259, 203, 204, 205, 206, 207,
2320 208, 209, 210, 211, 212, 213, 214, 0, 260, 0,
2321 261, 262, 263, 0, 0, 74, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 0, 0, 0, 112,
2323 0, 64, 65, -67, 0, 264, 0, 0, 265, 0,
2324 266, 0, 267, 1, 2, 0, 3, 4, 5, 252,
2325 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2326 0, 0, 0, 0, 253, 254, 0, 0, 0, 0,
2327 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2328 75, 76, 0, 0, 77, 0, 78, 369, 0, 0,
2329 0, 0, 0, 0, 0, 0, 0, 0, 0, 180,
2330 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2331 191, 192, 193, 194, 255, 256, 257, 258, 0, 0,
2332 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2333 78, 441, 0, 0, 0, 0, 0, 0, 0, 0,
2334 0, 0, 0, 259, 203, 204, 205, 206, 207, 208,
2335 209, 210, 211, 212, 213, 214, 0, 260, 0, 261,
2336 262, 263, 0, 0, 0, 0, 0, 0, 0, 0,
2337 377, 378, 0, 0, 0, 0, 379, 0, 112, 0,
2338 0, 0, 0, 0, 264, 0, 0, 265, 0, 266,
2339 0, 267, 380, 381, 382, 0, 0, 0, 0, 0,
2340 0, 0, 0, 0, 0, 0, 0, 383, 384, 0,
2341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2342 0, 0, 0, 0, 0, 0, 385, 0, 0, 0,
2343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2344 0, 0, 180, 181, 182, 183, 184, 185, 186, 187,
2345 188, 189, 190, 191, 192, 193, 194, 255, 256, 257,
2346 258, 0, 0, 0, 0, 0, 0, 64, 65, 0,
2347 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2348 2, 0, 3, 4, 5, 0, 259, 203, 204, 205,
2349 206, 207, 208, 209, 210, 211, 212, 213, 214, 135,
2350 260, 0, 261, 262, 263, 0, 0, 0, 64, 65,
2351 74, 151, 67, 68, 69, 70, 71, 72, 73, 0,
2352 1, 2, 0, 3, 4, 5, 0, 0, 64, 65,
2353 386, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2354 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2355 65, 74, 107, 156, 157, 158, 159, 160, 161, 73,
2356 344, 1, 2, 0, 3, 4, 5, 0, 0, 64,
2357 65, 74, 107, 67, 68, 69, 70, 71, 72, 73,
2358 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2359 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2360 73, 451, 1, 2, 0, 3, 4, 5, 0, 0,
2361 0, 0, 74, 0, 0, 0, 0, 0, 0, 75,
2362 76, 0, 553, 77, 0, 78, 152, 0, 0, 0,
2363 0, 64, 65, 74, 66, 67, 68, 69, 70, 71,
2364 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2366 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2367 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
2368 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2370 0, 75, 76, 0, 364, 77, 0, 78, 0, 0,
2371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2372 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2374 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2375 65, 0, 107, 156, 157, 158, 159, 160, 161, 73,
2376 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2377 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2378 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2379 64, 65, 74, 151, 67, 68, 69, 70, 71, 72,
2380 73, 0, 1, 2, 0, 3, 4, 5, 64, 65,
2381 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2382 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2383 0, 64, 65, 74, 276, 67, 68, 69, 70, 71,
2384 72, 73, 0, 1, 2, 0, 3, 4, 5, 64,
2385 65, 74, 107, 156, 157, 158, 159, 160, 161, 73,
2386 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2387 0, 0, 64, 65, 74, 107, 67, 68, 69, 70,
2388 71, 72, 559, 0, 1, 2, 0, 3, 4, 5,
2389 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2390 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2391 0, 0, 0, 64, 65, 74, 107, 67, 68, 69,
2392 70, 71, 72, 620, 0, 1, 2, 0, 3, 4,
2393 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2394 0, 0, 75, 76, 0, 0, 77, 0, 78, 0,
2395 0, 0, 0, 0, 0, 0, 74, 0, 0, 0,
2396 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2398 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2399 0, 0, 0, 0, 0, 0, 0, 0, 171, 0,
2400 0, 75, 76, 0, 0, 77, 0, 367, 0, 0,
2401 0, 0, 0, 0, 0, 0, 0, 0, 0, 172,
2402 173, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2403 78, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2404 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2405 193, 194, 195, 196, 197, 198, 0, 0, 0, 0,
2406 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2407 0, 78, 0, 0, 0, 0, 199, 200, 201, 0,
2408 0, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2409 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
2413 static const yytype_int16 yycheck[] =
2415 0, 27, 240, 176, 11, 316, 4, 164, 128, 11,
2416 201, 21, 28, 0, 265, 266, 34, 17, 55, 29,
2417 55, 427, 428, 197, 165, 216, 217, 218, 219, 220,
2418 17, 198, 11, 224, 55, 55, 452, 156, 177, 154,
2419 55, 42, 43, 44, 45, 46, 47, 48, 49, 164,
2420 51, 11, 78, 34, 613, 157, 157, 121, 55, 55,
2421 55, 157, 53, 11, 166, 166, 32, 33, 164, 17,
2422 55, 41, 42, 54, 633, 54, 102, 68, 48, 55,
2423 106, 255, 59, 257, 54, 149, 112, 226, 157, 256,
2424 156, 258, 118, 93, 54, 157, 157, 166, 18, 505,
2425 241, 242, 128, 164, 166, 3, 4, 5, 6, 3,
2426 4, 5, 6, 156, 140, 141, 367, 154, 144, 154,
2427 38, 139, 140, 141, 150, 160, 144, 164, 26, 27,
2428 148, 149, 0, 154, 154, 386, 157, 158, 554, 154,
2429 155, 332, 162, 559, 560, 151, 152, 153, 174, 165,
2430 151, 152, 153, 117, 118, 162, 166, 154, 154, 154,
2431 162, 158, 277, 158, 284, 280, 281, 165, 283, 154,
2432 155, 482, 156, 199, 200, 201, 202, 46, 154, 48,
2433 167, 157, 158, 62, 63, 64, 65, 66, 67, 215,
2434 216, 217, 218, 219, 220, 221, 222, 223, 224, 156,
2435 391, 617, 618, 318, 620, 621, 232, 518, 160, 520,
2436 330, 326, 327, 328, 114, 115, 407, 243, 409, 410,
2437 411, 139, 140, 141, 157, 22, 144, 643, 644, 162,
2438 148, 149, 21, 20, 7, 8, 23, 10, 11, 12,
2439 13, 14, 15, 16, 17, 22, 19, 20, 157, 22,
2440 23, 24, 19, 162, 54, 22, 22, 24, 284, 7,
2441 8, 42, 43, 44, 575, 35, 47, 37, 22, 295,
2442 508, 19, 20, 154, 22, 23, 24, 50, 84, 85,
2443 395, 396, 397, 398, 399, 442, 312, 313, 314, 42,
2444 405, 44, 155, 4, 157, 359, 360, 361, 362, 363,
2445 4, 416, 417, 37, 330, 331, 332, 161, 372, 373,
2446 374, 155, 161, 157, 139, 140, 141, 158, 155, 144,
2447 157, 121, 122, 148, 149, 154, 4, 442, 22, 157,
2448 521, 155, 164, 524, 525, 526, 4, 155, 154, 139,
2449 140, 367, 142, 143, 9, 145, 146, 147, 9, 9,
2450 376, 466, 9, 468, 9, 9, 471, 595, 55, 57,
2451 11, 599, 164, 478, 479, 391, 430, 431, 432, 433,
2452 155, 154, 154, 22, 154, 439, 154, 4, 154, 154,
2453 154, 407, 408, 409, 410, 411, 159, 160, 157, 415,
2454 163, 154, 165, 166, 154, 157, 511, 512, 157, 514,
2455 515, 516, 517, 429, 38, 19, 157, 522, 22, 38,
2456 24, 157, 157, 157, 154, 154, 154, 154, 533, 592,
2457 61, 157, 157, 164, 157, 157, 157, 157, 492, 493,
2458 494, 495, 160, 157, 157, 499, 500, 157, 157, 157,
2459 54, 614, 280, 281, 157, 283, 38, 157, 157, 155,
2460 22, 17, 17, 154, 157, 570, 4, 483, 157, 4,
2461 22, 157, 157, 154, 157, 157, 26, 27, 157, 157,
2462 157, 535, 536, 537, 538, 501, 157, 157, 593, 594,
2463 318, 507, 157, 157, 157, 164, 4, 513, 326, 327,
2464 328, 157, 22, 157, 157, 521, 611, 54, 524, 525,
2465 526, 157, 155, 162, 530, 157, 506, 121, 122, 155,
2466 155, 54, 160, 157, 17, 155, 580, 155, 582, 583,
2467 155, 4, 637, 638, 155, 139, 140, 642, 142, 143,
2468 645, 145, 146, 147, 162, 155, 651, 155, 155, 654,
2469 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2470 110, 111, 112, 113, 150, 154, 154, 395, 396, 397,
2471 398, 399, 22, 157, 17, 17, 157, 405, 17, 73,
2472 596, 17, 131, 131, 587, 131, 93, 555, 416, 417,
2473 3, 4, 232, 112, 7, 8, 9, 587, 17, 90,
2474 0, 106, 57, 530, 434, -1, 19, 20, -1, 22,
2475 23, 24, 25, 26, 27, -1, 243, -1, 18, 19,
2476 20, -1, 22, 23, 24, -1, -1, 40, 41, -1,
2477 30, 31, -1, -1, -1, -1, -1, -1, 466, -1,
2478 468, 54, -1, 471, -1, -1, 59, -1, -1, -1,
2479 478, 479, 52, -1, -1, -1, 56, -1, -1, -1,
2480 60, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2481 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2482 93, -1, -1, 511, 512, -1, 514, 515, 516, 517,
2483 -1, -1, -1, -1, 522, 94, 95, 96, 97, 98,
2484 99, 100, 101, 102, 103, 533, 119, 120, 121, 122,
2485 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2486 133, -1, 135, 136, 137, -1, 139, 140, -1, 142,
2487 143, -1, 145, 146, 147, -1, -1, -1, -1, -1,
2488 -1, -1, 570, -1, -1, -1, -1, -1, -1, -1,
2489 163, -1, -1, -1, -1, 3, 4, -1, -1, 7,
2490 8, 9, -1, -1, -1, 593, 594, -1, -1, -1,
2491 -1, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2492 -1, -1, -1, 611, -1, -1, -1, -1, -1, -1,
2493 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2494 -1, -1, -1, -1, -1, -1, -1, 55, -1, 637,
2495 638, 59, -1, -1, 642, -1, -1, 645, -1, -1,
2496 -1, -1, -1, 651, -1, -1, 654, 75, 76, 77,
2497 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2498 88, 89, 90, 91, 92, 93, -1, 7, 8, -1,
2499 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2500 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2501 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2502 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2503 50, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2504 -1, 7, 8, 9, -1, -1, 154, 0, -1, -1,
2505 -1, -1, -1, 19, 20, 163, 22, 23, 24, 25,
2506 26, 27, -1, -1, -1, 18, 19, 20, -1, 22,
2507 23, 24, -1, -1, 40, 41, -1, 30, 31, -1,
2508 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2509 -1, -1, -1, 59, -1, -1, -1, -1, -1, 52,
2510 -1, -1, -1, 56, -1, -1, -1, 60, -1, 75,
2511 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2512 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2513 -1, -1, -1, -1, -1, -1, -1, -1, -1, 159,
2514 160, -1, -1, 163, -1, 165, 166, -1, -1, -1,
2515 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2516 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2517 136, 137, 7, 8, -1, -1, -1, -1, -1, -1,
2518 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
2519 25, -1, -1, -1, -1, -1, -1, 163, -1, -1,
2520 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2521 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2522 55, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2523 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2524 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2525 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2526 -1, 50, 7, 8, -1, 10, 11, 12, 13, 14,
2527 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2528 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2529 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2530 135, 136, 137, -1, -1, 50, -1, -1, -1, -1,
2531 -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
2532 -1, 7, 8, 158, -1, 160, -1, -1, 163, -1,
2533 165, -1, 167, 19, 20, -1, 22, 23, 24, 25,
2534 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2535 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2536 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
2537 159, 160, -1, -1, 163, -1, 165, 166, -1, -1,
2538 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2539 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2540 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2541 -1, -1, -1, -1, 159, 160, -1, -1, 163, -1,
2542 165, 166, -1, -1, -1, -1, -1, -1, -1, -1,
2543 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2544 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2545 136, 137, -1, -1, -1, -1, -1, -1, -1, -1,
2546 3, 4, -1, -1, -1, -1, 9, -1, 154, -1,
2547 -1, -1, -1, -1, 160, -1, -1, 163, -1, 165,
2548 -1, 167, 25, 26, 27, -1, -1, -1, -1, -1,
2549 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2550 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2551 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2552 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2553 -1, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2554 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2555 93, -1, -1, -1, -1, -1, -1, 7, 8, -1,
2556 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2557 20, -1, 22, 23, 24, -1, 119, 120, 121, 122,
2558 123, 124, 125, 126, 127, 128, 129, 130, 131, 39,
2559 133, -1, 135, 136, 137, -1, -1, -1, 7, 8,
2560 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2561 19, 20, -1, 22, 23, 24, -1, -1, 7, 8,
2562 163, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2563 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2564 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2565 39, 19, 20, -1, 22, 23, 24, -1, -1, 7,
2566 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2567 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2568 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2569 17, 39, 19, 20, -1, 22, 23, 24, -1, -1,
2570 -1, -1, 50, -1, -1, -1, -1, -1, -1, 159,
2571 160, -1, 39, 163, -1, 165, 125, -1, -1, -1,
2572 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
2573 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2574 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2575 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
2576 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
2577 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
2578 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2579 -1, 159, 160, -1, 162, 163, -1, 165, -1, -1,
2580 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2581 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2583 -1, -1, 159, 160, -1, -1, 163, -1, 165, 7,
2584 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2585 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2586 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2587 -1, -1, -1, 159, 160, -1, -1, 163, -1, 165,
2588 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2589 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
2590 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2591 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2592 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
2593 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
2594 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2595 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2596 -1, -1, 7, 8, 50, 10, 11, 12, 13, 14,
2597 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2598 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2599 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2600 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2601 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2602 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2603 -1, -1, 159, 160, -1, -1, 163, -1, 165, -1,
2604 -1, -1, -1, -1, -1, -1, 50, -1, -1, -1,
2605 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
2606 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2607 -1, -1, -1, 159, 160, -1, -1, 163, -1, 165,
2608 -1, -1, -1, -1, -1, -1, -1, -1, 36, -1,
2609 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2610 -1, -1, -1, -1, -1, -1, -1, -1, -1, 57,
2611 58, -1, -1, -1, 159, 160, -1, -1, 163, -1,
2612 165, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2613 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2614 88, 89, 90, 91, 92, 93, -1, -1, -1, -1,
2615 -1, -1, -1, -1, -1, 159, 160, -1, -1, 163,
2616 -1, 165, -1, -1, -1, -1, 114, 115, 116, -1,
2617 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2618 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
2622 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2623 symbol of state STATE-NUM. */
2624 static const yytype_uint8 yystos[] =
2626 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
2627 60, 176, 179, 180, 181, 182, 214, 215, 216, 218,
2628 217, 53, 68, 223, 156, 59, 156, 18, 156, 42,
2629 43, 44, 45, 46, 47, 48, 49, 51, 151, 152,
2630 153, 183, 184, 185, 0, 216, 46, 48, 186, 233,
2631 42, 43, 44, 47, 187, 230, 232, 240, 156, 156,
2632 160, 224, 22, 222, 7, 8, 10, 11, 12, 13,
2633 14, 15, 16, 17, 50, 159, 160, 163, 165, 176,
2634 180, 201, 202, 236, 185, 185, 35, 37, 212, 185,
2635 185, 21, 241, 242, 29, 166, 231, 241, 22, 22,
2636 22, 225, 154, 4, 4, 4, 165, 10, 166, 202,
2637 207, 55, 154, 178, 212, 212, 42, 44, 188, 32,
2638 33, 211, 62, 63, 64, 65, 66, 67, 189, 228,
2639 228, 179, 245, 157, 162, 39, 202, 203, 205, 206,
2640 161, 161, 166, 207, 157, 166, 154, 206, 158, 211,
2641 211, 10, 125, 202, 204, 213, 11, 12, 13, 14,
2642 15, 16, 174, 175, 202, 208, 4, 204, 28, 165,
2643 229, 36, 57, 58, 69, 70, 71, 72, 73, 74,
2644 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2645 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2646 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
2647 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2648 137, 138, 169, 170, 171, 243, 249, 250, 251, 252,
2649 22, 191, 157, 155, 202, 202, 164, 166, 202, 4,
2650 155, 208, 202, 154, 236, 26, 27, 3, 4, 5,
2651 6, 9, 25, 40, 41, 90, 91, 92, 93, 119,
2652 133, 135, 136, 137, 160, 163, 165, 167, 169, 170,
2653 171, 209, 236, 178, 180, 57, 10, 202, 238, 239,
2654 11, 17, 11, 174, 189, 94, 95, 96, 97, 98,
2655 99, 100, 101, 102, 103, 172, 26, 27, 100, 101,
2656 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2657 112, 113, 173, 172, 173, 202, 202, 238, 202, 202,
2658 246, 238, 238, 238, 238, 238, 202, 202, 202, 238,
2659 189, 117, 118, 54, 121, 122, 139, 140, 142, 143,
2660 145, 146, 147, 190, 39, 203, 193, 162, 164, 164,
2661 155, 193, 178, 178, 213, 172, 173, 172, 173, 154,
2662 154, 154, 154, 154, 162, 208, 210, 165, 210, 166,
2663 210, 22, 154, 154, 154, 219, 154, 3, 4, 9,
2664 25, 26, 27, 40, 41, 59, 163, 209, 235, 236,
2665 237, 157, 237, 237, 237, 204, 202, 202, 202, 202,
2666 157, 196, 157, 196, 237, 160, 157, 157, 157, 157,
2667 157, 157, 237, 237, 237, 38, 204, 202, 238, 4,
2668 139, 140, 141, 144, 148, 149, 192, 220, 221, 38,
2669 154, 154, 154, 154, 208, 208, 208, 208, 208, 157,
2670 162, 166, 202, 210, 164, 166, 208, 208, 208, 157,
2671 199, 39, 202, 226, 227, 61, 234, 210, 238, 157,
2672 157, 237, 237, 237, 237, 237, 11, 54, 11, 248,
2673 237, 160, 238, 202, 238, 238, 238, 157, 157, 157,
2674 202, 237, 237, 157, 199, 199, 202, 208, 208, 208,
2675 208, 248, 157, 157, 157, 157, 208, 164, 166, 157,
2676 157, 38, 34, 54, 197, 200, 191, 157, 155, 22,
2677 164, 17, 17, 154, 157, 157, 157, 157, 237, 4,
2678 237, 157, 157, 237, 157, 157, 157, 4, 237, 237,
2679 154, 157, 196, 202, 155, 157, 157, 157, 157, 155,
2680 208, 208, 208, 208, 164, 208, 208, 202, 22, 4,
2681 199, 176, 177, 39, 202, 193, 157, 237, 237, 17,
2682 202, 247, 237, 237, 237, 237, 196, 196, 238, 237,
2683 157, 238, 238, 238, 247, 237, 208, 208, 208, 208,
2684 157, 155, 157, 157, 155, 155, 155, 191, 197, 198,
2685 22, 157, 160, 191, 191, 155, 157, 162, 237, 155,
2686 196, 155, 155, 155, 155, 208, 208, 208, 177, 54,
2687 195, 17, 162, 174, 244, 121, 122, 237, 237, 193,
2688 17, 202, 162, 193, 155, 155, 155, 4, 150, 194,
2689 237, 235, 162, 174, 191, 191, 38, 191, 191, 22,
2690 157, 235, 17, 237, 237, 17, 157, 237, 191, 191,
2691 237, 17, 73, 237, 17, 237
2694 #define yyerrok (yyerrstatus = 0)
2695 #define yyclearin (yychar = YYEMPTY)
2696 #define YYEMPTY (-2)
2699 #define YYACCEPT goto yyacceptlab
2700 #define YYABORT goto yyabortlab
2701 #define YYERROR goto yyerrorlab
2704 /* Like YYERROR except do call yyerror. This remains here temporarily
2705 to ease the transition to the new meaning of YYERROR, for GCC.
2706 Once GCC version 2 has supplanted version 1, this can go. */
2708 #define YYFAIL goto yyerrlab
2710 #define YYRECOVERING() (!!yyerrstatus)
2712 #define YYBACKUP(Token, Value) \
2714 if (yychar == YYEMPTY && yylen == 1) \
2718 yytoken = YYTRANSLATE (yychar); \
2724 yyerror (YY_("syntax error: cannot back up")); \
2731 #define YYERRCODE 256
2734 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2735 If N is 0, then set CURRENT to the empty location which ends
2736 the previous symbol: RHS[0] (always defined). */
2738 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2739 #ifndef YYLLOC_DEFAULT
2740 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2744 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2745 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2746 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2747 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2751 (Current).first_line = (Current).last_line = \
2752 YYRHSLOC (Rhs, 0).last_line; \
2753 (Current).first_column = (Current).last_column = \
2754 YYRHSLOC (Rhs, 0).last_column; \
2760 /* YY_LOCATION_PRINT -- Print the location on the stream.
2761 This macro was not mandated originally: define only if we know
2762 we won't break user code: when these are the locations we know. */
2764 #ifndef YY_LOCATION_PRINT
2765 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2766 # define YY_LOCATION_PRINT(File, Loc) \
2767 fprintf (File, "%d.%d-%d.%d", \
2768 (Loc).first_line, (Loc).first_column, \
2769 (Loc).last_line, (Loc).last_column)
2771 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2776 /* YYLEX -- calling `yylex' with the right arguments. */
2779 # define YYLEX yylex (YYLEX_PARAM)
2781 # define YYLEX yylex ()
2784 /* Enable debugging if requested. */
2788 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2789 # define YYFPRINTF fprintf
2792 # define YYDPRINTF(Args) \
2798 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2802 YYFPRINTF (stderr, "%s ", Title); \
2803 yy_symbol_print (stderr, \
2805 YYFPRINTF (stderr, "\n"); \
2810 /*--------------------------------.
2811 | Print this symbol on YYOUTPUT. |
2812 `--------------------------------*/
2815 #if (defined __STDC__ || defined __C99__FUNC__ \
2816 || defined __cplusplus || defined _MSC_VER)
2818 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2821 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2824 YYSTYPE const * const yyvaluep;
2830 if (yytype < YYNTOKENS)
2831 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2843 /*--------------------------------.
2844 | Print this symbol on YYOUTPUT. |
2845 `--------------------------------*/
2847 #if (defined __STDC__ || defined __C99__FUNC__ \
2848 || defined __cplusplus || defined _MSC_VER)
2850 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2853 yy_symbol_print (yyoutput, yytype, yyvaluep)
2856 YYSTYPE const * const yyvaluep;
2859 if (yytype < YYNTOKENS)
2860 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2862 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2864 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2865 YYFPRINTF (yyoutput, ")");
2868 /*------------------------------------------------------------------.
2869 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2871 `------------------------------------------------------------------*/
2873 #if (defined __STDC__ || defined __C99__FUNC__ \
2874 || defined __cplusplus || defined _MSC_VER)
2876 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2879 yy_stack_print (bottom, top)
2880 yytype_int16 *bottom;
2884 YYFPRINTF (stderr, "Stack now");
2885 for (; bottom <= top; ++bottom)
2886 YYFPRINTF (stderr, " %d", *bottom);
2887 YYFPRINTF (stderr, "\n");
2890 # define YY_STACK_PRINT(Bottom, Top) \
2893 yy_stack_print ((Bottom), (Top)); \
2897 /*------------------------------------------------.
2898 | Report that the YYRULE is going to be reduced. |
2899 `------------------------------------------------*/
2901 #if (defined __STDC__ || defined __C99__FUNC__ \
2902 || defined __cplusplus || defined _MSC_VER)
2904 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2907 yy_reduce_print (yyvsp, yyrule)
2912 int yynrhs = yyr2[yyrule];
2914 unsigned long int yylno = yyrline[yyrule];
2915 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2917 /* The symbols being reduced. */
2918 for (yyi = 0; yyi < yynrhs; yyi++)
2920 fprintf (stderr, " $%d = ", yyi + 1);
2921 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2922 &(yyvsp[(yyi + 1) - (yynrhs)])
2924 fprintf (stderr, "\n");
2928 # define YY_REDUCE_PRINT(Rule) \
2931 yy_reduce_print (yyvsp, Rule); \
2934 /* Nonzero means print parse trace. It is left uninitialized so that
2935 multiple parsers can coexist. */
2937 #else /* !YYDEBUG */
2938 # define YYDPRINTF(Args)
2939 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2940 # define YY_STACK_PRINT(Bottom, Top)
2941 # define YY_REDUCE_PRINT(Rule)
2942 #endif /* !YYDEBUG */
2945 /* YYINITDEPTH -- initial size of the parser's stacks. */
2947 # define YYINITDEPTH 200
2950 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2951 if the built-in stack extension method is used).
2953 Do not make this value too large; the results are undefined if
2954 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2955 evaluated with infinite-precision integer arithmetic. */
2958 # define YYMAXDEPTH 10000
2966 # if defined __GLIBC__ && defined _STRING_H
2967 # define yystrlen strlen
2969 /* Return the length of YYSTR. */
2970 #if (defined __STDC__ || defined __C99__FUNC__ \
2971 || defined __cplusplus || defined _MSC_VER)
2973 yystrlen (const char *yystr)
2981 for (yylen = 0; yystr[yylen]; yylen++)
2989 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2990 # define yystpcpy stpcpy
2992 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2994 #if (defined __STDC__ || defined __C99__FUNC__ \
2995 || defined __cplusplus || defined _MSC_VER)
2997 yystpcpy (char *yydest, const char *yysrc)
3000 yystpcpy (yydest, yysrc)
3006 const char *yys = yysrc;
3008 while ((*yyd++ = *yys++) != '\0')
3017 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3018 quotes and backslashes, so that it's suitable for yyerror. The
3019 heuristic is that double-quoting is unnecessary unless the string
3020 contains an apostrophe, a comma, or backslash (other than
3021 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3022 null, do not copy; instead, return the length of what the result
3025 yytnamerr (char *yyres, const char *yystr)
3030 char const *yyp = yystr;
3037 goto do_not_strip_quotes;
3041 goto do_not_strip_quotes;
3054 do_not_strip_quotes: ;
3058 return yystrlen (yystr);
3060 return yystpcpy (yyres, yystr) - yyres;
3064 /* Copy into YYRESULT an error message about the unexpected token
3065 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3066 including the terminating null byte. If YYRESULT is null, do not
3067 copy anything; just return the number of bytes that would be
3068 copied. As a special case, return 0 if an ordinary "syntax error"
3069 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3070 size calculation. */
3072 yysyntax_error (char *yyresult, int yystate, int yychar)
3074 int yyn = yypact[yystate];
3076 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3080 int yytype = YYTRANSLATE (yychar);
3081 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3082 YYSIZE_T yysize = yysize0;
3084 int yysize_overflow = 0;
3085 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3086 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3090 /* This is so xgettext sees the translatable formats that are
3091 constructed on the fly. */
3092 YY_("syntax error, unexpected %s");
3093 YY_("syntax error, unexpected %s, expecting %s");
3094 YY_("syntax error, unexpected %s, expecting %s or %s");
3095 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3096 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3100 static char const yyunexpected[] = "syntax error, unexpected %s";
3101 static char const yyexpecting[] = ", expecting %s";
3102 static char const yyor[] = " or %s";
3103 char yyformat[sizeof yyunexpected
3104 + sizeof yyexpecting - 1
3105 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3106 * (sizeof yyor - 1))];
3107 char const *yyprefix = yyexpecting;
3109 /* Start YYX at -YYN if negative to avoid negative indexes in
3111 int yyxbegin = yyn < 0 ? -yyn : 0;
3113 /* Stay within bounds of both yycheck and yytname. */
3114 int yychecklim = YYLAST - yyn + 1;
3115 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3118 yyarg[0] = yytname[yytype];
3119 yyfmt = yystpcpy (yyformat, yyunexpected);
3121 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3122 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3124 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3128 yyformat[sizeof yyunexpected - 1] = '\0';
3131 yyarg[yycount++] = yytname[yyx];
3132 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3133 yysize_overflow |= (yysize1 < yysize);
3135 yyfmt = yystpcpy (yyfmt, yyprefix);
3139 yyf = YY_(yyformat);
3140 yysize1 = yysize + yystrlen (yyf);
3141 yysize_overflow |= (yysize1 < yysize);
3144 if (yysize_overflow)
3145 return YYSIZE_MAXIMUM;
3149 /* Avoid sprintf, as that infringes on the user's name space.
3150 Don't have undefined behavior even if the translation
3151 produced a string with the wrong number of "%s"s. */
3152 char *yyp = yyresult;
3154 while ((*yyp = *yyf) != '\0')
3156 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3158 yyp += yytnamerr (yyp, yyarg[yyi++]);
3171 #endif /* YYERROR_VERBOSE */
3174 /*-----------------------------------------------.
3175 | Release the memory associated to this symbol. |
3176 `-----------------------------------------------*/
3179 #if (defined __STDC__ || defined __C99__FUNC__ \
3180 || defined __cplusplus || defined _MSC_VER)
3182 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3185 yydestruct (yymsg, yytype, yyvaluep)
3195 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3206 /* Prevent warnings from -Wmissing-prototypes. */
3208 #ifdef YYPARSE_PARAM
3209 #if defined __STDC__ || defined __cplusplus
3210 int yyparse (void *YYPARSE_PARAM);
3214 #else /* ! YYPARSE_PARAM */
3215 #if defined __STDC__ || defined __cplusplus
3220 #endif /* ! YYPARSE_PARAM */
3224 /* The look-ahead symbol. */
3227 /* The semantic value of the look-ahead symbol. */
3230 /* Number of syntax errors so far. */
3239 #ifdef YYPARSE_PARAM
3240 #if (defined __STDC__ || defined __C99__FUNC__ \
3241 || defined __cplusplus || defined _MSC_VER)
3243 yyparse (void *YYPARSE_PARAM)
3246 yyparse (YYPARSE_PARAM)
3247 void *YYPARSE_PARAM;
3249 #else /* ! YYPARSE_PARAM */
3250 #if (defined __STDC__ || defined __C99__FUNC__ \
3251 || defined __cplusplus || defined _MSC_VER)
3265 /* Number of tokens to shift before error messages enabled. */
3267 /* Look-ahead token as an internal (translated) token number. */
3270 /* Buffer for error messages, and its allocated size. */
3272 char *yymsg = yymsgbuf;
3273 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3276 /* Three stacks and their tools:
3277 `yyss': related to states,
3278 `yyvs': related to semantic values,
3279 `yyls': related to locations.
3281 Refer to the stacks thru separate pointers, to allow yyoverflow
3282 to reallocate them elsewhere. */
3284 /* The state stack. */
3285 yytype_int16 yyssa[YYINITDEPTH];
3286 yytype_int16 *yyss = yyssa;
3287 yytype_int16 *yyssp;
3289 /* The semantic value stack. */
3290 YYSTYPE yyvsa[YYINITDEPTH];
3291 YYSTYPE *yyvs = yyvsa;
3296 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3298 YYSIZE_T yystacksize = YYINITDEPTH;
3300 /* The variables used to return semantic value and location from the
3305 /* The number of symbols on the RHS of the reduced rule.
3306 Keep to zero when no symbol should be popped. */
3309 YYDPRINTF ((stderr, "Starting parse\n"));
3314 yychar = YYEMPTY; /* Cause a token to be read. */
3316 /* Initialize stack pointers.
3317 Waste one element of value and location stack
3318 so that they stay on the same level as the state stack.
3319 The wasted elements are never initialized. */
3326 /*------------------------------------------------------------.
3327 | yynewstate -- Push a new state, which is found in yystate. |
3328 `------------------------------------------------------------*/
3330 /* In all cases, when you get here, the value and location stacks
3331 have just been pushed. So pushing a state here evens the stacks. */
3337 if (yyss + yystacksize - 1 <= yyssp)
3339 /* Get the current used size of the three stacks, in elements. */
3340 YYSIZE_T yysize = yyssp - yyss + 1;
3344 /* Give user a chance to reallocate the stack. Use copies of
3345 these so that the &'s don't force the real ones into
3347 YYSTYPE *yyvs1 = yyvs;
3348 yytype_int16 *yyss1 = yyss;
3351 /* Each stack pointer address is followed by the size of the
3352 data in use in that stack, in bytes. This used to be a
3353 conditional around just the two extra args, but that might
3354 be undefined if yyoverflow is a macro. */
3355 yyoverflow (YY_("memory exhausted"),
3356 &yyss1, yysize * sizeof (*yyssp),
3357 &yyvs1, yysize * sizeof (*yyvsp),
3364 #else /* no yyoverflow */
3365 # ifndef YYSTACK_RELOCATE
3366 goto yyexhaustedlab;
3368 /* Extend the stack our own way. */
3369 if (YYMAXDEPTH <= yystacksize)
3370 goto yyexhaustedlab;
3372 if (YYMAXDEPTH < yystacksize)
3373 yystacksize = YYMAXDEPTH;
3376 yytype_int16 *yyss1 = yyss;
3377 union yyalloc *yyptr =
3378 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3380 goto yyexhaustedlab;
3381 YYSTACK_RELOCATE (yyss);
3382 YYSTACK_RELOCATE (yyvs);
3384 # undef YYSTACK_RELOCATE
3386 YYSTACK_FREE (yyss1);
3389 #endif /* no yyoverflow */
3391 yyssp = yyss + yysize - 1;
3392 yyvsp = yyvs + yysize - 1;
3395 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3396 (unsigned long int) yystacksize));
3398 if (yyss + yystacksize - 1 <= yyssp)
3402 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3411 /* Do appropriate processing given the current state. Read a
3412 look-ahead token if we need one and don't already have one. */
3414 /* First try to decide what to do without reference to look-ahead token. */
3415 yyn = yypact[yystate];
3416 if (yyn == YYPACT_NINF)
3419 /* Not known => get a look-ahead token if don't already have one. */
3421 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3422 if (yychar == YYEMPTY)
3424 YYDPRINTF ((stderr, "Reading a token: "));
3428 if (yychar <= YYEOF)
3430 yychar = yytoken = YYEOF;
3431 YYDPRINTF ((stderr, "Now at end of input.\n"));
3435 yytoken = YYTRANSLATE (yychar);
3436 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3439 /* If the proper action on seeing token YYTOKEN is to reduce or to
3440 detect an error, take that action. */
3442 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3447 if (yyn == 0 || yyn == YYTABLE_NINF)
3456 /* Count tokens shifted since error; after three, turn off error
3461 /* Shift the look-ahead token. */
3462 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3464 /* Discard the shifted token unless it is eof. */
3465 if (yychar != YYEOF)
3474 /*-----------------------------------------------------------.
3475 | yydefault -- do the default action for the current state. |
3476 `-----------------------------------------------------------*/
3478 yyn = yydefact[yystate];
3484 /*-----------------------------.
3485 | yyreduce -- Do a reduction. |
3486 `-----------------------------*/
3488 /* yyn is the number of a rule to reduce with. */
3491 /* If YYLEN is nonzero, implement the default value of the action:
3494 Otherwise, the following line sets YYVAL to garbage.
3495 This behavior is undocumented and Bison
3496 users should not rely upon it. Assigning to YYVAL
3497 unconditionally makes the parser a bit smaller, and it avoids a
3498 GCC warning that YYVAL may be used uninitialized. */
3499 yyval = yyvsp[1-yylen];
3502 YY_REDUCE_PRINT (yyn);
3506 #line 1117 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3507 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3511 #line 1117 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3512 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3516 #line 1118 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3517 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3521 #line 1118 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3522 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3526 #line 1119 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3527 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3531 #line 1119 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3532 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3536 #line 1120 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3537 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3541 #line 1120 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3542 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3546 #line 1121 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3547 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3551 #line 1121 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3552 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3556 #line 1125 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3557 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3561 #line 1125 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3562 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3566 #line 1126 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3567 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3571 #line 1126 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3572 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3576 #line 1127 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3577 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3581 #line 1127 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3582 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3586 #line 1128 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3587 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3591 #line 1128 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3592 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3596 #line 1129 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3597 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3601 #line 1129 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3602 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3606 #line 1130 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3607 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3611 #line 1130 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3612 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3616 #line 1131 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3617 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3621 #line 1131 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3622 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3626 #line 1132 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3627 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3631 #line 1133 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3632 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3636 #line 1142 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3637 { (yyval.StrVal) = 0; ;}
3641 #line 1144 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3642 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3646 #line 1145 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3647 { (yyval.UIntVal)=0; ;}
3651 #line 1149 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3653 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3659 #line 1153 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3667 #line 1161 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3675 #line 1166 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3677 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3683 #line 1172 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3684 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3688 #line 1173 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3689 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3693 #line 1174 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3694 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3698 #line 1175 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3699 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3703 #line 1176 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3704 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3708 #line 1177 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3709 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
3713 #line 1181 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3714 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3718 #line 1182 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3719 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3723 #line 1183 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3724 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3728 #line 1187 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3729 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3733 #line 1188 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3734 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3738 #line 1189 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3739 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3743 #line 1190 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3744 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3748 #line 1194 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3749 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3753 #line 1195 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3754 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3758 #line 1196 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3759 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3763 #line 1200 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3764 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3768 #line 1201 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3769 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3773 #line 1202 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3774 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3778 #line 1203 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3779 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3783 #line 1204 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3784 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3788 #line 1208 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3789 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3793 #line 1209 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3794 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3798 #line 1210 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3799 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3803 #line 1213 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3804 { (yyval.UIntVal) = CallingConv::C; ;}
3808 #line 1214 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3809 { (yyval.UIntVal) = CallingConv::C; ;}
3813 #line 1215 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3814 { (yyval.UIntVal) = CallingConv::Fast; ;}
3818 #line 1216 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3819 { (yyval.UIntVal) = CallingConv::Cold; ;}
3823 #line 1217 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3824 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3828 #line 1218 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3829 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3833 #line 1219 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3835 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3836 GEN_ERROR("Calling conv too large");
3837 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3843 #line 1226 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3844 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3848 #line 1227 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3849 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3853 #line 1228 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3854 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3858 #line 1229 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3859 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3863 #line 1230 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3864 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3868 #line 1231 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3869 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3873 #line 1232 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3874 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3878 #line 1233 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3879 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3883 #line 1234 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3884 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3888 #line 1235 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3889 { (yyval.ParamAttrs) =
3890 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3894 #line 1239 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3895 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3899 #line 1240 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3901 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3906 #line 1245 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3907 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3911 #line 1246 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3912 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3916 #line 1247 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3917 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3921 #line 1248 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3922 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3926 #line 1249 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3927 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3931 #line 1250 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3932 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3936 #line 1253 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3937 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3941 #line 1254 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3943 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3948 #line 1259 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3949 { (yyval.StrVal) = 0; ;}
3953 #line 1260 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3955 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3960 #line 1267 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3961 { (yyval.UIntVal) = 0; ;}
3965 #line 1268 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3967 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3968 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3969 GEN_ERROR("Alignment must be a power of two");
3975 #line 1274 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3976 { (yyval.UIntVal) = 0; ;}
3980 #line 1275 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3982 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3983 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3984 GEN_ERROR("Alignment must be a power of two");
3990 #line 1284 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3992 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3993 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3994 GEN_ERROR("Invalid character in section name");
3995 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4001 #line 1292 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4002 { (yyval.StrVal) = 0; ;}
4006 #line 1293 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4007 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4011 #line 1298 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4016 #line 1299 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4021 #line 1300 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4023 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4024 delete (yyvsp[(1) - (1)].StrVal);
4030 #line 1305 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4032 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4033 GEN_ERROR("Alignment must be a power of two");
4034 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4040 #line 1321 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4042 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4048 #line 1325 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4050 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4056 #line 1329 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4058 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4059 GEN_ERROR("Cannot form a pointer to a basic block");
4060 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4061 delete (yyvsp[(1) - (3)].TypeVal);
4067 #line 1336 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4068 { // Named types are also simple types...
4069 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4071 (yyval.TypeVal) = new PATypeHolder(tmp);
4076 #line 1341 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4077 { // Type UpReference
4078 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4079 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4080 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4081 (yyval.TypeVal) = new PATypeHolder(OT);
4082 UR_OUT("New Upreference!\n");
4088 #line 1349 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4090 // Allow but ignore attributes on function types; this permits auto-upgrade.
4091 // FIXME: remove in LLVM 3.0.
4092 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4093 if (!FunctionType::isValidReturnType(RetTy))
4094 GEN_ERROR("Invalid result type for LLVM function");
4096 std::vector<const Type*> Params;
4097 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4098 for (; I != E; ++I ) {
4099 const Type *Ty = I->Ty->get();
4100 Params.push_back(Ty);
4103 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4104 if (isVarArg) Params.pop_back();
4106 for (unsigned i = 0; i != Params.size(); ++i)
4107 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4108 GEN_ERROR("Function arguments must be value types!");
4112 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4113 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4114 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4115 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4121 #line 1378 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4123 // Allow but ignore attributes on function types; this permits auto-upgrade.
4124 // FIXME: remove in LLVM 3.0.
4125 std::vector<const Type*> Params;
4126 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4127 for ( ; I != E; ++I ) {
4128 const Type* Ty = I->Ty->get();
4129 Params.push_back(Ty);
4132 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4133 if (isVarArg) Params.pop_back();
4135 for (unsigned i = 0; i != Params.size(); ++i)
4136 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4137 GEN_ERROR("Function arguments must be value types!");
4141 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4142 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4143 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4149 #line 1403 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4150 { // Sized array type?
4151 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4152 delete (yyvsp[(4) - (5)].TypeVal);
4158 #line 1408 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4160 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4161 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4162 GEN_ERROR("Unsigned result not equal to signed result");
4163 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4164 GEN_ERROR("Element type of a VectorType must be primitive");
4165 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4166 delete (yyvsp[(4) - (5)].TypeVal);
4172 #line 1418 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4173 { // Structure type?
4174 std::vector<const Type*> Elements;
4175 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4176 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4177 Elements.push_back(*I);
4179 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4180 delete (yyvsp[(2) - (3)].TypeList);
4186 #line 1428 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4187 { // Empty structure type?
4188 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4194 #line 1432 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4196 std::vector<const Type*> Elements;
4197 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4198 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4199 Elements.push_back(*I);
4201 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4202 delete (yyvsp[(3) - (5)].TypeList);
4208 #line 1442 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4209 { // Empty structure type?
4210 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4216 #line 1449 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4218 // Allow but ignore attributes on function types; this permits auto-upgrade.
4219 // FIXME: remove in LLVM 3.0.
4220 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4221 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4226 #line 1458 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4228 if (!UpRefs.empty())
4229 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4230 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4231 GEN_ERROR("LLVM functions cannot return aggregate types");
4232 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4237 #line 1465 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4239 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4244 #line 1470 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4246 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4247 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4253 #line 1475 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4255 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4261 #line 1483 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4263 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4264 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4265 TWA.Ty = new PATypeHolder(Type::VoidTy);
4266 (yyval.TypeWithAttrsList)->push_back(TWA);
4272 #line 1490 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4274 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4275 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4276 TWA.Ty = new PATypeHolder(Type::VoidTy);
4277 (yyval.TypeWithAttrsList)->push_back(TWA);
4283 #line 1497 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4285 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4291 #line 1505 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4293 (yyval.TypeList) = new std::list<PATypeHolder>();
4294 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4295 delete (yyvsp[(1) - (1)].TypeVal);
4301 #line 1511 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4303 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4304 delete (yyvsp[(3) - (3)].TypeVal);
4310 #line 1523 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4311 { // Nonempty unsized arr
4312 if (!UpRefs.empty())
4313 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4314 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4316 GEN_ERROR("Cannot make array constant with type: '" +
4317 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4318 const Type *ETy = ATy->getElementType();
4319 int NumElements = ATy->getNumElements();
4321 // Verify that we have the correct size...
4322 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4323 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4324 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4325 itostr(NumElements) + "");
4327 // Verify all elements are correct type!
4328 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4329 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4330 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4331 ETy->getDescription() +"' as required!\nIt is of type '"+
4332 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4335 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4336 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4342 #line 1551 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4344 if (!UpRefs.empty())
4345 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4346 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4348 GEN_ERROR("Cannot make array constant with type: '" +
4349 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4351 int NumElements = ATy->getNumElements();
4352 if (NumElements != -1 && NumElements != 0)
4353 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4354 " arguments, but has size of " + itostr(NumElements) +"");
4355 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4356 delete (yyvsp[(1) - (3)].TypeVal);
4362 #line 1567 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4364 if (!UpRefs.empty())
4365 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4366 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4368 GEN_ERROR("Cannot make array constant with type: '" +
4369 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4371 int NumElements = ATy->getNumElements();
4372 const Type *ETy = ATy->getElementType();
4373 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4374 GEN_ERROR("Can't build string constant of size " +
4375 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4376 " when array has size " + itostr(NumElements) + "");
4377 std::vector<Constant*> Vals;
4378 if (ETy == Type::Int8Ty) {
4379 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4380 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4382 delete (yyvsp[(3) - (3)].StrVal);
4383 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4385 delete (yyvsp[(3) - (3)].StrVal);
4386 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4387 delete (yyvsp[(1) - (3)].TypeVal);
4393 #line 1594 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4394 { // Nonempty unsized arr
4395 if (!UpRefs.empty())
4396 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4397 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4399 GEN_ERROR("Cannot make packed constant with type: '" +
4400 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4401 const Type *ETy = PTy->getElementType();
4402 int NumElements = PTy->getNumElements();
4404 // Verify that we have the correct size...
4405 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4406 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4407 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4408 itostr(NumElements) + "");
4410 // Verify all elements are correct type!
4411 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4412 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4413 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4414 ETy->getDescription() +"' as required!\nIt is of type '"+
4415 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4418 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4419 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4425 #line 1622 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4427 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4429 GEN_ERROR("Cannot make struct constant with type: '" +
4430 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4432 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4433 GEN_ERROR("Illegal number of initializers for structure type");
4435 // Check to ensure that constants are compatible with the type initializer!
4436 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4437 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4438 GEN_ERROR("Expected type '" +
4439 STy->getElementType(i)->getDescription() +
4440 "' for element #" + utostr(i) +
4441 " of structure initializer");
4443 // Check to ensure that Type is not packed
4444 if (STy->isPacked())
4445 GEN_ERROR("Unpacked Initializer to vector type '" +
4446 STy->getDescription() + "'");
4448 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4449 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4455 #line 1648 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4457 if (!UpRefs.empty())
4458 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4459 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4461 GEN_ERROR("Cannot make struct constant with type: '" +
4462 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4464 if (STy->getNumContainedTypes() != 0)
4465 GEN_ERROR("Illegal number of initializers for structure type");
4467 // Check to ensure that Type is not packed
4468 if (STy->isPacked())
4469 GEN_ERROR("Unpacked Initializer to vector type '" +
4470 STy->getDescription() + "'");
4472 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4473 delete (yyvsp[(1) - (3)].TypeVal);
4479 #line 1668 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4481 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4483 GEN_ERROR("Cannot make struct constant with type: '" +
4484 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4486 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4487 GEN_ERROR("Illegal number of initializers for structure type");
4489 // Check to ensure that constants are compatible with the type initializer!
4490 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4491 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4492 GEN_ERROR("Expected type '" +
4493 STy->getElementType(i)->getDescription() +
4494 "' for element #" + utostr(i) +
4495 " of structure initializer");
4497 // Check to ensure that Type is packed
4498 if (!STy->isPacked())
4499 GEN_ERROR("Vector initializer to non-vector type '" +
4500 STy->getDescription() + "'");
4502 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4503 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4509 #line 1694 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4511 if (!UpRefs.empty())
4512 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4513 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4515 GEN_ERROR("Cannot make struct constant with type: '" +
4516 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4518 if (STy->getNumContainedTypes() != 0)
4519 GEN_ERROR("Illegal number of initializers for structure type");
4521 // Check to ensure that Type is packed
4522 if (!STy->isPacked())
4523 GEN_ERROR("Vector initializer to non-vector type '" +
4524 STy->getDescription() + "'");
4526 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4527 delete (yyvsp[(1) - (5)].TypeVal);
4533 #line 1714 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4535 if (!UpRefs.empty())
4536 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4537 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4539 GEN_ERROR("Cannot make null pointer constant with type: '" +
4540 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4542 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4543 delete (yyvsp[(1) - (2)].TypeVal);
4549 #line 1726 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4551 if (!UpRefs.empty())
4552 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4553 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4554 delete (yyvsp[(1) - (2)].TypeVal);
4560 #line 1733 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4562 if (!UpRefs.empty())
4563 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4564 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4566 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4568 // ConstExprs can exist in the body of a function, thus creating
4569 // GlobalValues whenever they refer to a variable. Because we are in
4570 // the context of a function, getExistingVal will search the functions
4571 // symbol table instead of the module symbol table for the global symbol,
4572 // which throws things all off. To get around this, we just tell
4573 // getExistingVal that we are at global scope here.
4575 Function *SavedCurFn = CurFun.CurrentFunction;
4576 CurFun.CurrentFunction = 0;
4578 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4581 CurFun.CurrentFunction = SavedCurFn;
4583 // If this is an initializer for a constant pointer, which is referencing a
4584 // (currently) undefined variable, create a stub now that shall be replaced
4585 // in the future with the right type of variable.
4588 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4589 const PointerType *PT = cast<PointerType>(Ty);
4591 // First check to see if the forward references value is already created!
4592 PerModuleInfo::GlobalRefsType::iterator I =
4593 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4595 if (I != CurModule.GlobalRefs.end()) {
4596 V = I->second; // Placeholder already exists, use it...
4597 (yyvsp[(2) - (2)].ValIDVal).destroy();
4600 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4601 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4602 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4603 GEN_ERROR("Invalid reference to global");
4605 // Create the forward referenced global.
4607 if (const FunctionType *FTy =
4608 dyn_cast<FunctionType>(PT->getElementType())) {
4609 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4610 CurModule.CurrentModule);
4612 GV = new GlobalVariable(PT->getElementType(), false,
4613 GlobalValue::ExternalWeakLinkage, 0,
4614 Name, CurModule.CurrentModule);
4617 // Keep track of the fact that we have a forward ref to recycle it
4618 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4623 (yyval.ConstVal) = cast<GlobalValue>(V);
4624 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4630 #line 1799 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4632 if (!UpRefs.empty())
4633 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4634 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4635 GEN_ERROR("Mismatched types for constant expression: " +
4636 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4637 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4638 delete (yyvsp[(1) - (2)].TypeVal);
4644 #line 1809 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4646 if (!UpRefs.empty())
4647 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4648 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4649 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4650 GEN_ERROR("Cannot create a null initialized value of this type");
4651 (yyval.ConstVal) = Constant::getNullValue(Ty);
4652 delete (yyvsp[(1) - (2)].TypeVal);
4658 #line 1819 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4659 { // integral constants
4660 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4661 GEN_ERROR("Constant value doesn't fit in type");
4662 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4668 #line 1825 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4669 { // arbitrary precision integer constants
4670 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4671 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4672 GEN_ERROR("Constant value does not fit in type");
4674 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4675 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4676 delete (yyvsp[(2) - (2)].APIntVal);
4682 #line 1835 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4683 { // integral constants
4684 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4685 GEN_ERROR("Constant value doesn't fit in type");
4686 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4692 #line 1841 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4693 { // arbitrary precision integer constants
4694 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4695 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4696 GEN_ERROR("Constant value does not fit in type");
4698 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4699 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4700 delete (yyvsp[(2) - (2)].APIntVal);
4706 #line 1851 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4707 { // Boolean constants
4708 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4709 (yyval.ConstVal) = ConstantInt::getTrue();
4715 #line 1856 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4716 { // Boolean constants
4717 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4718 (yyval.ConstVal) = ConstantInt::getFalse();
4724 #line 1861 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4725 { // Floating point constants
4726 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4727 GEN_ERROR("Floating point constant invalid for type");
4728 // Lexer has no type info, so builds all float and double FP constants
4729 // as double. Fix this here. Long double is done right.
4730 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4731 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4732 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4733 delete (yyvsp[(2) - (2)].FPVal);
4739 #line 1874 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4741 if (!UpRefs.empty())
4742 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4743 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4744 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4745 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4746 GEN_ERROR("invalid cast opcode for cast from '" +
4747 Val->getType()->getDescription() + "' to '" +
4748 DestTy->getDescription() + "'");
4749 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4750 delete (yyvsp[(5) - (6)].TypeVal);
4755 #line 1886 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4757 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4758 GEN_ERROR("GetElementPtr requires a pointer operand");
4761 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4763 GEN_ERROR("Index list invalid for constant getelementptr");
4765 SmallVector<Constant*, 8> IdxVec;
4766 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4767 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4768 IdxVec.push_back(C);
4770 GEN_ERROR("Indices to constant getelementptr must be constants");
4772 delete (yyvsp[(4) - (5)].ValueList);
4774 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4780 #line 1907 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4782 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4783 GEN_ERROR("Select condition must be of boolean type");
4784 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4785 GEN_ERROR("Select operand types must match");
4786 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4792 #line 1915 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4794 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4795 GEN_ERROR("Binary operator types must match");
4797 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4802 #line 1921 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4804 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4805 GEN_ERROR("Logical operator types must match");
4806 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4807 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4808 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4809 GEN_ERROR("Logical operator requires integral operands");
4811 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4817 #line 1932 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4819 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4820 GEN_ERROR("icmp operand types must match");
4821 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4826 #line 1937 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4828 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4829 GEN_ERROR("fcmp operand types must match");
4830 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4835 #line 1942 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4837 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4838 GEN_ERROR("vicmp operand types must match");
4839 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4844 #line 1947 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4846 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4847 GEN_ERROR("vfcmp operand types must match");
4848 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4853 #line 1952 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4855 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4856 GEN_ERROR("Invalid extractelement operands");
4857 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4863 #line 1958 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4865 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4866 GEN_ERROR("Invalid insertelement operands");
4867 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4873 #line 1964 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4875 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4876 GEN_ERROR("Invalid shufflevector operands");
4877 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4883 #line 1973 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4885 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4891 #line 1977 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4893 (yyval.ConstVector) = new std::vector<Constant*>();
4894 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4900 #line 1985 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4901 { (yyval.BoolVal) = false; ;}
4905 #line 1985 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4906 { (yyval.BoolVal) = true; ;}
4910 #line 1988 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4911 { (yyval.BoolVal) = true; ;}
4915 #line 1988 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4916 { (yyval.BoolVal) = false; ;}
4920 #line 1991 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4922 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4923 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4925 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4927 GEN_ERROR("Aliases can be created only to global values");
4929 (yyval.ConstVal) = Aliasee;
4931 delete (yyvsp[(1) - (2)].TypeVal);
4936 #line 2003 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4938 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4939 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4940 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4941 GEN_ERROR("invalid cast opcode for cast from '" +
4942 Val->getType()->getDescription() + "' to '" +
4943 DestTy->getDescription() + "'");
4945 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4947 delete (yyvsp[(5) - (6)].TypeVal);
4952 #line 2024 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4954 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4955 CurModule.ModuleDone();
4961 #line 2029 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4963 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4964 CurModule.ModuleDone();
4970 #line 2042 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4971 { CurFun.isDeclare = false; ;}
4975 #line 2042 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4977 CurFun.FunctionDone();
4983 #line 2046 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4984 { CurFun.isDeclare = true; ;}
4988 #line 2046 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4995 #line 2049 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5002 #line 2052 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5004 if (!UpRefs.empty())
5005 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
5006 // Eagerly resolve types. This is not an optimization, this is a
5007 // requirement that is due to the fact that we could have this:
5009 // %list = type { %list * }
5010 // %list = type { %list * } ; repeated type decl
5012 // If types are not resolved eagerly, then the two types will not be
5013 // determined to be the same type!
5015 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
5017 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5019 // If this is a named type that is not a redefinition, add it to the slot
5021 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
5024 delete (yyvsp[(3) - (3)].TypeVal);
5030 #line 2076 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5032 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5034 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5036 // If this is a named type that is not a redefinition, add it to the slot
5038 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5045 #line 2088 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5047 /* "Externally Visible" Linkage */
5048 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5049 GEN_ERROR("Global value initializer is not a constant");
5050 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5051 (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));
5057 #line 2095 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5064 #line 2099 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5066 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5067 GEN_ERROR("Global value initializer is not a constant");
5068 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));
5074 #line 2104 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5081 #line 2108 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5083 if (!UpRefs.empty())
5084 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5085 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));
5087 delete (yyvsp[(6) - (7)].TypeVal);
5092 #line 2114 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5100 #line 2118 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5103 if ((yyvsp[(1) - (5)].StrVal)) {
5104 Name = *(yyvsp[(1) - (5)].StrVal);
5105 delete (yyvsp[(1) - (5)].StrVal);
5108 GEN_ERROR("Alias name cannot be empty");
5110 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5112 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5114 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5115 CurModule.CurrentModule);
5116 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5117 InsertValue(GA, CurModule.Values);
5120 // If there was a forward reference of this alias, resolve it now.
5124 ID = ValID::createGlobalName(Name);
5126 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5128 if (GlobalValue *FWGV =
5129 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5130 // Replace uses of the fwdref with the actual alias.
5131 FWGV->replaceAllUsesWith(GA);
5132 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5133 GV->eraseFromParent();
5135 cast<Function>(FWGV)->eraseFromParent();
5144 #line 2158 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5151 #line 2161 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5158 #line 2167 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5160 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5161 if (AsmSoFar.empty())
5162 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5164 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5165 delete (yyvsp[(1) - (1)].StrVal);
5171 #line 2177 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5173 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5174 delete (yyvsp[(3) - (3)].StrVal);
5179 #line 2181 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5181 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5182 delete (yyvsp[(3) - (3)].StrVal);
5187 #line 2188 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5189 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5190 delete (yyvsp[(3) - (3)].StrVal);
5196 #line 2193 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5198 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5199 delete (yyvsp[(1) - (1)].StrVal);
5205 #line 2198 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5212 #line 2207 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5214 if (!UpRefs.empty())
5215 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5216 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5217 GEN_ERROR("void typed arguments are invalid");
5218 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5219 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5220 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5226 #line 2217 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5228 if (!UpRefs.empty())
5229 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5230 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5231 GEN_ERROR("void typed arguments are invalid");
5232 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5233 (yyval.ArgList) = new ArgListType;
5234 (yyval.ArgList)->push_back(E);
5240 #line 2228 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5242 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5248 #line 2232 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5250 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5251 struct ArgListEntry E;
5252 E.Ty = new PATypeHolder(Type::VoidTy);
5254 E.Attrs = ParamAttr::None;
5255 (yyval.ArgList)->push_back(E);
5261 #line 2241 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5263 (yyval.ArgList) = new ArgListType;
5264 struct ArgListEntry E;
5265 E.Ty = new PATypeHolder(Type::VoidTy);
5267 E.Attrs = ParamAttr::None;
5268 (yyval.ArgList)->push_back(E);
5274 #line 2250 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5276 (yyval.ArgList) = 0;
5282 #line 2256 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5284 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5285 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5287 // Check the function result for abstractness if this is a define. We should
5288 // have no abstract types at this point
5289 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5290 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5292 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5293 GEN_ERROR("Invalid result type for LLVM function");
5295 std::vector<const Type*> ParamTypeList;
5296 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5297 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5298 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5299 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5301 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5302 const Type* Ty = I->Ty->get();
5303 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5304 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5305 ParamTypeList.push_back(Ty);
5306 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5307 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
5311 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5312 if (isVarArg) ParamTypeList.pop_back();
5316 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5318 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5319 const PointerType *PFT = PointerType::getUnqual(FT);
5320 delete (yyvsp[(2) - (10)].TypeVal);
5323 if (!FunctionName.empty()) {
5324 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5326 ID = ValID::createGlobalID(CurModule.Values.size());
5330 // See if this function was forward referenced. If so, recycle the object.
5331 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5332 // Move the function to the end of the list, from whereever it was
5333 // previously inserted.
5334 Fn = cast<Function>(FWRef);
5335 assert(Fn->getParamAttrs().isEmpty() &&
5336 "Forward reference has parameter attributes!");
5337 CurModule.CurrentModule->getFunctionList().remove(Fn);
5338 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5339 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5340 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5341 if (Fn->getFunctionType() != FT ) {
5342 // The existing function doesn't have the same type. This is an overload
5344 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5345 } else if (Fn->getParamAttrs() != PAL) {
5346 // The existing function doesn't have the same parameter attributes.
5347 // This is an overload error.
5348 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5349 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5350 // Neither the existing or the current function is a declaration and they
5351 // have the same name and same type. Clearly this is a redefinition.
5352 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5353 } else if (Fn->isDeclaration()) {
5354 // Make sure to strip off any argument names so we can't get conflicts.
5355 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5359 } else { // Not already defined?
5360 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5361 CurModule.CurrentModule);
5362 InsertValue(Fn, CurModule.Values);
5365 CurFun.FunctionStart(Fn);
5367 if (CurFun.isDeclare) {
5368 // If we have declaration, always overwrite linkage. This will allow us to
5369 // correctly handle cases, when pointer to function is passed as argument to
5370 // another function.
5371 Fn->setLinkage(CurFun.Linkage);
5372 Fn->setVisibility(CurFun.Visibility);
5374 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5375 Fn->setParamAttrs(PAL);
5376 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5377 if ((yyvsp[(8) - (10)].StrVal)) {
5378 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5379 delete (yyvsp[(8) - (10)].StrVal);
5381 if ((yyvsp[(10) - (10)].StrVal)) {
5382 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5383 delete (yyvsp[(10) - (10)].StrVal);
5386 // Add all of the arguments we parsed to the function...
5387 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5388 if (isVarArg) { // Nuke the last entry
5389 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5390 "Not a varargs marker!");
5391 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5392 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5394 Function::arg_iterator ArgIt = Fn->arg_begin();
5395 Function::arg_iterator ArgEnd = Fn->arg_end();
5397 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5398 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5399 delete I->Ty; // Delete the typeholder...
5400 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5406 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5413 #line 2386 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5415 (yyval.FunctionVal) = CurFun.CurrentFunction;
5417 // Make sure that we keep track of the linkage type even if there was a
5418 // previous "declare".
5419 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5420 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5425 #line 2397 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5427 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5433 #line 2402 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5435 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5436 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5437 (yyval.FunctionVal) = CurFun.CurrentFunction;
5438 CurFun.FunctionDone();
5444 #line 2414 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5446 (yyval.BoolVal) = false;
5452 #line 2418 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5454 (yyval.BoolVal) = true;
5460 #line 2423 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5461 { // A reference to a direct constant
5462 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5468 #line 2427 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5470 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5476 #line 2431 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5477 { // Perhaps it's an FP constant?
5478 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5484 #line 2435 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5486 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5492 #line 2439 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5494 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5500 #line 2443 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5502 (yyval.ValIDVal) = ValID::createNull();
5508 #line 2447 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5510 (yyval.ValIDVal) = ValID::createUndef();
5516 #line 2451 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5517 { // A vector zero constant.
5518 (yyval.ValIDVal) = ValID::createZeroInit();
5524 #line 2455 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5525 { // Nonempty unsized packed vector
5526 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5527 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5529 VectorType* pt = VectorType::get(ETy, NumElements);
5530 PATypeHolder* PTy = new PATypeHolder(
5538 // Verify all elements are correct type!
5539 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5540 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5541 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5542 ETy->getDescription() +"' as required!\nIt is of type '" +
5543 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5546 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5547 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5553 #line 2480 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5555 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5561 #line 2484 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5563 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5564 delete (yyvsp[(3) - (5)].StrVal);
5565 delete (yyvsp[(5) - (5)].StrVal);
5571 #line 2494 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5572 { // Is it an integer reference...?
5573 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5579 #line 2498 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5581 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5587 #line 2502 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5588 { // Is it a named reference...?
5589 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5590 delete (yyvsp[(1) - (1)].StrVal);
5596 #line 2507 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5597 { // Is it a named reference...?
5598 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5599 delete (yyvsp[(1) - (1)].StrVal);
5605 #line 2520 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5607 if (!UpRefs.empty())
5608 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5609 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5610 delete (yyvsp[(1) - (2)].TypeVal);
5616 #line 2529 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5618 (yyval.ValueList) = new std::vector<Value *>();
5619 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5625 #line 2534 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5627 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
5633 #line 2539 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5635 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5641 #line 2543 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5642 { // Do not allow functions with 0 basic blocks
5643 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5649 #line 2552 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5651 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5653 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5654 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5655 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5661 #line 2561 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5663 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5664 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5665 if (CI2->getParent() == 0)
5666 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5667 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5668 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5674 #line 2570 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5675 { // Empty space between instruction lists
5676 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5682 #line 2574 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5683 { // Labelled (named) basic block
5684 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5685 delete (yyvsp[(1) - (1)].StrVal);
5692 #line 2582 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5693 { // Return with a result...
5694 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5695 assert(!VL.empty() && "Invalid ret operands!");
5696 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5697 delete (yyvsp[(2) - (2)].ValueList);
5703 #line 2589 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5704 { // Return with no result...
5705 (yyval.TermInstVal) = ReturnInst::Create();
5711 #line 2593 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5712 { // Unconditional Branch...
5713 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5715 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5720 #line 2598 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5722 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5723 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5725 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5727 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5729 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5734 #line 2608 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5736 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5738 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5740 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5741 (yyval.TermInstVal) = S;
5743 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5744 E = (yyvsp[(8) - (9)].JumpTable)->end();
5745 for (; I != E; ++I) {
5746 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5747 S->addCase(CI, I->second);
5749 GEN_ERROR("Switch case is constant, but not a simple integer");
5751 delete (yyvsp[(8) - (9)].JumpTable);
5757 #line 2627 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5759 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5761 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5763 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
5764 (yyval.TermInstVal) = S;
5770 #line 2637 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5773 // Handle the short syntax
5774 const PointerType *PFTy = 0;
5775 const FunctionType *Ty = 0;
5776 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5777 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5778 // Pull out the types of all of the arguments...
5779 std::vector<const Type*> ParamTypes;
5780 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5781 for (; I != E; ++I) {
5782 const Type *Ty = I->Val->getType();
5783 if (Ty == Type::VoidTy)
5784 GEN_ERROR("Short call syntax cannot be used with varargs");
5785 ParamTypes.push_back(Ty);
5788 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5789 GEN_ERROR("Invalid result type for LLVM function");
5791 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5792 PFTy = PointerType::getUnqual(Ty);
5795 delete (yyvsp[(3) - (14)].TypeVal);
5797 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5799 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5801 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5804 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5805 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5806 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
5808 // Check the arguments
5810 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5811 // Make sure no arguments is a good thing!
5812 if (Ty->getNumParams() != 0)
5813 GEN_ERROR("No arguments passed to a function that "
5814 "expects arguments");
5815 } else { // Has arguments?
5816 // Loop through FunctionType's arguments and ensure they are specified
5818 FunctionType::param_iterator I = Ty->param_begin();
5819 FunctionType::param_iterator E = Ty->param_end();
5820 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5823 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5824 if (ArgI->Val->getType() != *I)
5825 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5826 (*I)->getDescription() + "'");
5827 Args.push_back(ArgI->Val);
5828 if (ArgI->Attrs != ParamAttr::None)
5829 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5832 if (Ty->isVarArg()) {
5834 for (; ArgI != ArgE; ++ArgI, ++index) {
5835 Args.push_back(ArgI->Val); // push the remaining varargs
5836 if (ArgI->Attrs != ParamAttr::None)
5837 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5839 } else if (I != E || ArgI != ArgE)
5840 GEN_ERROR("Invalid number of parameters detected");
5845 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5847 // Create the InvokeInst
5848 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
5849 Args.begin(), Args.end());
5850 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5851 II->setParamAttrs(PAL);
5852 (yyval.TermInstVal) = II;
5853 delete (yyvsp[(6) - (14)].ParamList);
5859 #line 2722 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5861 (yyval.TermInstVal) = new UnwindInst();
5867 #line 2726 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5869 (yyval.TermInstVal) = new UnreachableInst();
5875 #line 2733 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5877 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5878 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5881 GEN_ERROR("May only switch on a constant pool value");
5883 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5885 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5890 #line 2744 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5892 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5893 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5897 GEN_ERROR("May only switch on a constant pool value");
5899 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5901 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5906 #line 2757 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5908 // Is this definition named?? if so, assign the name...
5909 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5911 InsertValue((yyvsp[(2) - (2)].InstVal));
5912 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5918 #line 2767 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5919 { // Used for PHI nodes
5920 if (!UpRefs.empty())
5921 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5922 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5923 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5925 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5927 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5928 delete (yyvsp[(1) - (6)].TypeVal);
5933 #line 2778 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5935 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5936 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5938 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5940 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5945 #line 2788 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5947 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5948 if (!UpRefs.empty())
5949 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5950 // Used for call and invoke instructions
5951 (yyval.ParamList) = new ParamList();
5952 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5953 (yyval.ParamList)->push_back(E);
5954 delete (yyvsp[(1) - (4)].TypeVal);
5960 #line 2799 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5962 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5963 // Labels are only valid in ASMs
5964 (yyval.ParamList) = new ParamList();
5965 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5966 (yyval.ParamList)->push_back(E);
5972 #line 2807 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5974 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5975 if (!UpRefs.empty())
5976 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5977 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5978 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5979 (yyval.ParamList)->push_back(E);
5980 delete (yyvsp[(3) - (6)].TypeVal);
5986 #line 2817 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5988 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5989 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5990 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5991 (yyval.ParamList)->push_back(E);
5997 #line 2824 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5998 { (yyval.ParamList) = new ParamList(); ;}
6002 #line 2827 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6003 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6007 #line 2828 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6009 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6010 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6016 #line 2835 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6018 (yyval.BoolVal) = true;
6024 #line 2839 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6026 (yyval.BoolVal) = false;
6032 #line 2844 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6034 if (!UpRefs.empty())
6035 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6036 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6037 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6039 "Arithmetic operator requires integer, FP, or packed operands");
6040 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6042 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6044 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6045 if ((yyval.InstVal) == 0)
6046 GEN_ERROR("binary operator returned null");
6047 delete (yyvsp[(2) - (5)].TypeVal);
6052 #line 2860 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6054 if (!UpRefs.empty())
6055 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6056 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6057 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6058 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6059 GEN_ERROR("Logical operator requires integral operands");
6061 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6063 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6065 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6066 if ((yyval.InstVal) == 0)
6067 GEN_ERROR("binary operator returned null");
6068 delete (yyvsp[(2) - (5)].TypeVal);
6073 #line 2877 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6075 if (!UpRefs.empty())
6076 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6077 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6078 GEN_ERROR("Vector types not supported by icmp instruction");
6079 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6081 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6083 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6084 if ((yyval.InstVal) == 0)
6085 GEN_ERROR("icmp operator returned null");
6086 delete (yyvsp[(3) - (6)].TypeVal);
6091 #line 2891 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6093 if (!UpRefs.empty())
6094 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6095 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6096 GEN_ERROR("Vector types not supported by fcmp instruction");
6097 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6099 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6101 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6102 if ((yyval.InstVal) == 0)
6103 GEN_ERROR("fcmp operator returned null");
6104 delete (yyvsp[(3) - (6)].TypeVal);
6109 #line 2905 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6111 if (!UpRefs.empty())
6112 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6113 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6114 GEN_ERROR("Scalar types not supported by vicmp instruction");
6115 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6117 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6119 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6120 if ((yyval.InstVal) == 0)
6121 GEN_ERROR("icmp operator returned null");
6122 delete (yyvsp[(3) - (6)].TypeVal);
6127 #line 2919 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6129 if (!UpRefs.empty())
6130 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6131 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6132 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6133 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6135 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6137 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6138 if ((yyval.InstVal) == 0)
6139 GEN_ERROR("fcmp operator returned null");
6140 delete (yyvsp[(3) - (6)].TypeVal);
6145 #line 2933 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6147 if (!UpRefs.empty())
6148 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6149 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6150 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6151 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6152 GEN_ERROR("invalid cast opcode for cast from '" +
6153 Val->getType()->getDescription() + "' to '" +
6154 DestTy->getDescription() + "'");
6155 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6156 delete (yyvsp[(4) - (4)].TypeVal);
6161 #line 2945 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6163 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6164 GEN_ERROR("select condition must be boolean");
6165 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6166 GEN_ERROR("select value types should match");
6167 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6173 #line 2953 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6175 if (!UpRefs.empty())
6176 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6177 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6178 delete (yyvsp[(4) - (4)].TypeVal);
6184 #line 2960 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6186 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6187 GEN_ERROR("Invalid extractelement operands");
6188 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6194 #line 2966 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6196 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6197 GEN_ERROR("Invalid insertelement operands");
6198 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6204 #line 2972 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6206 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6207 GEN_ERROR("Invalid shufflevector operands");
6208 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6214 #line 2978 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6216 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6217 if (!Ty->isFirstClassType())
6218 GEN_ERROR("PHI node operands must be of first class type");
6219 (yyval.InstVal) = PHINode::Create(Ty);
6220 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6221 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6222 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6223 GEN_ERROR("All elements of a PHI node must be of the same type");
6224 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6225 (yyvsp[(2) - (2)].PHIList)->pop_front();
6227 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6233 #line 2994 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6236 // Handle the short syntax
6237 const PointerType *PFTy = 0;
6238 const FunctionType *Ty = 0;
6239 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6240 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6241 // Pull out the types of all of the arguments...
6242 std::vector<const Type*> ParamTypes;
6243 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6244 for (; I != E; ++I) {
6245 const Type *Ty = I->Val->getType();
6246 if (Ty == Type::VoidTy)
6247 GEN_ERROR("Short call syntax cannot be used with varargs");
6248 ParamTypes.push_back(Ty);
6251 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6252 GEN_ERROR("Invalid result type for LLVM function");
6254 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6255 PFTy = PointerType::getUnqual(Ty);
6258 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6261 // Check for call to invalid intrinsic to avoid crashing later.
6262 if (Function *theF = dyn_cast<Function>(V)) {
6263 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6264 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6265 !theF->getIntrinsicID(true))
6266 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6267 theF->getName() + "'");
6270 // Set up the ParamAttrs for the function
6271 SmallVector<ParamAttrsWithIndex, 8> Attrs;
6272 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6273 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
6274 // Check the arguments
6276 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6277 // Make sure no arguments is a good thing!
6278 if (Ty->getNumParams() != 0)
6279 GEN_ERROR("No arguments passed to a function that "
6280 "expects arguments");
6281 } else { // Has arguments?
6282 // Loop through FunctionType's arguments and ensure they are specified
6283 // correctly. Also, gather any parameter attributes.
6284 FunctionType::param_iterator I = Ty->param_begin();
6285 FunctionType::param_iterator E = Ty->param_end();
6286 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6289 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6290 if (ArgI->Val->getType() != *I)
6291 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6292 (*I)->getDescription() + "'");
6293 Args.push_back(ArgI->Val);
6294 if (ArgI->Attrs != ParamAttr::None)
6295 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6297 if (Ty->isVarArg()) {
6299 for (; ArgI != ArgE; ++ArgI, ++index) {
6300 Args.push_back(ArgI->Val); // push the remaining varargs
6301 if (ArgI->Attrs != ParamAttr::None)
6302 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6304 } else if (I != E || ArgI != ArgE)
6305 GEN_ERROR("Invalid number of parameters detected");
6308 // Finish off the ParamAttrs and check them
6311 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6313 // Create the call node
6314 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6315 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6316 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6317 CI->setParamAttrs(PAL);
6318 (yyval.InstVal) = CI;
6319 delete (yyvsp[(6) - (8)].ParamList);
6320 delete (yyvsp[(3) - (8)].TypeVal);
6326 #line 3083 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6328 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6334 #line 3088 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6336 (yyval.BoolVal) = true;
6342 #line 3092 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6344 (yyval.BoolVal) = false;
6350 #line 3099 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6352 if (!UpRefs.empty())
6353 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6354 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6355 delete (yyvsp[(2) - (3)].TypeVal);
6361 #line 3106 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6363 if (!UpRefs.empty())
6364 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6365 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6367 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6368 delete (yyvsp[(2) - (6)].TypeVal);
6373 #line 3114 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6375 if (!UpRefs.empty())
6376 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6377 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6378 delete (yyvsp[(2) - (3)].TypeVal);
6384 #line 3121 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6386 if (!UpRefs.empty())
6387 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6388 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6390 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6391 delete (yyvsp[(2) - (6)].TypeVal);
6396 #line 3129 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6398 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6399 GEN_ERROR("Trying to free nonpointer type " +
6400 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6401 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6407 #line 3137 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6409 if (!UpRefs.empty())
6410 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6411 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6412 GEN_ERROR("Can't load from nonpointer type: " +
6413 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6414 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6415 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6416 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6417 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6419 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6420 delete (yyvsp[(3) - (5)].TypeVal);
6425 #line 3151 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6427 if (!UpRefs.empty())
6428 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6429 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6431 GEN_ERROR("Can't store to a nonpointer type: " +
6432 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6433 const Type *ElTy = PT->getElementType();
6434 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6435 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6436 "' into space of type '" + ElTy->getDescription() + "'");
6438 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6440 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6441 delete (yyvsp[(5) - (7)].TypeVal);
6446 #line 3168 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6448 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6449 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6450 GEN_ERROR("Invalid getresult operands");
6451 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6452 delete (yyvsp[(2) - (5)].TypeVal);
6458 #line 3176 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6460 if (!UpRefs.empty())
6461 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6462 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6463 GEN_ERROR("getelementptr insn requires pointer operand");
6465 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6466 GEN_ERROR("Invalid getelementptr indices for type '" +
6467 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6468 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6470 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6471 delete (yyvsp[(2) - (4)].TypeVal);
6472 delete (yyvsp[(4) - (4)].ValueList);
6477 /* Line 1267 of yacc.c. */
6478 #line 6479 "llvmAsmParser.tab.c"
6481 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6485 YY_STACK_PRINT (yyss, yyssp);
6490 /* Now `shift' the result of the reduction. Determine what state
6491 that goes to, based on the state we popped back to and the rule
6492 number reduced by. */
6496 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6497 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6498 yystate = yytable[yystate];
6500 yystate = yydefgoto[yyn - YYNTOKENS];
6505 /*------------------------------------.
6506 | yyerrlab -- here on detecting error |
6507 `------------------------------------*/
6509 /* If not already recovering from an error, report this error. */
6513 #if ! YYERROR_VERBOSE
6514 yyerror (YY_("syntax error"));
6517 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6518 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6520 YYSIZE_T yyalloc = 2 * yysize;
6521 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6522 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6523 if (yymsg != yymsgbuf)
6524 YYSTACK_FREE (yymsg);
6525 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6527 yymsg_alloc = yyalloc;
6531 yymsg_alloc = sizeof yymsgbuf;
6535 if (0 < yysize && yysize <= yymsg_alloc)
6537 (void) yysyntax_error (yymsg, yystate, yychar);
6542 yyerror (YY_("syntax error"));
6544 goto yyexhaustedlab;
6552 if (yyerrstatus == 3)
6554 /* If just tried and failed to reuse look-ahead token after an
6555 error, discard it. */
6557 if (yychar <= YYEOF)
6559 /* Return failure if at end of input. */
6560 if (yychar == YYEOF)
6565 yydestruct ("Error: discarding",
6571 /* Else will try to reuse look-ahead token after shifting the error
6576 /*---------------------------------------------------.
6577 | yyerrorlab -- error raised explicitly by YYERROR. |
6578 `---------------------------------------------------*/
6581 /* Pacify compilers like GCC when the user code never invokes
6582 YYERROR and the label yyerrorlab therefore never appears in user
6584 if (/*CONSTCOND*/ 0)
6587 /* Do not reclaim the symbols of the rule which action triggered
6591 YY_STACK_PRINT (yyss, yyssp);
6596 /*-------------------------------------------------------------.
6597 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6598 `-------------------------------------------------------------*/
6600 yyerrstatus = 3; /* Each real token shifted decrements this. */
6604 yyn = yypact[yystate];
6605 if (yyn != YYPACT_NINF)
6608 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6616 /* Pop the current state because it cannot handle the error token. */
6621 yydestruct ("Error: popping",
6622 yystos[yystate], yyvsp);
6625 YY_STACK_PRINT (yyss, yyssp);
6634 /* Shift the error token. */
6635 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6641 /*-------------------------------------.
6642 | yyacceptlab -- YYACCEPT comes here. |
6643 `-------------------------------------*/
6648 /*-----------------------------------.
6649 | yyabortlab -- YYABORT comes here. |
6650 `-----------------------------------*/
6656 /*-------------------------------------------------.
6657 | yyexhaustedlab -- memory exhaustion comes here. |
6658 `-------------------------------------------------*/
6660 yyerror (YY_("memory exhausted"));
6666 if (yychar != YYEOF && yychar != YYEMPTY)
6667 yydestruct ("Cleanup: discarding lookahead",
6669 /* Do not reclaim the symbols of the rule which action triggered
6670 this YYABORT or YYACCEPT. */
6672 YY_STACK_PRINT (yyss, yyssp);
6673 while (yyssp != yyss)
6675 yydestruct ("Cleanup: popping",
6676 yystos[*yyssp], yyvsp);
6681 YYSTACK_FREE (yyss);
6684 if (yymsg != yymsgbuf)
6685 YYSTACK_FREE (yymsg);
6687 /* Make sure YYID is used. */
6688 return YYID (yyresult);
6692 #line 3193 "/Volumes/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6695 // common code from the two 'RunVMAsmParser' functions
6696 static Module* RunParser(Module * M) {
6697 CurModule.CurrentModule = M;
6698 // Check to make sure the parser succeeded
6701 delete ParserResult;
6705 // Emit an error if there are any unresolved types left.
6706 if (!CurModule.LateResolveTypes.empty()) {
6707 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6708 if (DID.Type == ValID::LocalName) {
6709 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6711 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6714 delete ParserResult;
6718 // Emit an error if there are any unresolved values left.
6719 if (!CurModule.LateResolveValues.empty()) {
6720 Value *V = CurModule.LateResolveValues.back();
6721 std::map<Value*, std::pair<ValID, int> >::iterator I =
6722 CurModule.PlaceHolderInfo.find(V);
6724 if (I != CurModule.PlaceHolderInfo.end()) {
6725 ValID &DID = I->second.first;
6726 if (DID.Type == ValID::LocalName) {
6727 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6729 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6732 delete ParserResult;
6737 // Check to make sure that parsing produced a result
6741 // Reset ParserResult variable while saving its value for the result.
6742 Module *Result = ParserResult;
6748 void llvm::GenerateError(const std::string &message, int LineNo) {
6749 if (LineNo == -1) LineNo = LLLgetLineNo();
6750 // TODO: column number in exception
6752 TheParseError->setError(LLLgetFilename(), message, LineNo);
6756 int yyerror(const char *ErrorMsg) {
6757 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6758 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6759 if (yychar != YYEMPTY && yychar != 0) {
6760 errMsg += " while reading token: '";
6761 errMsg += std::string(LLLgetTokenStart(),
6762 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6764 GenerateError(errMsg);